The DCF77 library adds the ability to read and decode the atomic time broadcasted by the DCF77 radiostation. It has been designed to work in conjunction with the Arduino Time library and allows a sketch to get the precise CET time and date as a standard C time_t.
Using the Library
To use the library, first download the DCF77 library here at http://thijs.elenbaas.net/downloads
and install it in the Arduino Library folder. For a tutorial on how to install new libraries for use with the Arduino development environment please refer to the Arduino reference on Libraries or follow this step-by-step how-to article on installing Arduino libraries. If the library is installed at the correct location, you can find the examples discussed in this and the previous post under Examples > DCF77. I also added the time library to the archive for convenience.
The DCFF77 directory contains the DCFF77 library and some example sketches
This is the most basic example: it shows the raw signal coming from the DCF decoder. It will show Pulse-to-Pulse times of approximately 1000 ms and pulse widths of approx 100ms and 200ms.
This example illustrates the pulse-to-pulse time and pulse lengths coming from the DCF decoder. While the DCF specification says that pulses should be either 100 or 200 ms, you will probably see longer pulse lengths. For optimal distinction between long and short pulses use the output of this sketch to set the parameter #define DCFSplitTime in DCF77.h to (Tshort+Tlong)/2.
This example shows the binary stream generated by the pulse train coming from the DCF decoder and the resulting CET time.
This is the probably the most important example: It shows how to fetch a DCF77 time and synchronize the internal Arduino clock.
This sketch shows how to fetch a DCF77 time and synchronize the internal clock using the setSyncProvider function. Note that the loop code does not require any logic to maintain time sync. The Time library will monitor DC77 and sync the time as necessary.
This example shows how to convert the DCF77 time to a different timezone. It uses the UTC time to ensure that no ambiguities can exist. For timezone conversion it employs the TimeZone library.
The sketch below implements the most DCF77 basic functionality. It reads the signal from pin 2, and 2-3 minutes it will update the internal clock. More information on this example can be found here.