Andrea Favero's On-demand Sync Clock Delivers One-Touch Timing Accuracy
Jumping onto open Wi-Fi networks at the push of a button, this clock aims for the ultimate accuracy with a clever calibration system.
Timekeeping enthusiast and maker Andrea Favero has released a guide to building a clock that can not only set its own time but perform on-demand calibration at the push of a button: the On-demand Sync Clock, or OSC.
"The distinctive feature of this clock is its effortless adjustment: simply press the push-button while an open network (Wi-Fi without password) is available, for instance, a smartphone hotspot," Favero explains of the project. "Timekeeping is handled by a[n Analog Devices] DS3231SN Real-Time Clock (RTC) module, which features a temperature-compensated crystal oscillator. According to the datasheet, its accuracy is within ±2 ppm (approximately ±1 minute per year)."
So far, so standard — even the use of an ultra-low-power ePaper display, which requires energy only when changing states, isn't exactly novel these days. As the creator of the Self-Learning Clock (SLC), though, you'd expect something special from Favero, and this project delivers in the form of a single-button synchronization and calibration procedure that piggybacks onto any open Wi-Fi network.
"When the button is pressed, the clock synchronizes with NTP [Network Time Protocol] servers," Favero explains. "If at least 14 days have passed since the previous sync, it also calculates the drift and automatically adjusts the DS3231SN's internal aging factor to improve long-term accuracy."
This calibration, based on work done for the earlier SLC, works by taking a millisecond-resolution timestamp each time the button is pressed. Time readings are captured from the DS3231SN itself and a remote NTP server, adjusting to account for both network latency and I2C read latency, and if more than 14 days have elapsed since the last calibration the difference in seconds between the RTC module and the NTP server is divided by the elapsed period and converted to parts-per-million drift — then used to adjust an "aging factor" applied to the RTC.
"Some advanced projects attempt an initial calibration, measuring drift over a period and applying a one-time correction to the aging register," Favero explains. "While a step forward, this approach has a critical flaw: it's not sustainable. Component characteristics change with age and temperature, meaning a calibration performed today may be ineffective in six months or a year. [The OSC] doesn't just calibrate once; each on-demand sync (if enough time has passed) recalculates the drift and updates the aging offset, automatically compensating for long-term component aging."
The project is detailed in full on Instructables, with full source code and 3D print files available on GitHub under the permissive MIT license.