This project is intended to implement a slave clock impulse driver using ESP32 hardware with an OLED display. The time source is NTP, so no RTC module is needed. The code supports timezone and DST rules. The state of the slave clock is stored in the Non-Volatile memory to survive power loss or reboot. Board time as well as slave clock time is displayed on the OLED screen.
See my blog posts for the additional details.
- Arduino Timezone Library
- Arduino Time Library
- ThingPulse OLED SSD1306 Library
- Heltec ESP32+LoRa Series Quick Start
- Heltec ESP32 Lora w/OLED
- L298N motor driver module H-Bridge.
- 12V 1A power supply
- L298N driver is used to generate 24V impulses to drive the clock and to provide 5V power to the ESP board. This fork does not provide for inverted polarity on alternating pulses, as my IBM slave clock does not work that way.
- After startup ESP connects to WIFI and get time from NTP.
- If time is synced - ESP compares it with slave time in the Non-Volatile memory and updates the slave clock
- Slave status is stored in Non-Volatile memory every minute, using Preferences library on the NVS partition to optimize wear-out. Probably using the I2C FRAM module for that would be a better choice.
- Code respects configured timezone and automatically syncs to NTP every 5m
- There is a special "init mode" to sync hardware slave with the controller
- At the moment we are using only one (first) channel of the L298N. The second could be used for the alarm or led backlight.
As ESP has no information about the slave clock position - we need to sync them. To do this - connect PIN_INIT (15) pin to GND and restart ESP. It will move arrows every second. Wait until the clock shows 12:00 and immediately unplug the wire. The clock will be synced with ESP and will switch to normal mode.
- Another slave clock project, based on ESP8266: software (gitlab.com/close2/nebenuhr) and hardware (gitlab.com/close2/nebenuhr_hardware/)
- github.com/melka/masterclock - master clock for Lepaute 30 seconds alternating pulse slave clock and possibly other models.