Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

TM1637 4-digit display with NodeMCU ESP8266 — wiring and clock code

Wire a TM1637 4-digit 7-segment display to a NodeMCU ESP8266 on D5/D6 at 3.3 V and show a mm:ss counter with a blinking colon.

Arduino C++Verified — core esp8266 3.1.2, TM1637 1.2.0, 3 Nov 2026Compile-only

Community draft — report a mistake

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 ESP8266Only the pins used are shown · 3.3 V logicTM1637 4-digit 7-segment displayGND3V3D5D6CLKDIOVCCGND
Every connection
NodeMCU ESP8266TM1637 4-digit 7-segment displayWireNotes
3V3VCCredDigits are slightly dimmer than at 5 V, but CLK/DIO stay at 3.3 V.
GNDGNDblack
D5CLKyellowGPIO14.
D6DIOblueGPIO12.

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-nodemcu.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// 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

Serial Monitor · 115200Output
TM1637 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.

↑↓ to move · Enter to open