NodeMCU Internet clock with SSD1306 display | IoT Projects

Last ESP8266 NodeMCU project I made a simple real time clock with DS3231 RTC chip and SSD1306 OLED, time and date were displayed on the SSD1306 screen and they could be set with two push buttons.
With the NodeMCU WiFi development board we can use the internet to get an accurate local time, therefore there is no need for a real time clock chip such as: DS1302, DS1307, DS3231 …
This project shows how to build an internet clock with the NodeMCU WiFi module where time and date are displayed on SSD1306 OLED display.

The SSD1306 OLED used in this project is configured to work in I2C mode, some SSD1306 OLED boards may require a small hardware modifications (to select between SPI mode or I2C mode) such as soldering, placing jumpers ….

Related Projects:
ESP8266 NodeMCU interfacing with SSD1306 OLED
NodeMCU Internet clock and weather station | IoT Projects
Real time clock using NodeMCU, DS3231 and SSD1306 OLED
ESP8266 WiFi Internet real time clock

ESP8266 NodeMCU internet clock with SSD1306 OLED display

Hardware Required:

  • ESP8266 NodeMCU development board
  • SSD1306 OLED display with 128×64 Pixel resolution
  • micro USB cable (for programming and powering the circuit)
  • Breadboard
  • Jumper wires

NodeMCU Internet clock with SSD1306 display circuit:
Project circuit schematic diagram is shown below.
ESP8266 ESP-12E nodeMCU SSD1306 OLED display circuitAnd the following image shows fritzing circuit:

ESP8266 ESP-12E nodeMCU SSD1306 OLED display fritzing circuit

The SDA and SCL lines of the I2C bus come from GPIO4 (D2) and GPIO0 (D3) of the NodeMCU board (respectively), they are connected to SDA and SCL (SCK) pins of the SSD1306 display module.
Reset pin (RES) of the display module is connected to GPIO5 (D1) of the NodeMCU development board.

The SSD1306 display module is supplied with 3.3V which comes from the NodeMCU board.

NodeMCU Internet clock with SSD1306 display code:
The Arduino IDE code below uses Adafruit SSD1306 OLED driver and Adafruit GFX library for the communication between the NodeMCU and the screen module.

The other library is NTPClient, this library connects the ESP8266 WiFi to a time server, this server sends time information to the module. NTP: Network Time Protocol.
NTPClient Library   —   direct link

The last one is Arduino Time library, this library converts Unix timestamp (Unix epoch) into: seconds, minutes, hours, day of the week, day, month and year. The Unix epoch is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
Basically the time server sends time in Unix epoch format which needs to be converted, this library does all the job. Download links are below:
Arduino Time Library   —   direct link

The NTPClient library is configured to get time information (Unix epoch) from the server time.nist.gov (GMT time) and an offset of 1 hour ( ==> GMT + 1 time zone) which is equal to 3600 seconds, configuration line is below:
NTPClient timeClient(ntpUDP, “time.nist.gov”, 3600, 60000);

Rest of code is described through comments.

NodeMCU Internet clock with SSD1306 display video:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

1 thought on “NodeMCU Internet clock with SSD1306 display | IoT Projects”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top