0

Determine Sunrise/Sunset time for video playback

Hello,

I'd like to be able to determine the time of sunrise/sunset given the currently set date. I.E. this would be to trigger a video at sunset every day. I'm looking for any advice as far as brightauthor tricks or brightscript examples.

Sincerely,
Marcus

3 comments

  • 0
    Avatar
    Bright Scripters

    An Astronomical Switch, combined with GPIO wiring could be a solution.

    http://www.larsentoubro.com/media/29108/level3_application-note-astronomical-time-switch.pdf

    You program the switch with it global coordinates, and it would calculate the sunset/sunrise timing.

    With such a solution, there is no need for internet access, nor recurring subscription fees.

  • 0
    Avatar
    JRB Technical

    I went looking to find those products and their cost, but didn't have much luck with initial search.  Looks like these might be outdated (or I didn't look deep enough). I found the price but no availability for a similar Legrand product, it was around $250USD.

    For those a little more adventuresome, this would be another good simple project for a Raspberry Pi, a little scripting, and GPIO. 

    Sunrise/Sunset times could be acquired from a very old Linux program like SunWait ( https://meanderingpi.wordpress.com/sunwait/ ) and adding a RTC module to the RasPi. Or from a few other sources via various Weather API's, etc. if you have internet access.  You would only need to update data  for your location once a day, most API's have a free version that this low level of access would be find.

    Then you could write some simple scripts to trigger GPIO's at Sunrise and Sunset. This also gives you some more flexibility as you could script in modifiers like Sunrise minus 20 minutes, Sunset plus 20 minutes, etc.

     

  • 0
    Avatar
    Shaun

    Hi Marcus,

    I have done this for an outside exhibit that had a sun up and sun down element. We did it by getting a months worth of times from the local met office and just referenced a json file locally on the player. This worked for the short term but I would probably not recommend it for the long term as you need a good ntp reference and away to get the information into the players.

    Agree with John on the method of implementation..

    The most large scale way of doing it would be to have a server somewhere serve up the times to players in the form of a data feed that modifies a user variable if using BA or just a straight JSON/XML file from the server for Brightscript that could download a months and just modify its control variable at midnight or some time before sun up. This would allow you to have multiple players across regions and a way to centrally vary the time, while allowing for the possibility of the player being offline as it would have some rough idea of times even for a couple of days if they lose connectivity.

    Sources for the info can vary from GPS timeservers, Raspberry Pi's or something as simply copying it from a webpage for the next x years and converting that info to usable format, running a nodeJS server either locally on the player or on a server https://www.npmjs.com/package/solar-calc 

    If you were super duper keen you could plug a GPS receiver into the player and have it calculate it based on its actual position in the world!

    Hope that helps.

Please sign in to leave a comment.