well, the thing is, the timer interrupt by itself, when controlled by an external crystal is every bit as precise as a "RTC". If you don't have an external crystal (i.e. you are using a ceramic resonator or an internal oscillator), it would be far less expensive than an RTC and support hardware.
Also worth noting that there are lots of ways for an application to interfere (mess up) when converting "computer time" to real time, though millis() looks pretty solid, in 0011 anyway.
But an accurate software clock has been done, several times, on an arduino.
Arduino playground - Time . If a software clock is off by a consistent amount, then it can be calibrated in software too.
Based on the figures here, my guess is that your inaccuracies are due to using a ceramic resonator instead of a crystal.
Arduino Forum - Arduino clock accuracy
Quote:
The accuracy of the millis() function is governed by the clock in your Arduino board which is driven by either a crystal or ceramic resonator. A crystal has an accuracy of roughly +/- 50 parts per million (ppm) or so (some are more accurate some are less, but 50ppm is about right for a cheap crystal).
50 ppm = 0.005% accuracy which in your case equals about 0.72 seconds deviation from the nominal delay over 4 hours at 16MHz
A ceramic resonator is about 0.5% accurate = 72 seconds over 4 hours or about 1 minute 12 seconds at 16MHz.
...
The same kind of clock accuracy calculations apply to a DS1307 RTC, the fundamental accuracy of the crystal determines the accuracy of the time it keeps, there's nothing special about the DS1307 in terms of accuracy and it could in fact be worse than the Arduino's internal clock. It all comes down to the simple question of how accurate you need the timing to be for your application and then select an appropriate oscillator.
|
I mean sheesh, 40 cent xtal vs 30 cent resonator +
$20 RTC module?!?
FWIW, I have a hello kitty watch (came in a kids meal) hotglued to the dash for a clock