A digital clock which receives and displays the time from the MSF radio transmission
, broadcast from Anthorn, Cumbria (54°55'N, 3°17'W).
The clock is based around a the PIC16F877 microcontroller from Microchip
, which performs all of the logic necessary to decode the MSF signal and show the time on twelve 7-segment displays. The circuit consists of four main parts:
1. Power supply:
The circuit is powered by a simple 5V supply using the 7805 regulator IC. The supply uses a 240V 60Hz to 9V 3VA transformer, four 4N1001 diodes in a bridge rectifier layout, a 2200uF smoothing capacitor, and the 7805. The transformer and capacitor are probably rather larger than necessary for this project, since the circuit shouldn't draw more than about 100mA. Update: I've since switched to using an unregulated external AC adaptor to power the 7805.
Since the PIC doesn't have enough pins to run each of the 96 segments of the display directly, the display is multiplexed. Only one digit is displayed at a time, but the digits are cycled through quickly enough to give the impression of a continuous display. Each digit has a common cathode, and each segment of all the digits a common anode. The eight anodes (one for each of 7 segments, plus the decimal point) are connected via current-limiting resistors to output pins on the PIC. The 12 cathodes are connected to ground through 2N3904 NPN transistors controlled by further output pins, since the PIC cannot sink enough current to connect the cathodes directly.
Multiplexing with PICs is described by Microchip's Application Note AN557, which uses a 50Hz refresh rate for the multiplexed displays. I found this rather flickery, so used an on-time of 1ms for each digit, which corresponds to a refresh rate of about 80Hz.
3. Radio receiver:
The radio receiver and aerial are both commercial units from Galleon
designed for receiving the 60Khz MSF signal. The aerial is paired with a capacitor to form a simple LC resonator, the output of which is sent to a receiver module which tunes the circuit further and has a 5V logic level output for the MSF data stream, which is connected (with a pull-up resistor) directly to an analogue input on the PIC. I've found the radio module to be quite sensitive to the position of the antenna and to sources of interference; rather than being the sole source of a time signal, as it is in this design, the module seems better suited to occasionally calibrating an internal real-time clock.
The PIC program source code here
, is released under the GNU General Public License
; I used the toolchain of MPASM compiler
and JDM programmer
. The program is interrupt-driven, with the interrupts being called at 1ms intervals by an internal timer. The primary function of this interrupt is to execute the display multiplexing code, which illuminates the next digit with the appropriate value. Every 10ms, the A/D converter is initialised and a value requested for the radio receiver output. 5ms later, the A/D conversion has finished and the main part of the code, the decoding of the MSF signal, is executed.
The MSF signal is a serial data stream transmitting two bits per second. The signal is always on for the first 100ms of every second. From 200ms to 300ms, and 300ms to 400ms, there are two data bits, which transmit the date, hour, minute and various other data about the upcoming minute. On the first second of each minute, the signal is held on for 600ms. For the first 600ms of each second, the PIC program reads the MSF signal and stores values of the two data bits. At 750ms, the program then interprets this data, transfers it to memory and waits for the next second to begin. When a 600ms pulse is detected, the data in memory stored over the previous minute is sent to the display to update the minute, hour and date digits as appropriate.
There are several modes in which the time and date can be displayed, including an ISO 8601
-inspired YY:MM:DD:HH:MM:SS, and a HH:MM:SS:hh mode (precise to 1/100th of a second).
Update: Reader Colin Manklow has put together a very nice radio clock based on the schematics and PIC firmware on this page:
Update (March 2015):
Reader Mark has retrofitted a radio clock
that he made in the 1980s with the PIC design on this page. At his suggestion support has been added to the source code
for LEDs to indicate the day of the week and whether the clock is showing British Summer Time.