< -- Back to the Word clock project
This page describes the problems I ran into when programming the DCF with an ATMEGA
328 and a ATTINY85 processor. The DCF77 library from Thijs Elenbaas can be used to get time from a DCF receiver using
the ATMEGA interrupt OnRisingFlank. |
The DCF-module is from ELV elektronik AG. The DCF-2.
The DCF77 library is part of the Arduino software IDE and with the examples it is easy to start.
|
|
This DCF-2 module gives a reversed signal what results is that 0 bits becomes a 1 and 1 bits zero in the software. The blue line is what is measured direct from the DCF77 module (no signal at 5V and a pulse at 0V) and the yellow line what it should be (0V signal with a pulse of 5V). |
|
To get this inversed (yellow) signal a inverter was made with a PNP-transistor BC327. The 4.7K resistor is for pulling down the signal. The 2.2K resistor is for safety. With out the resistor the circuit also operates. The 100 nF ceramic capacitor is added for a smoother signal. A BC556 transistor also works well. But as I found out later the software has an option to use inverted signals. The library initialization contains a third
parameter; OnRisingFlank. |
|
Below are the functions the library gives you to use:
//Initialize library |
Nice links with info about DCF receivers: Online signal from Mainflingen on website Explains the bits in the received string Arduino projects 4you HKW-Elektronik GmbH Sells all kinds of receivers Rheinturmfunkuhr mit Arduino Arduino DCF77 radio clock receiver ,Matthias Dalheimer Github Thijs Elenbaas Conrad receiver |
To use the ATTINY85 program
must be uploaded with a Clock speed of16MHz processor. Because the ATTINY85 does not have a serial.print I used the heartbeat subroutine to indicated that a time has been received.
|
|
// Version 04. Ed Nieuwenhuys 7 may 2017 // ATtiny45 / ATtiny85 // // |----U----| // Pin 5 Reset | 1 o 8 | VCC // (Analog input 3) Pin 3 | 2 7 | Pin 2 (Analog Input 1, SCK) // (Analog input 2) Pin 4 | 3 6 | Pin 1 (PWM, MISO) // -GND | 4 5 | Pin 0 (PWM, AREF, MOSI) // |---------| // #include "DCF77.h" #include "TimeLib.h" enum PinAssignments { PIN01 = 0, DCF_LEDP1 = 1, DCF LedPin PIN02 = 2, DCF_PIN = 3, // DCF Pulse on interrupt pin PIN04 = 4, PIN05 = 5, }; static unsigned long msTick; // the number of millisecond ticks since we last incremented the second counter //-------------------------------------------- // Heartbeat //--------------------------------------------
void setup() void loop() void heartbeat()
|
|
Ed Nieuwenhuys, |
|
< -- Back to the Word clock project | |