← Back to context

Comment by RetroTechie

10 hours ago

> The best option is the RTC. Buy a DS3231, hook it up to your microcontroller and a button battery, and forget about it for a few years.

RTC ICs are for use in bigger systems where main CPUs have other things to do. If you design a clock around a microcontroller dedicated to the task, that microcontroller can do the timekeeping all by itself. No extra IC needed.

Also quartz oscillators (ones built from discrete parts) can be trimmed. If you'd take the trouble, a cheapo quartz oscillator can go from 20..50 ppm to perhaps a few ppm worst case. Which as you point out is in the order of a minute per year. If that's not good enough AND power budget is available, an oven-controlled quartz oscillator improves on that.

All that online / GPS / radio controlled stuff is for convenience only (daylight saving!). Not needed just to have an accurate clock.

Oh and there's using AC mains frequency as timebase.

I forgot about the AC mains :)

My experience with embedded stuff is very limited -- just some hobby projects on the Pico.

From what I've read, though, the on-board oscillators (there are a few of them) can drift quite a bit. One data point [says][1] several seconds per day.

On the other hand, if what you want is a microcontroller with an accurate clock, they probably make those (just not the Pico).

[1]: https://forums.raspberrypi.com/viewtopic.php?t=29255