TimeLord?

So my next step in my reef keeper project is to add a feature for sunrise and sunset to actually happen at sunrise and sunset. I figured there might be a library to calculate this that I can mooch off of. I’ve found a couple, or at least derivations of them, but they include a TimeLord library which I’m finding little support for and even some people claiming it’s outdated. So the next question is, does TimeLord still work? and is there a library out there to calculate sunrise/sunset?

I downloaded the TimeLord library from http://www.andregoncalves.info/ag_blog/?p=47, and ran the example. I had to comment out one line, because a variable was neither declared nor used anywhere else.

You have to set your latitude, longitude, timezone, month, and date. The month and day need to be changed in two places.

The little app I have in my PC's toolbar tells me that at my lat/long, sunrise and sunset are at 08:57 and 17:04. The TimeLord example tells me they are 08:59 and 17:00.

So I would say it's pretty good.

Ok, I did get their system working. Apparently what I was using was an outdated library. They made some changes and now I can actually make use of it. Thanks

I wonder how much processing power, not to mention RAM, it chews up.

Maybe better just to hard-code a lookup table based on month, and interpolate / extrapolate based on the day within the month.

Unless it's cloudy a LDR would do the job accurately.

(If you wished to avoid this library)

odometer:
I wonder how much processing power, not to mention RAM, it chews up.

Maybe better just to hard-code a lookup table based on month, and interpolate / extrapolate based on the day within the month.

I wouldn’t be surprised if you could get adequate numbers that way with just Dec 22 and Jun 22 data.

odometer: I wonder how much processing power, not to mention RAM, it chews up.

Maybe better just to hard-code a lookup table based on month, and interpolate / extrapolate based on the day within the month.

The example sketch that calculates sunrise, sunset, and time of local noon takes up about 6K bytes, 333 bytes of RAM (before running), and takes about 7 milliseconds (7040 to 7144 microseconds) to run on an Uno, including the calculations and printing of the elapsed time.. So using it or not is a decision that would dpend on what accuracy (adequacy) is required in the application.

In this thread I analyse simple formulas for sunset and sunrise which work quite well: - http://forum.arduino.cc/index.php?topic=66426.msg487457#msg487457 -

Depending on the location the numbers differ, but it boils down to a few lines of code.

void getRiseSet()
{
  float common = cos( ((month-1)*30.5+dayOfMonth + 8 ) / 58.091554) ;  
  sunrise = 346 + 74 * common;
  sunset =  1080 - 82 * common;    
}