1) Keeping accurate date/time without main power supply.2) The Arduino is NOT a "real-time" system. There are things you can program that could keep the internal millis() or micros() from keeping accurate time.3) You want to run something for more than 50 days (for millis) or 70 minutes (for micros)4) You want to actually know what time and/or date it is in the real world.
...OTOH, the main Arduino controller chip was never intended for precision timekeeping
Quote from: MarkT on Mar 08, 2011, 02:00 amIn fact I got motivated enough to replace the resonator on my Uno board, partly to see how tricky it was to do.By any chance to you have a part # for the crystal?Thanks,William
In fact I got motivated enough to replace the resonator on my Uno board, partly to see how tricky it was to do.
creating anything other than the most simpletons of clocks without an RTC is highly questionable, unless its the trip than matters more than the destination.
(S)NTP is most used for synchronizing RTC's (or a software datetime lib) in Arduinoland. All RTC (but one) I know can be set up to 1 second precision, so in practice NTP and SNTP have "too much" precision for them. It would be nice if the millis() or micros() could be set according to the decimal part but unfortunately this is not possible on an Arduino AFAIK. OK one can create NTPmillis() and NTPmicros() that uses an offset or a hardware timer or ... So in Arduinoland the decimal part of (S)NTP is mostly dropped, and yes sometimes it is used for rounding to which second is nearest. IN fact 99% of the Arduino sketches would just need the Time protocol (RFC868).The Arduino has little resources and I assume that adjusting gradually for the drift for an Arduino is possible but it would take quite a bit of the resources leaving little room for the main sketch. (please let someone prove me wrong by building an Arduino NTP server library The one second precision of the RTC mentioned before also means - from observing the apps discussed at the forum - that the RTC is seldom (never?) used for high precision timing, in Arduino context most people use millis() and micros() for this. The time of the RTC is mostly used for display and logging, and yes also for low precision timing like switching on/off the light of an aquarium or so. I see two different kind of clocks working side by side each for their specific purpose. And I think it is not bad.
As I've pointed out in another thread, time is subtly hard to get right. As long as you don't underestimate its complexities and truly define your requirements, you'll likely be okay. Otherwise, expect a bumpy road and lessons learned.
time is subtly hard to get right