ESP8266 Internet Clock with OLED Display (IST Format)

Are you looking for an accurate and reliable real-time clock that updates itself over the internet? This project will guide you through building an ESP8266-based Internet Clock that synchronizes time using an NTP (Network Time Protocol) server and displays it on an OLED Display. The clock automatically adjusts to Indian Standard Time (IST, UTC +5:30), ensuring precision without needing manual calibration.

Features of the Internet Clock

  • Displays Time in a 12-hour format (AM/PM)
  • Shows Date in DD/MM/YYYY format
  • Displays the Day of the Week
  • Automatically syncs time using an NTP server
  • Uses an OLED Display (I2C, SSD1306) for clear output
  • Wi-Fi enabled for real-time updates

Components Required

To build this project, you will need the following components:

  • ESP8266 NodeMCU
  • OLED Display (128×64, I2C, SSD1306)
  • Jumper Wires

Circuit Diagram & Wiring Instructions

To set up the hardware, connect the ESP8266 to the OLED display as shown in the table below:

OLED Pin ESP8266 Pin
VCC 3V3
GND GND
SCL D1 (GPIO5)
SDA D2 (GPIO4)

Ensure that all connections are properly secured to avoid communication issues between the ESP8266 and the OLED display.

Setting Up the Code

To get your clock running, install the required libraries and upload the code to the ESP8266 using Arduino IDE.

Required Libraries

Before uploading the code, install the following libraries from the Arduino Library Manager:

  1. U8g2 – For driving the OLED display (Install from GitHub)
  2. NTPClient – To fetch accurate time from the internet
  3. ESP8266WiFi – To connect the ESP8266 to your Wi-Fi network

Uploading the Code

Copy and paste the following Arduino sketch into the Arduino IDE and upload it to your ESP8266.

https://github.com/ElectroIoT/ESP8266-clock-Using-Oled-display

https://github.com/ElectroIoT/ESP8266-clock-Using-Oled-display

How the Internet Clock Works

  1. The ESP8266 connects to a Wi-Fi network.
  2. It retrieves the current time from an NTP server.
  3. The time is automatically adjusted for Indian Standard Time (UTC +5:30).
  4. The OLED display updates every second, showing:
    • Current time (HH:MM:SS AM/PM)
    • Date (DD/MM/YYYY)
    • Day of the week

Troubleshooting

OLED Display Issues

  • Double-check the I2C wiring (SDA, SCL connections).
  • Ensure the correct OLED I2C address (default is 0x3C).
  • Run an I2C scanner sketch to detect connected devices.

Wi-Fi Connection Problems

  • Verify the SSID and password in the code.
  • Move the ESP8266 closer to the router for a stronger signal.

Conclusion

This ESP8266 Internet Clock is a simple yet effective project that automatically syncs with an NTP server to maintain accurate time. Whether you need a real-time clock for your IoT projects or a digital desk clock, this project provides an efficient and cost-effective solution.

License

This project is open-source and free to modify. Feel free to experiment and enhance its functionality!

 

Share This Post:

Leave a Comment