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. I used 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 everything in the circuit is fairly low-power.
2. Display:
Since the PIC doesn't have enough pins to run each segment of the display (all 96 of them) 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. I gave each digit 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 standard NPN transistors (I used 2N3904) 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 80Hz, which corresponds to an on-time of just over 1ms for each digit.
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.
4. PIC:
The PIC program consists of about 1,500 lines of assembler, most of which is concerned with decoding the MSF signal reliably. I used Microchip's
MPASM compiler, with
ICProg and a
JDM programmer to burn the code onto the chip.
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 pieces of information 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.

The clock also has an alarm (a 6V buzzer driven from a PIC output through a BC108 transistor) and a quieter piezo-electric sounder to mark button-presses. The programming of the alarm is controlled by four push buttons, which interface directly with the PIC.
10 Comments: