SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By neg2led
#71901
I've been having trouble making an arduino sketch that will calculate the number of seconds given in a year - i have a SFE DS1307 RTC module feeding in date/time, but i honestly have no clue how to calculate remaining minutes/seconds in the year from this.

Idea is to make a little box that sits somewhere slowly counting away each second and minute of the year on a 1x8 LCD (hd44870 controller)

--neg
By Liencouer
#72046
Without having actually played with one of these myself, functionally it shouldn't be to difficult.

It looks like you have to program the actual time into it, and then its just a matter of reading when 'now' is from it, and subtracting the number of seconds than have elapsed since the beginning of the year from the number of seconds that are in this year. It just becomes a units conversion problem. Seconds = 60*minutes + 60*60*hours + ...

It also looks like it has a square wave output that you can configure to a 1hz rate... you could just give your arduino a start value (there are n seconds left this year) and count ticks from there.

Should get you started anyways.

[EDIT]; Looks like the sparkfun ones come pre programmed to MST. You therefore wouldn't need to program the time, however you would have to calculate the offset from wherever you are to MST.
By neg2led
#72084
I've already programmed the time to my local time :)

I think i should be able to do it, but the problem now is getting multiplexed 7-segment out...i'll figure that one out myself.