A TM1637 module is the classic “big digits” display: four 7-segment digits with a colon, driven by just two wires. On a NodeMCU it makes a Wi-Fi clock, a temperature readout or a ping display you can read from across the room.
Wire CLK to D5, DIO to D6 and power it from 3V3. The sketch shows minutes and seconds since power-up with a blinking colon — swap in NTP time and you have a clock.
Wiring
| NodeMCU ESP8266 | TM1637 4-digit 7-segment display | Wire | Notes |
|---|---|---|---|
| 3V3 | VCC | red | Digits are slightly dimmer than at 5 V, but CLK/DIO stay at 3.3 V. |
| GND | GND | black | |
| D5 | CLK | yellow | GPIO14. |
| D6 | DIO | blue | GPIO12. |
3.3–5 V part, 3.3 V board. Works from 3.3 V or 5 V — power it from your board’s logic voltage so CLK/DIO stay in range. At 3.3 V the digits are a little dimmer.
Board quirks
- The TM1637 is not I2C even though it has two wires — the library bit-bangs its own protocol, so any two normal GPIOs work. D5/D6 leave D1/D2 free for an I2C sensor.
- The module has pull-ups on CLK and DIO to its VCC. Powering it from 3V3 keeps those lines at 3.3 V; from VIN they would sit at 5 V on the ESP8266 pins. For the same reason, keep CLK/DIO off D8, which must be LOW at boot.
- Pair it with Wi-Fi and
configTime(19800, 0, "pool.ntp.org")(19800 s = IST, UTC+5:30) and the ESP8266 becomes an always-correct wall clock — no RTC module needed. - The colon is bit 0x40 of the dots mask on 4-digit clock modules. Modules with decimal points instead of a colon map the dots differently.
Code
// TM1637 4-digit 7-segment display on a NodeMCU (ESP8266).
// VCC → 3V3, GND → GND, CLK → D5 (GPIO14), DIO → D6 (GPIO12).
// Shows minutes:seconds since power-up with a blinking colon.
#include <TM1637Display.h>
const uint8_t CLK_PIN = D5;
const uint8_t DIO_PIN = D6;
TM1637Display display(CLK_PIN, DIO_PIN);
void setup() {
Serial.begin(115200);
Serial.println();
display.setBrightness(5); // 0-7; at 3.3 V the segments are a little dimmer, so stay high
display.clear();
Serial.println("TM1637 on CLK D5 / DIO D6 - counting mm:ss");
}
void loop() {
unsigned long s = millis() / 1000;
int mmss = (s / 60 % 100) * 100 + s % 60;
uint8_t colon = (s % 2) ? 0b01000000 : 0; // dots mask: the colon on 4-digit clock modules
display.showNumberDecEx(mmss, colon, true);
Serial.printf("%02lu:%02lu\n", s / 60 % 100, s % 60);
delay(1000);
}// TM1637 4-digit 7-segment display on a NodeMCU (ESP8266).
// VCC → 3V3, GND → GND, CLK → D5 (GPIO14), DIO → D6 (GPIO12).
// Shows minutes:seconds since power-up with a blinking colon.
#include <TM1637Display.h>
const uint8_t CLK_PIN = D5;
const uint8_t DIO_PIN = D6;
TM1637Display display(CLK_PIN, DIO_PIN);
void setup() {
Serial.begin(115200);
Serial.println();
display.setBrightness(5); // 0-7; at 3.3 V the segments are a little dimmer, so stay high
display.clear();
Serial.println("TM1637 on CLK D5 / DIO D6 - counting mm:ss");
}
void loop() {
unsigned long s = millis() / 1000;
int mmss = (s / 60 % 100) * 100 + s % 60;
uint8_t colon = (s % 2) ? 0b01000000 : 0; // dots mask: the colon on 4-digit clock modules
display.showNumberDecEx(mmss, colon, true);
Serial.printf("%02lu:%02lu\n", s / 60 % 100, s % 60);
delay(1000);
}Library: TM1637 (Avishay Orpaz) — compiled with TM1637 1.2.0.
Expected serial output
TM1637 on CLK D5 / DIO D6 - counting mm:ss
00:00
00:01
00:02TM1637 on CLK D5 / DIO D6 - counting mm:ss 00:00 00:01 00:02
Common errors
Display stays blank
CLK and DIO swapped, or brightness never set — setBrightness() must be called before the first number.
Random segments light up
Long jumper wires on the 3.3 V lines. Keep them short, or power the module from VIN only if you add a level shifter on CLK/DIO.