The module DCF77 design for microcontrollers to receive the signal from the transmitter and pass the data to a microcontroller, in that case, an Arduino and we display it in the serial port debugger.
I have tested it in my room away from the window it has taken about 20 minutes and if you restart the Arduino or shutdown it then you lose the synchronization and wait also about the same time to get the time.
So the seller gives me an example and instructions to operate it I have test it and work fine without any problem for that I want to thank him " the web link is below if you want to buy it".
BUY DCF77
How to connect it
- pin1 vcc to 5v
- pin2 GND to graund
- pin3 to 10k ohm pull up resestor and pin 2 arduino
Arduino code
#include "DCF77.h"
#include <Time.h>
#include <TimeLib.h>
#define DCF_PIN 2 // Connection pin to DCF 77 device
#define DCF_INTERRUPT 0 // Interrupt number associated with pin
time_t time;
// Non-inverted input on pin DCF_PIN
DCF77 DCF = DCF77(DCF_PIN,DCF_INTERRUPT, true);
void setup() {
Serial.begin(9600);
DCF.Start();
Serial.println("Waiting for DCF77 time ... ");
Serial.println("It will take at least 15 minutes before a first time update.");
}
void loop() {
delay(1000);
time_t DCFtime = DCF.getTime(); // Check if new DCF77 time is available
if (DCFtime!=0)
{
Serial.println("Time is updated");
setTime(DCFtime);
}
digitalClockDisplay();
}
void digitalClockDisplay(){
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}
void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
How to connect it
- pin1 vcc to 5v
- pin2 GND to graund
- pin3 to 10k ohm pull up resestor and pin 2 arduino
Arduino code
#include "DCF77.h" #include <Time.h> #include <TimeLib.h> #define DCF_PIN 2 // Connection pin to DCF 77 device #define DCF_INTERRUPT 0 // Interrupt number associated with pin time_t time; // Non-inverted input on pin DCF_PIN DCF77 DCF = DCF77(DCF_PIN,DCF_INTERRUPT, true); void setup() { Serial.begin(9600); DCF.Start(); Serial.println("Waiting for DCF77 time ... "); Serial.println("It will take at least 15 minutes before a first time update."); } void loop() { delay(1000); time_t DCFtime = DCF.getTime(); // Check if new DCF77 time is available if (DCFtime!=0) { Serial.println("Time is updated"); setTime(DCFtime); } digitalClockDisplay(); } void digitalClockDisplay(){ // digital clock display of the time Serial.print(hour()); printDigits(minute()); printDigits(second()); Serial.print(" "); Serial.print(day()); Serial.print(" "); Serial.print(month()); Serial.print(" "); Serial.print(year()); Serial.println(); } void printDigits(int digits){ // utility function for digital clock display: prints preceding colon and leading 0 Serial.print(":"); if(digits < 10) Serial.print('0'); Serial.print(digits); }