Maker Jon Mackey, sick of poor coverage and thus inaccurate "atomic" wall clocks, has penned a guide to turning an STMicroelectronics STM32 microcontroller into a homebrew time signal radio station designed to fill gaps in NIST's WWVB coverage — with accurate timing provided by a GPS module.
"I live in northern New Hampshire, and according to the NIST coverage map, I should be able to reliably receive the WWVB signal at night," Mackey explains, referring to a radio station which transmits atomic-clock-derived time signals to suitable receiving devices including wall clocks and wristwatches. "I own several WWVB 'Atomic' clocks. Generally these clocks work quite well, but for more than two weeks in December 2023 my clocks were not updating."
Having found existing projects which create a WWVB-compatible time signal with a Microchip ATtiny microcontroller, Mackey set about designing his own using an STMicro STM32 — specifically the WeAct Studio STM32F103CBT6 BluePill+ module. For the time source itself, Mackey turned to a u-blox NEO-6M GPS receiver, the time information from which is broadcast from the microcontroller to nearby compatible radio receivers.
"On startup, and on the half hour, the WWVB simulator's time is updated from the serial stream coming from the GPS module," Mackey explains of the simulator's operation. "One of the STM32's timers outputs a ~60kHz 50% duty cycle PWM [Pulse Width Modulation] signal that serves as the AM [Amplitude Modulation] carrier, the signal that drives the antenna. The antenna radiates, at most, about 10cm [around 4 inches]. It's incredibly weak, but that's OK.
"On every even minute, a new 60 byte structure is initialized that represents the current time as defined by the NIST. Each byte in this structure represents one bit of transmitted data. The bit can be a 0, 1, or a marker. It takes one second to transmit one bit. The length of time that the AM carrier is present determines whether the bit is a 0, 1, or a marker. Markers are used by the clock to know when a new 60 second block of data is starting and to validate the data received."
The full project write-up, including a parts list and source code, is available on Mackey's Instructables page.