Needing to drive two devices with a DCF 77 signal, I made an NTP client time server with two output channels.
Elektor published in its March-April 2018 issue an excellent article describing a module based on ESP8266 which inspired me. The modification I made consists in driving two optocouplers to galvanically isolate the two devices. Nothing but very classic. However, if the schematic is shown with an NPN transistor to drive the signal output optocoupler, the wiring allows it to be replaced with a PNP transistor to reverse the polarity of the output signal.
Everything worked without problem, except that the DCF77 signal generated by the module worked for 3 minutes then stopped for 1 to 2 minutes, the time to resynchronize on the time server. Since my devices can read the DCF77 signal at all times, this choppy operation did not seem desirable to me.
So I modified the structure of the software to run an endless loop of DCF77 signal generation, with time incrementing every minute. At a fixed timed interval, one hour in my case, the ESP8266 queries the time server and resynchronizes. Nothing very complicated, but the continuous operation of the generation of the DCF77 signal works wonderfully.
The modified software is available as an Arduino sketch. The “Time” directory must be copied to the Arduino libraries directory. Two things need to be set up to make the sketch work with your DCF77 clock :
1. the credentials for your Wi-Fi network ;
2. the URI of the time server used for synchronization.
The ESP-01 needs to connect to your Wi-Fi network to enable it to collect time information from an NTP server. To make this work the credentials for the Wi-Fi network must be entered at the top of the sketch :
char ssid[] = “your_network_name”; // your network SSID (name)
char pass[] = “network_password”; // your network password
The URI of the NTP time server must be defined too :
const char* ntpServerName = “ ntp.u-psud.fr”;
In this case a server of the frenchParis-sud university is specified, but you may prefer another one.
Furthermore, I preferred to build a small programmer adapted to the ESP-01 module. Its schematic is also given in PJ. In this schematic, switch S1 allows the choice between an external power supply for the module connected to K1 or via the USB interface connected to K3. Switch S2, when closed, allows the module to be put into programming mode. Finally, pusher S3 resets the module connected to K2.The K4 terminal block carries the power and programming signals for the external wiring of an ESP module.
For those who are not familiar with programming an ESP8266 under the Arduino IDE, the original article explains the process perfectly.
You will also find in the downloads the STL files of the different boxes adapted to these two creations.
Ref FR2018030221.pdf - Elektor mars-avril 2018
Discussion (1 comment)