I’ve been looking unsuccessfully for my notes!!!
First off, many Ardiunos use Ceramic Resonators, not Crystals. Resonators are typically only within 0.5% of nominal frequency, are distinctly temperature sensitive, and not particularly stable.
Here’s a list of frequencies from an Arduion Mega2560 resonator, nominal 16000000Hz measured at GPS 1 second intervals:
Lowest is 15983918Hz, highest is 15983941Hz, jumping within a 21Hz range over 23 seconds, even though the temperature hasn’t altered. Resonators aren’t precision timekeepers!
For much better stability the Leonardo and Micropro Arduinos are clocked with real crystals, but these are the ordinary 100ppm type, and not temperature compensated. Actually, all those I’ve measured have been closer to 50ppm than 100ppm, so not bad. But the lack of temp compensation means a Leonardo programmed as a digital clock drifts noticeably over a few days compared with a digital clock.
For syncing to DCF I agree with Robert – ordinary Arduino accuracy should be ‘good enough’. I’d use micros() too. micros() counts in 4uS ticks, and wraps every 70 minutes or so, which I think makes it better suited to timing a 18150mS gap.
Now I’ve discovered the joys of Arduino hardware timers, I’m inclined to use them for a job like this. Rather than loop with an IF statement calling micros() repeatedly to see if 18150mS has elapsed, it’s more accurate and performant to set a timer for 18150mS and have it call an interrupt function after that time has elapsed complete. Using an interrupt avoids delays caused by the repeated IF check, and makes the DCF event handling pretty much independent of whatever else the Arduino has to do.
Dave