Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Today, we will use ESP8266 (NodeMCU) to create an internet clock that retrieves time from the internet. Yes, it retrieves time from the internet accurately and efficiently without the need for synchronization.This is a detailed tutorial for beginners!

As per international convention, let’s first showcase the finished product:

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU As shown in the picture, if you tie two ropes, it can also be called a watch.

Materials:

TM1637: 1 piece of 4-digit display

NodeMCU: 1 ESP8266 development board

MicroUSB: 1 power cable

Dupont Wires: 4 pieces

That’s all, very cheap, estimated to be 20 yuan including shipping!

Development Environment and Setup

Install Arduino, and obtain ESP8266 support in Arduino by adding the following to preferences:

https://arduino.esp8266.com/stable/package_esp8266com_index.json

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Open the board manager, search for ESP8266 and install it.

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

After installation, you can select NodeMCU 1.0 (ESP-12E Module) in the board menu.

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Then open the library manager, search for TM1637 (4-digit display driver), and click install as shown in the picture below.

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Next, continue to install WiFiManager

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

The function of WiFiManager is to configure the network.

Hardware Connections

TM1637’s CLK corresponds to NodeMCU’s D0 (GPIO 16)

TM1637’s DIO corresponds to NodeMCU’s D4 (GPIO 2)

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Software

The source code is here: https://github.com/hello-esp8266/arduino-tm1637-clock (it’s a bit long, so I won’t paste it)

Usage Instructions

After flashing, restart the power, and you will find a hotspot named ClockAP. This hotspot has no password, just connect directly. After connecting, enter 192.168.4.1, and you will see the following interface:

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Click on config wifi, enter your router’s hotspot and password for configuration.

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Then click the save button to save.

At this point, the following interface will appear.

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Because the ESP8266 has already connected to the hotspot (router) you set, its own hotspot will no longer be open. At this point, your electronic clock should already be displaying the time (if your hardware is functional and all connections are correct).

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Essential Guide to Arduino: Using ESP8266 to Retrieve Internet Time with NodeMCU

Get more maker projects and tutorials

Please scan the QR code

Leave a Comment