I'm using a DS1307 Real Time Clock module on an Arduino, using the 'adafruit' RTC library.
It works OK, but if the board is powered off, the clock doesn't continue to run on the backup battery. It doesn't reset the clock - it just halts on the last time and date setting. I've tried changing the backup battery, but with no effect - besides, if the battery was flat I'd expect the clock to reset, not halt.
Ideas, anyone please?
Jim
From the DS1307 data sheet (highly recommended reading!):
Bit 7 of Register 0 is the clock halt (CH) bit. When this bit is set to 1, the oscillator is disabled. When cleared to 0, the oscillator is enabled.
Register 0 is the seconds register. Try resetting the time, including the seconds. There is also a potential problem if any of the data connections to the Arduino EVER becomes slightly negative, which can conceivably happen when the Arduino is switched off. Again, from the data sheet:
WARNING: Negative undershoots below -0.3V while the part is in battery-backed mode may cause loss of data.
You might also measure the voltage at the Vbat pin of the clock chip, to make sure that it is actually being powered by the battery when the Arduino is off.
Finally, if you are using one of those cheap "Tiny RTC" boards from China, all bets are off. They are basically junk, extremely poorly designed and very unreliable. See other posts on the forum.
Thanks for the informative reply 'jremington'.
It turned out the it was a programming error of mine after all!
I had a line to pick up the time at compliation:
rtc.adjust(DateTime(_DATE_,_TIME))
Whereas it should have been:
if (! rtc.isrunning()) rtc.adjust(DateTime(_DATE_,_TIME));
Jim