Years ago, when accurate time sources were not easily available, I programmed a decoder for the time signal of the time signal transmitter DCF77. This transmitter is located near Frankfurt, Germany, and is also easily received in Switzerland. This program decoded on a Windows system the digital output signal of the receiver connected to the gameport. For the sheer joy of experimenting, I have now rewritten the program for the Arduino Uno.
The receiver module has 2 open collector outputs, one of which provides an inverted signal. For the gameport I had built a decoupling circuit with 2 transistors. One transistor drives an LED which flashes every second and the other one supplies the positive second pulses. I used the same circuit for operation with the Arduino, although an input with pullup could also be connected directly to the output of the receiver module.
The decoding of the DCF77 time signal has already been described by many other authors and information about it can be found on the Internet.
The program is operated via a CLI menu.
After a parity error the bit numbering and the scheme of the time telegram is displayed. Then the incoming bits are displayed and at the end of the full minute the time information in plain text.
If the [t] key is now pressed, the mode changes and the time information is displayed every 5 seconds. This interval can be changed with key [i].
Interested? Please download the entire program code. The zip-file contains the complete PlatformIO project.
My programming environment is not the native Arduino™ IDE but PlatformIO™ on top of Microsoft's Visual Studio Code™. This combination offers many advantages and allows a much better structuring of the code into several modules especially when we adopt The Object Oriented way.