An MSF synchronised LCD clock with RTC backup by Peter Balcombe

The Arduino UNO sketch for this project can be downloaded here

Having seen Phil's tutorial on the MSF time signals and making a simple clock synchronised to the atomic clock time signals, I noted that the MSF signals are not guaranteed to be available 24/7 and thus any processor based timing mechanism would not keep good time if left unsynchronised for even a relatively short period of time.

I therefore decided to improve the tutorial design by using a battery backed-up RTC to keep the background time, synchronising this to the atomic clock whenever MSF signals were available. I also wanted to produce a time and date output on a LCD display rather than the simple serial monitor output as in Phil's tutorial. Finally, I wanted the clock to be a standalone device, thus the processor would be changed from an Arduino module to a DIY construction using the same ATmega328P processor as used in the Arduino Uno.


  1. MSF 60kHz Time Receiver module & aerial (SYM-RFT-60) available from PV Electronics

  2. DS1307 RTC module available on eBay

  3. Generic 16x2 parallel interface LCD module

  4. ATmega328P processor DIL integrated circuit

  5. 5v & 3.3v three terminal regulators

  6. Miscellaneous other passive components and strip board (see circuit schematic)

  7. An ABS box or similar


The circuit is fairly simple, with most wiring being concerned with either the power supply aspects or the LCD connections to the processor. The RTC only needs 5v power and the two I2C (SDA & SDC) connections. The schematic above shows just three connections to the receiver as PON is connected to GND local to the receiver. The LCD is connected for a 4 wire data operation and the Read/Write pin is connected to 0V as the Write mode is not used in this application.

The MSF receiver aerial is pre-wound and connects to the receiver via a pair of fine enamelled copper wires. These wires need to be handled carefully to avoid breakage and the wire ends should have the enamel carefully scraped off to allow them to be soldered to the two marked pads (A1 & A2) on the receiver module. Note that there is no polarity here, so either wire can be attached to either pad as long as you end up with one wire attached to each pad.

The main MSF receiver connections are via a row of 5 pads. The Vdd connection is to +3.3V, the TCON pad is the MSF data output, the GND pad connects to 0V and the PON pad should also be connected to 0V for normal operation. The sixth pad is not connected to anything.

I fitted my receiver module with a pin header so that it could be plugged into a small piece of strip board which then allowed me to fit a power supply decoupling capacitor close to the receiver connections and also to attach a 3 core flying lead to enable the receiver to be easily disconnected from the processor. Note that the receiver is powered from a 3.3v supply rather than 5v. During testing, this can be supplied from the Arduino 3.3v pin, but otherwise a 3.3v LDO regulator should be used between the receiver and a suitable DC supply. Although the receiver specification sheet appears to indicate that it could be powered from a 5V supply (absolute maximum limit is stated as 5.5V), it seems that it is safer to use a 3.3V supply.

My DS1307 RTC module had rows of connections on opposite edges of the board, but as the power and I2C communication pads were duplicated on each side, I fitted an angled pin header on the 5 pin row to enable easy module connection.

The LCD modules usually have a row of 14 or 16 connection pads (depending on whether a backlight connection is provided on pins 15 & 16 or not). I fitted a straight pin header to the connection pads so that I could plug the LCD module into a vertical socket on the processor board (see the Fritzing diagram of my circuit and photos of my build arrangements).

I made a processor board from a piece of strip board which housed the ATmega328P in a 28 pin DIL socket, the two regulators, power decoupling capacitors, LCD contrast potentiometer and connectors for the LCD, RTC module and MSF receiver. Some connections were made via strip board track, but others needed discrete wiring.

The MSF receiver needs to be aligned in use with its long axis at 90degrees to the direction of the Anthorn transmitter to give best signal reception. The receiver is also sensitive to interference from other components, particularly the RTC and processor. I started off putting everything in a small box, but then experienced interference problems which were resolved by adding a 100uF capacitor across the receiver supply terminals and also physically separating the receiver/aerial from the other components by approximately 4 inches or more. Therefore, I would advise fitting the antenna/receiver either in a separate case (via a 3 way lead) or approximately 4" or more away from the processor, LCD and RTC modules if fitted in the same case.

My plan is to finally fit my components into a 220 x 110 x 45mm ABS case, with the MSF aerial and receiver at the bottom and the other components near the top, the LCD module display bezel will be a good fit into a suitable aperture in the case front as for my initial build.


The MSF RTC clock sketch is compatible with Arduino IDE version 1.0.5 and uses the MSFTime library developed by Phil. This library therefore needs to be downloaded and installed in your Arduino working library in addition to the Streaming library if not already present in your sketchbook libraries folder.

My sketch assumes the use of a generic parallel interface LCD module, so also uses the standard Liquid Crystal library, plus the Wire library for I2C communication. Note that it would be a fairly simple change to use an I2C interface LCD module as an alternative display.

The sketch is basically the same as in Phil's MSFTime clock tutorial with the added ability to display time & date on the LCD plus the setting/reading of time from the RTC instead of the system time function.

I found that it was better to include the necessary basic RTC I2C functions in the sketch than calling a RTC library. MSFTime is configured to produce BCD format time/date information as used by the RTC to avoid the need to convert the data format when setting RTC time.

The RTC read function converts the time/date data to decimal for display purposes.

The LCD display will display time on the 1st line, with date on the 2nd line. If the RTC has not been previously started then it will be set to 00:00:00 on 1st January 2000, otherwise the current RTC time (24 hour format) & date will be displayed and the time will update as the RTC clock time changes. The 1st line will also display "UTC" for UTC time until a valid MSF time has been received and verified, at which time the RTC clock will be synchronised to MSF time and the "UTC" replaced with "BST" if appropriate.  Thereafter the clock will be re-synchronised with MSF time each minute whenever valid MSF signals are available and "MSF" will appear at the end of the 1st line for one second at the start of each minute.  If no valid MSF time updates are available for any reason (during poor signal reception or MSF transmitter downtime) the clock will continue to update based upon RTC time only.

Note that the RTC clock modules usually have a built in backup battery which will continue to power the RTC clock itself even if the main unit power supply fails. When power is restored, the time & date information will be taken from the RTC whilst awaiting MSF signal detection to re-synchronise as normal.

The streaming library is used to simplify writing to the Serial output and LCD display using concactenated strings rather than lots of sequential print statements.

Producing a standalone processor:

Although the Arduino Uno can be used during project development and testing, the user may well wish to migrate to a standalone processor for the final hardware solution, thus freeing up the Uno board for development of other projects. This migration is fairly easy using the ATmega328P processor used in the Uno. These 28 pin Dual In Line (DIL) integrated circuits are available from suppliers such as Rapid Electronics for around 3 and are easy to use to make a single chip computer, especially if you configure it to run using its on-board 8 MHz clock generator. We can even use the Arduino to programme the ATmega328P.

Before we can programme an ATmega328P we need to add some details to a file called "boards.txt" which will be in the hardware/arduino folder within the Arduino installation folder on your computer. This file provides the configuration details for each entry in the Board menu of the IDE and hence the micro controllers we can compile code for.

Once you have found the file, open it and add the following text to it:

NB: Do not try to change the bootloader lines unless you know what you are doing - otherwise you are likely to end up with a dead integrated circuit!!

Once the above configuration details have been added to the boards.txt file, save it and then start up the IDE. If you now look in the boards listed in the Tools/Boards menu, you should see the new "ATmega328P (8 MHz internal clock) configuration just added.

Now that we have the right configuration details for the required processor set-up, we can upload the Arduino ISP sketch from the IDE examples list in the same way as for any other sketch.

*** The next step is to connect the Arduino Uno to the ATmega328P DIL package as shown in the Fritzing diagram below. This ensures that the ATmega328P is powered (noting that there are 4 power pins, two VCC and two GND) and is ready for programming. Now use the Board menu in the IDE to select the "ATmega328P (8MHz internal clock)" entry. Also ensure that "Arduino as ISP" is selected in the Programmer menu.

Before we can upload a sketch to the ATmega328P for the first time, we have to configure it properly by setting the internal fuses. We do this by choosing the "Burn Bootloader" option from the Tools menu. This will take a few seconds to complete and should result in a "Done burning Bootloader" message. Note that this message is slightly misleading as we haven't actually burnt a bootloader, only configured the internal fuses.

Once the ATmega328P has been configured, we can load a sketch into it. Open your sketch in the normal way, but instead of pressing the upload button on the toolbar, choose the "Upload Using Programmer" option from the file menu. Hopefully, after a few seconds you will see the standard "Done Uploading" success message.

You now have a programmed ATmega328P which you can use in your project instead of an Arduino Uno.  The figure below shows how the Arduino Uno board pins map to the ATmega328P pins.

*** Alternatively, you could use an ISP Programmer such as this one from