- D1-Mini-esp8266-clock Esp8266 accurate digital clock using ds3231sn, a 0.96 inch Oled display,with wifi NTP time setting,ds18b20 temperature sensor. ESP8266 Digital Clock
A clean and accurate smart clock built using an ESP8266 (Wemos D1 Mini), DS3231 RTC, DS18B20 temperature sensor, and a 128×64 OLED display. It keeps time reliably using:
- DS3231 hardware RTC
- On-demand NTP sync
- Software-based second ticking
- A smooth boot animation
- Compact and optimized OLED rendering
This project is the result of multiple iterations focused on timing accuracy, display stability, and clean code structure.
- Accurate timekeeping with DS3231 SN version
- WiFi to NTP time sync on demand
- Smooth software second ticking
- Two display modes: Time and Temperature
- DS18B20 high precision temperature reading
- Four-dot smooth boot animation
- Optimized redraws to avoid flicker
- All strings moved to PROGMEM
- WiFi disabled most of the time for low power
- Wemos D1 Mini (ESP8266)
- DS3231 RTC module (SN version recommended)
- DS18B20 temperature sensor
- 128×64 OLED Display (I2C, SSD1306)
- Two momentary push buttons
- 4.7kΩ resistor (DS18B20 pull-up)
- Jumper wires
Both share the same bus.
- SCL → D1
- SDA → D2
- VCC → 3.3V
- GND → GND
- VCC → 3.3V
- GND → GND
- SCL → D1
- SDA → D2
- VCC → 3.3V
- GND → GND
- SCL → D1
- SDA → D2
- VDD → 3.3V
- GND → GND
- DQ (Data) → D5
- 4.7kΩ resistor between DQ → 3.3V
- One side → D3
- Other side → GND
- One side → D6
- Other side → GND #Power *I am using a AMS117 regualator to power all the components, I am using the onboard regulator of the d1 mini to power it.
- On boot, a four-dot animation plays while the DS3231 is read.
- The ESP8266 starts counting from the exact second the RTC reports.
- Every 30 seconds the RTC is read again to correct small drift.
- Pressing the WiFi button enables WiFi, fetches NTP time, updates the RTC, and disables WiFi, this is useful to set time to a new
- RTC and then in future correct RTC drifts using a single button press.
- The OLED only updates when necessary using a dirty flag system.
- There is a blinking colon in between the hours and minutes like this HH:MM, this provides a nice look and also is a good * indicator if the loop is working properly.
This project is licensed under the MIT License.