element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Forget Me Not Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Forget Me Not Design Challenge
  • More
  • Cancel
Forget Me Not Design Challenge
Blog Episode 9: Forget Me Not: Sunshine, Lollipops, and Rainbows
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: michaelwylie
  • Date Created: 28 Aug 2014 4:47 AM Date Created
  • Views 1558 views
  • Likes 2 likes
  • Comments 9 comments
  • forget_me_not
  • openhab
  • iot_monitor_auto
Related
Recommended

Episode 9: Forget Me Not: Sunshine, Lollipops, and Rainbows

michaelwylie
michaelwylie
28 Aug 2014

Introduction

This post has no lollipops or rainbows, but I couldn't think of a better title. Today I was experimenting with another binding in OpenHAB. This one is called Astro, and it provides information about the suns position throughout the day. This means you can know exactly where the sun is located in the sky relative to your home. It also provides the basics like sunrise, noon, and sunset times. So, you might ask,

 

"Why would I care about the position of the sun?"

 

If you were automating your blinds, this tool would be extremely powerful. You can set rules in OpenHAB to automatically close your blinds when the sun would be shining through windows and heating your home. This binding makes me wish automating blinds was part of my project, but I doubt my landlord would approve. I have settled for these basic quantities added to my OpenHAB UI:

  • The time of sunrise
  • The time of noon (solar)
  • The time of sunset
  • The suns position (Azimuth and Elevation)

 

It may be interesting, later, to perform some calculations with these numbers, but for now I'll settle for the numbers.

 

Starting Astro

Once again, open up that openhab.cfg file and make the following edits:

################################# Astro Binding #######################################
#
# The latitude
astro:latitude=NN.nnnnnn

# The longitude
astro:longitude=-NN.nnnnnn

# Refresh interval for azimuth and elevation calculation in seconds
# (optional, defaults to disabled)
astro:interval=600

 

astro:interval is the number of seconds between updating the values. Also, you may be wondering what your position's latitude and longitude are. Load up Google Maps. Type in your address and let Google find your house. You can either stay in map view or switch to Earth view, which ever you prefer. Simply click anywhere on the map, and you will see the latitude and longitude in a small box such as below:

image

Hopefully you have been able to set your latitude and longitude correctly. Now restart OpenHAB (I.e. exit and run start.sh again)

 

Adding the Items

I added the following values to the items file:

Number     Azimuth       "Azimuth [%.2f]"         {astro="type=AZIMUTH"}
Number     Elevation     "Elevation [%.2f]"       {astro="type=ELEVATION"}
DateTime   Sunrise_Time  "Sunrise [%1$tH:%1$tM]"  {astro="type=SUNRISE_TIME"}
DateTime   Noon_Time     "Noon [%1$tH:%1$tM]"     {astro="type=NOON_TIME"}
DateTime   Sunset_Time   "Sunset [%1$tH:%1$tM]"  {astro="type=SUNSET_TIME"}

 

Modifying the Sitemap

I also added this frame to my sitemap:

Frame label="Astro" {
     Text item=Azimuth
     Text item=Elevation
     Text item=Sunrise_Time
     Text item=Noon_Time
     Text item=Sunset_Time
}

 

Results

After all is said and done, here is the result:

image

 

Almost forgot! Wondering what the heck Azimuth and Elevation are anyway? Azimuth is the angle from NORTH to the sun's position moving clockwise and Elevation is the angle from the horizon to the sun. Elevation is simple, but to understand azimuth picture a clock face where 12 o'clock is NORTH. This position corresponds to an azimuth of 0 degrees. Three o'clock would be an azimuth of 90 degrees, six o'clock would be 180 degrees, and so on.

  • Sign in to reply
  • fvan
    fvan over 11 years ago

    I came here expecting rainbows, lollipops and maybe even unicorns ... Boy, have I been fooled ...

     

    Aside from that, good post image

     

    Frederick

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ipv1
    ipv1 over 11 years ago

    Check this out for an example for Calculating the position of the sun...

    https://code.google.com/p/openhab-samples/wiki/Rules

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelwylie
    michaelwylie over 11 years ago

    According to their release notes they are using the calculations from the SunCalc open source app.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelwylie
    michaelwylie over 11 years ago in reply to mcb1

    It's all in the astro binding.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 11 years ago in reply to michaelwylie

    South huh, wonder what that's like

     

    Well if you got lost here, and relied on the sun being south... you'd get lost. image

    You also want buildings facing north to catch the sun.

     

    Could be worse ... at the equator it goes over the top of them.

     

     

    Looks like interesting information.

    You've included the bindings, but is there software to be loaded somewhere, or what does it use to calculate the data.?

     

    mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube