DCF77 Simulator

In the spring 2010 Hans Sundgren 53 years, designed and built a DCF77 simulator/demonstrator as part of a PIC programming course at the Royal Institute of Technology (KTH) in Stockholm.

The project was presented May 5th in KTH Campus, Kista.

The course title in English and Swedish.


Hans wanted to learn how to program microprocessors. Therefore he took a 7,5 hp PIC programming course at the Royal Institute of Technology (KTH) in Stockholm. [ IL131V Tillämpad digitalteknik med PIC-processor ] sch Application

His plan was to build a DCF77 Simulator.

2010-01-09 Initial description

2010-02-07 Begäran om programmeringsuppgift

Hans orders 2 books from Bokus to help him in the study: "Programming 8-Bit Pic Microcontrollers in C" and "123 PIC Microcontroller Experiments for the Evil Genius".
The main idea.

Requirement specification

DCF77 is the German long-wave transmitter that provides correct time to radio-controlled clocks in the northern part of Europe. The transmitter sends time data on 77.5 kHz according to a public protocol. The DCF77 simulator should be able to create a puls signal identical to DCF77 but with selectable time, date and other parametrers. In other words, be able to create a false time.

The simulator should have a display that shows the data of the transmission in various views to demonstrate the DCF77 protocol.

By connecting the simulator to a radio-controlled clock, the function can be verified.

The acronym DCF77 stands for:
D=Deutschland (Germany)
C=Long wave signal
77=Frequency: 77.5 kHz.

The DCF77 public protocol (in Swedish).

Exempelvärden för 2017-12-24, 21:05, DST=0, söndag

Bit Symbol Exempel Beskrivning
0 M 0 Start av minut, alltid 0
1‑14 väder 0110... Väder-information från Meteo, mm
15 R 0 Indikering av onormal sändning, normalt 0
16 A1 0 Annonsering av sommartid (DST), sätts till "1" timmen före ändring.
17‑18 Z1, Z2 0
01 = normaltid
10 = sommartid
19 A2 0 Annonsering av skottsekund, sätts till "1" timmen före ändring
20 S 1 Indikering av start på tidinformation, alltid"1".
21‑27 minuter 1
Minuter 00-59 som BCD, 7 bitar, lsb först
[ 1-2-4-8 | 10-20-40-xx ]
28 P1 0 Paritetsbit, jämn paritet över bit 21-28
29‑34 timmar 1
Timmar 00-23 som BCD, 6 bitar, lsb först
[ 1-2-4-8 | 10-20-xx-xx ]
35 P2 1 Paritetsbit, jämn paritet över bit 29-35
36‑41 dag 0
Dag 01-31 som BCD, 6 bitar, lsb först
[ 1-2-4-8 | 10-20-xx-xx ]
42‑44 veckodag 1
Veckodag som BCD, 3 bitar, lsb först
[ 1-2-4-x ] 1 = måndag
45‑49 månad 0
Månad 01-12 som BCD, 5 bitar, lsb först
[ 1-2-4-8 | 10-xx-xx-xx ]
50‑57 år 1
År 00-99 som BCD, 8 bitar, lsb först
[ 1-2-4-8 | 10-20-40-80 ]
Århundradet "20" är undersförstått.
58 P3 1 Paritetsbit, jämn paritet över bit 36-58
59 - - Markering av ny minut, ingen puls
The finished simulator in operation, transmitting bit 57 = "0".

A simulator and demonstrator

The DCF77 Simulator is a combined simulator and demonstrator. It generates DCF77 time code at the same time as it displays the code in different views. The time code to be generated can be set to any time between 2000-01-01 and 2099-12-31.

The simulator can control DCF clocks via two interfaces:

  • Electrical
  • Radio-signal via a built in low-power transmitter
Overview of the mechanical design.
Web app.

Demonstrator web app

Hans makes a web app in Javascript that shows the coding.

It is not finished.

The controls on the front panel. One rocker switch, 4 pushbuttons, 2 rotary knobs and 2 indicators.

The controls

Start/Stop: Starts and stops the time signal according to the DCF77 protocol and the set time.

Transmit: Switches the transmitter on/off. Can only be activated when signal generation is in progress.

View: Switches between 4 different viewing modes:
a) Shows the set time and transmitted bit value, without LCD background light
b) Shows the set time and transmitted bit value, with LCD background light
c) Shows an overview of all 60 bit values for a complete minute interval, where the current bit is underlined
d) Shows a dynamic explanation of the bit information currently sent.

Set time and -/+ dial: Activates setting mode where the time can be set using the -/+ dial. The time parameters are sequentially stepped through: Hour, Minute, Second, DST, Year, Month, Day, Weekday. The set time is finally stored in EEPROM.

Sound: Activates a audio indication to complement the text display. The dial is a normal volume control. In addition, it controls the sound types. By quickly turning the knob up+down, 5 different sound types are stepped through:
a) No sound, amplifier off. b) Click sound. c) Tone sound. d) Tone sound inverted, high frequency. e) Tone sound inverted, low frequency.

The sockets for antenna + ground, pulse output and power supply.

The external connections

77.5 kHz: Connection to external antenna, if required.

Pulse: Pulse interface for electrical connection to a DCF clock. The signal simulates the output from a DCF77 receiver.

9-12 V: External power supply, if required.

Block diagram of the DCF simulator.

Block diagram

The simulator is built around a PIC-processor for the DCF77 simulation and control. In addition the following modules are included:

  • Radio interface with a low power test transmitter 77.5 kHz
  • 4×20 characters LCD display
  • Two support processors for sound selection and sound generation
  • Audio amplifier with digital potentiometer

Block diagram

Data sheet PIC16F628

Data sheet PIC16F690

Data sheet PIC16F886

Part of the program code for PIC16F886.

Program code

The code is written in the programming language C, for the B Knudsen Cc5x C-compiler - not ANSI-C.

Source code Hex file
html DCF Simulator, PIC16F886 code dcf_sim_886_0503.hex
html Sound selection, PIC16F690 code dcf_sound_selection_0502.hex
html Tone generator, PIC16F628 code tone_generator_0502.hex
Header files
code INT16CXX.H  
code 16F628.H  
code 16F886.H  
code 16F690.H  
The first prototype with PIC16F628.

The 1:st prototype

The DCF77 simulator was first designed with PIC16F628, a two-row LCD display and an electrical interface to the clocks.

code 2010-02-07_prototype_pic16f628.c

Hans writes a specification in Swedish:

Microprocessor PIC16F628 med följande interface:
   Utgångar:   1 för puls, att koppla till extern
                 radiostyrd klocka.
               1 för eventuell högtalare/buzzer.
               1 för eventuell LED-indikering.
               6 för LCD display 4×20 tecken, ASCII.
   Ingångar:   4 för tryckknappar.
   Oscillator: 2 för kristall 32,768 kHz med tillhörande 
                 kondensatorer för en stabil 1 Hz signal.
                    ________  ________
                   |        \/        |
          LCD.D6 <-|RA2   16F628   RA1|-> LCD.D5
          LCD.D7 <-|RA3            RA0|-> LCD.D4
         Btn SET <-|RA4-od    RA7/OSC1|-> Btn INC
     Loudspeaker <-|RA5/MCLR  RA6/OSC2|-> Btn MODE
             GND --|Vss            Vdd|-- +5V
       Pulse out <-|RB0/INT  (RB7)/PGD|-- XTAL
             LED <-|RB1/Rx   (RB6)/PGC|-- XTAL
       Btn START <-|RB2/Tx         RB5|-> LCD.RS
          LCD.EN <-|RB3/CCP  (RB4)/PGM|-- 1k- Gnd

Programmet ska skrivas i C och kompileras med
B. Knudsens C-kompilator Cc5x.
Test of the prototype simulator connected to a DCF alarm clock.
The 2:nd prototype with PIC16F690.

The 2:nd prototype

After upgrading to PIC16F690 a rotary encoder could be used for setting time. In addition, a 4-row LCD display with several "views" could be utilized thanks to the larger program memory.

The 3:rd prototype with PIC16F886.

The 3:rd prototype

The final simulator design added sound to emphasize the "display" of the time signal. A rotary encoder is used for both volume control and for selecting sound type.

This final version uses PIC16F886 as the main processor with the two previously used processors as support processors taking care of the sound selection and generation.

Part of the circuit diagram.

Circuit diagram

Besides the 3 PIC controllers the circuit also uses an amplifier, a digital potentiometer and a MOS-FET relay.

Circuit diagram

Eagle schematics file:

sch dcf77_simulator_circuit.sch

The finished circuit board with all components fitted.

Circuit board

The simulator is built on a strip-board, also known as Veroboard. The board also holds the loudspeaker.

Besides pin connectors to the front panel controls, battery and antenna there are also 3 pin connectors for in-circuit programming (ICSP™) of the three PIC controllers on the board. The PICkit™; 2 programmer can be plugged in directly onto the connectors.

Top and bottom view of the circuit board.
Front panel detail.

Front panel

The front panel was drawn in Front Panel Designer and sent to Schaeffer AG for milling and engraving. About Front Panel Designer

Front Panel Designer file: fpd dcf77_simulator_frontpanel.fpd

Definition of screw holes in the application Front Panel Designer.
The ferrite antenna with supporting components.

Transmitter antenna

The low-power transmitter is connected to a ferrite antenna with capacitors.

Antenna position on the battery compartment, at the rear.
The back side of front panel.

Mechanical design

The front panel is the base for the unit. The LCD display is base for the circuit board.

Back side of front panel, without wiring.
Mechanical design, top view.
Hans Sundgren, in his kitchen, soldering the last parts of the DCF77 Simulator.

The construction work

The project was completely designed and built in the kitchen using a soldering iron from Biltema.

To verify the function several different radio-controlled clocks were used, some of them digital and some of them analog.

Test bench on the electrical stove in the kitchen.
Hans' father Sture preparing the antenna.

Assistance from father

Sture Sundgren (88) had a suitable ferrite antenna and helped Hans tuning the antenna to the frequency 77.5 kHz. Only a low-power transmitter was used in the project. The cover range is only some meter.

Sture's oscilloscope [Trio CS-1559A) showing the 77.5 kHz signal.
The microprocessor PIC16F886.

The PIC processor

To be able to control all push-buttons and rotary encoders and to display the DCF protocol in different views, the PIC16F886 was required. The processor was purchased from Kjell & Company in Västerås during a lunch break for SEK 49. This little chip includes:

  • 8 kBytes program memory for code
  • 368 Bytes RAM memory for storing variables
  • 256 Bytes EEPROM for storing data
  • Internal clock oscillator 8 MHz
  • 24 Input/outputs
Rough first sketch of the circuit board layout.

Design sketches

Even though the computer was used for most of the development some design was made by pencil and paper, for example the strip-board layout.

First sketch of the front panel.
The finished simulator.

The simulator finished

As part of the course IL131V Basic Digital Theory with PIC-processor, a report had to presented.

Hans wrote it in Swedish.

The report: "DCF77-simulator - med display och ljud".

Rapport: DCF77-simulator - med display och ljud

Part of test report.

Synchronisation test

Hans test the simulator with 2 radio-controlled clocks, one large analog wall clock and one small digital alarm clock.

The tests are made at distances from 0.6 to 2.5 meter.

2011-04-11 Synchronisation test report [Swedish]

html5 video support by EasyHtml5Video.com v3.9.1
Test of simulator radio signals.

Test with radio receiver

Hans visits a radio amateur; Ragge Jagero in Sala, and listens to the signal transmitted by the simulator.

Page 18 in the 30-page presentation.

Lecture for radio amateurs

Hans makes a presentation of the project at a monthly meeting in Västerås Radioklubb.

2011-05-12 Presentation slides [Swedish]

The DCF simulator, designed by Nick Raptis.

Other designs: Greece

Greece flag 2012 January: Based on the information on this web page other people have succeeded building the simulator, with smaller or larger personal adjustments. One of them is Nick Raptis from Greece. Extracts from Nicks report 2012-01-24 published with his permission:

… I'm an electronics engineer living in Athens, Greece and the reception of DCF-77 signal is rather pure as I suppose is, also, the case in certain parts of Sweden. Especially in my lab, I had no success to receive it and even less luck to test or troubleshoot any circuits designed to use this signal.

I found your site almost after you published this circuit, during summer 2010, and started gathering all necessary components. Unfortunately, I got lazy during the process and left this project behind although not forgetting about it. During last Christmas holiday period I pulled myself together and started building it. I used almost the same method as you did, by point-to-point wiring. The first tests with the main signal generating microprocessor were successfull and I continued to the end. Although, I didn't follow your method of the very professional front panel construction, my approach was quite good looking and generally acceptable. Even more, I have enriched my electronics lab with a trustful DCF-77 signal generator ready for any upcoming project.

Just for your knowledge, as I could not find anywhere the 77,5 kHz crystal and the antenna required (my father could not help me as yours did!!), I ripped these components from a Conrad DCF-77 receiver module. …

The DCF simulator, designed by Pasan.

Other designs: Sri Lanka

Sri Lanka flag 2013 August: Pasan built the simulator on experimental board and had plans to do an SMD variant.

Screenshot from Programmer's File Editor.

Programs used

Hans used several programs to develop and program the simulator.

Programmer's File Editor 1.01

The program code was written with PFE. The text editor requires no installation, as it is run as an exe-file.

PFE icon".

Compiler CC5X 3.4

The C-code was compiled with CC5X C Compiler for the PICmicro Devices (B Knudsen).

Compile command from CC5X.
CC5X icon.

Eagle 5.7.0 Light

The circuit diagram was drawn in Eagle. The program is an easy to use drawing tool with the possibility to define your own components.

Eagle screen dump, with the circuit diagram.
Eagle icon.

Front Panel Designer 4.0

The front panel was designed with the Front Panel Designer. It is possible to make cut-outs in different shapes and specify engraving with different styles and sizes. A menu command Pricing presents a detailed price specification. When the design is ready, the order is sent to Schaeffer AG in Germany by some clicks. After some weeks the front panel is delivered, exactly as drawn.

Hans writes an article about how to create nice front panels (in Swedish): Byggtips: Snygga frontpaneler

Front Panel Designer screen dump.
Front Panel Designer icon.
Price calculation.
Order status.
Sending the front panel order.

PICkit 2 Programmer


PICkit 2 screen dump.
PICkit 2 icon.
Svar på inlämningsuppgift 2.


Förutom laborationsövningen så ingår inlämningsuppgifter. Dessa kan man lösa hemma och svara via webbformlär.



Hans Sundgren, om inte annat anges.


Canon Ixus 950IS