DCF77


Introduction

The starting idea about locking a system clock for a PC under Linux to an atomic clock came from reading the article written by Thomas Brandl et Michael Bosch. They use a low cost DCF77 receiver module at 10 €. This module is available at Conrad under reference 641138. An other advantage is the possibility to use a game port input (and a serial port input as well) for receiving timing signals. This allow to spare a serial port which is often more useful and furthermore it provides the 5V power supply. Low cost and stand-alone capability of this system make it ideal candidate for servers which are remotely set in «nature», far away from their favorite administrator and Internet network.

Michael Bosch wrote a software for decoding data from DCF77 module which then has been reviewed by Frank Daamgard. When I wanted to try this software, I saw that operating, although satisfactory, was not perfect. Actually, It was not doing correctly functions provided for time locking. It locked when time drift went beyond 100 ms then left slowly drift system time without locking and locked again when beyond the 100 ms limit. This «saw tooth» working like resulted from missing parameters into adjtimex function. I corrected this behavior and now the system give me good satisfaction with an error not going beyond a few milliseconds in worst case, that is for heavy CPU load variations like running into background software like SETI@home.

Assembly

Conrad DCF77 module looks like a a few cm2 printed circuit which is connected a ferrite rod with a coil as antenna. For a good signals reception, it is important to have rod set horizontally and perpendicularly to the transmitter direction which is located in Germany near Frankfort.

DCF77 interface

For connecting to the game port, I added a small assembly which allow to see clock pulses of transmitter (See beside picture). This allow to know if receiver is well locked onto signals by seeing blinking LED every second. One can notice that blinking duration is 100 ms or 200 ms which depend on 0 or 1 value transmitted into timing message which is one minute long. Missing blinking at 59th second allow synchronization of message.



Software

For installation without any fuss, I packed all the software into a RPM format which is commonly used into distributions like Mandrake or RedHat. Slackware users are not excluded with a TAR format package but shall manually include the command line into their rc.local file. The package size is very small and may easily be broadcasted with packet radio network.

Description Package Size
i386 compliant RPM binary dcf77-2.0-1.i386.rpm 9.5 Kb
RPM sources dcf77-2.0-1.src.rpm 8.4 Kb
TAR sources dcf77-2.0-src.tar.gz 5.4 Kb

RPM Binary package is very easily installed from root account. Service start and stop are automatically done at server reboot and shutdown. It can be done as well with the command line :

/etc/rc.d/init.d/dcf77 {start|stop|restart}

Performances

The /var/log/dcf77.time log file allow statistical analysis of system. A simple spreadsheet software is able to graphically display figures which results appear into below pictures. Recording was made during a server reboot which explain the sharp peak followed by resynchronization. The «saw tooth» looking of time difference graphic is due to 10 ms sample time of game port. Offset graphic represent the clock drift value balancing those of system time according to a formula one can find into adjtimex(2) man. Graphics agree with a PLL time constant of 6 which allow a good filtering of the 10 ms sample time effect.

DCF77 differences DCF77 offset

Some browsers are wrongly displaying these graphics like Netscape but Internet Explorer and Mozilla are doing well.

Conclusion

For 10 €, here is a way to have a remote Linux PC always in time !