ESP8266 NodeMCU Internet Clock with ST7735 TFT

This post shows how to implement internet clock using ESP8266 NodeMCU Wi-Fi board where time and date are displayed on ST7735 TFT display.
The ST7735 TFT is a color display with resolution of 128×160 pixel, it communicates with the master device using SPI protocol.
TFT: Thin-Film Transistor
SPI: Serial Peripheral Interface

To see how to interface the NodeMCU board with the ST7735 TFT display, visit this post:
Interfacing ESP8266 NodeMCU with ST7735 TFT

Hardware Required:

  • ESP8266 NodeMCU board
  • ST7735 TFT display module
  • micro USB cable (for programming and powering the circuit)
  • Breadboard
  • Jumper wires

NodeMCU Internet clock with ST7735 TFT circuit:
Project circuit schematic diagram is shown below.

ESP8266 NodeMCU ST7735S TFT display

The ST7735S shown in project circuit diagram has 8 pins: (from right to left): RST (reset), CE (chip enable), DC (or D/C: data/command), DIN (data in), CLK (clock), VCC, BL (back light) and Gnd (ground).

The ST7735 display is connected to the NodeMCU board as follows:
RST pin is connected to D4 (ESP8266EX GPIO2),
CS pin is connected to D3 (ESP8266EX GPIO0),
D/C pin is connected to D2 (ESP8266EX GPIO4),
DIN (MOSI) pin is connected to D7 (ESP8266EX GPIO13),
CLK (SCK) pin is connected to D5 (ESP8266EX GPIO14),
VCC and BL are connected to pin 3V3,
GND is connected to pin GND of the NodeMCU board.

Pins D5 (GPIO14) and D7 (GPIO13) are hardware SPI module pins of the ESP8266EX microcontroller respectively for SCK (serial clock) and MOSI (master-out slave-in).

NodeMCU Internet clock with ST7735 TFT circuit:
The following Arduino code requires two libraries from Adafruit Industries:
The first library is a driver for the ST7735 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “st7735” and install the one from Adafruit).

The second library is Adafruit graphics library which can be installed also from Arduino IDE library manager.

Both libraries can be installed manually, first download them from the following 2 links:
Adafruit ST7735 TFT library    —->  direct link
Adafruit graphics library        —->  direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the other library file.

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

All the used libraries are included in the Arduino code as shown below:

The connection of ST7735 TFT display with the NodeMCU is as shown below where the display is connected to hardware SPI module of the NodeMCU (pins: SCK and MOSI):

The NTPClient library is configured to get time information (Unix epoch) from the server (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, “”, 3600, 60000);

Full Arduino Code:

ESP8266 NodeMCU ST7735 TFT internet clock

Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

6 thoughts on “ESP8266 NodeMCU Internet Clock with ST7735 TFT”

  1. В строке 89 tft.printf( “%02u-%02u-%04u”, day(unix_epoch), month(unix_epoch), year(unix_epoch) );
    заменить на tft.printf(“%02u-%02u-%04u”); // day(unix_epoch), month(unix_epoch), year(unix_epoch));
    В строке 93 tft.printf( “%02u:%02u:%02u”, hour(unix_epoch), minute(unix_epoch), second(unix_epoch) );
    заменить на tft.printf(“%02u:%02u:%02u”); // hour(unix_epoch), minute(unix_epoch), second(unix_epoch));
    и тогда все прокомпилится
    . Variables and constants in RAM (global, static), used 29120 / 80192 bytes (36%)
    ╠══ DATA 1504 initialized variables
    ╠══ RODATA 1144 constants
    ╚══ BSS 26472 zeroed variables
    . Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60287 / 65536 bytes (91%)
    ╠══ ICACHE 32768 reserved space for flash instruction cache
    ╚══ IRAM 27519 code in IRAM
    . Code in flash (default, ICACHE_FLASH_ATTR), used 254092 / 1048576 bytes (24%)
    ╚══ IROM 254092 code in flash

  2. The line “void setup(void)” should be “void setup()” as you’ll get an error otherwise. It took me a bit to find this was causing it to fail.

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