Arduino Uno TM1637 Display Simulator: Wiring, Code and a Live Circuit
This is a TM1637 4-digit 7-segment display wired to an Arduino Uno, running a minutes and seconds clock live in your browser with the TM1637Display library.
Four wires: power, GND, CLK to pin 2 and DIO to pin 3. Two signal pins drive all 32 segments.
- 5 V logic
- Library: TM1637Display.h
- CLK 2, DIO 3
- Colon for a clock
Wiring the TM1637 Display to the Arduino Uno
Every connection in the circuit above, with the board’s own pin names.
| TM1637 Display pin | Arduino Uno pin | Why |
|---|---|---|
| VCC | 5V | The TM1637 runs from 3.3 to 5 V; brighter at 5 V. |
| GND | GND | Common ground. |
| CLK | pin 2 | Clock. Any digital pin: it is not I2C, despite looking like it. |
| DIO | pin 3 | Data, both directions. |
The module runs from 5V and its CLK and DIO lines idle at 5 V through the module’s pull-ups, the Arduino Uno’s own level.
Pins to leave alone on the Arduino Uno
Pins 0 and 1 are the USB serial port on a real Uno, so anything wired there fights the upload and the serial monitor. Pin 13 carries the onboard LED.
On a real bench
On a real bench the Uno stands beside the breadboard: the TM1637 Display goes into the breadboard and male-to-male jumpers run from the Uno’s female headers to its rows. Power the Uno from USB while you build, and unplug it before you move a wire.
The code
The sketch the circuit above runs. Open it in the editor, change a line and press Run: it compiles in your browser.
#include <TM1637Display.h>
const int CLK_PIN = 2; // pin 2
const int DIO_PIN = 3; // pin 3
TM1637Display display(CLK_PIN, DIO_PIN);
void setup() {
Serial.begin(9600);
display.setBrightness(4); // 0 to 7
Serial.println("Counting");
}
void loop() {
// Minutes and seconds since reset, with the colon on.
unsigned long s = millis() / 1000;
int mmss = (s / 60) % 100 * 100 + s % 60;
display.showNumberDecEx(mmss, 0b01000000, true);
delay(200);
}
TM1637Display display(CLK_PIN, DIO_PIN) names the two pins. The TM1637 chip on the module scans the four digits itself, so the board only sends it a number when something changes.
showNumberDecEx(number, dots, leadingZeros) shows a number up to 9999. The dots mask 0b01000000 lights the colon between the second and third digits, and true keeps the leading zeros, so 1:05 shows as 01:05.
Serial.begin(9600) opens the serial monitor. Serial goes over the USB cable, and the serial monitor in the editor reads it at whatever baud rate the sketch sets.
Common mistakes with the TM1637 Display on the Arduino Uno
Wiring CLK and DIO to the I2C pins
The protocol looks like I2C but is not; it has no address and the Wire library cannot talk to it. Any two digital pins work, and leaving pin A4 and pin A5 free keeps them for a real I2C part.
Expecting decimal points
Most TM1637 clock modules wire only the colon, not the dots under each digit. The dots argument lights them on modules that have them, and the colon on these.
Using pins 0 and 1
Pins 0 and 1 carry the USB serial port on a real Uno. CLK or DIO wired there fights every upload and every Serial.print(). Start at pin 2.
Questions and answers
Can I simulate a TM1637 display with an Arduino Uno?
Yes. The circuit at the top of this page is an Arduino Uno with a TM1637 display, running in your browser on a simulated ATmega328P. The simulated module decodes the real two-wire protocol, so the digits and the colon show exactly what the library sent. Press Run it in the editor to change the wiring or the code; it is free and needs no account.
How do I show letters?
setSegments() takes a byte per digit, one bit per segment, so letters that fit a 7-segment shape (A, b, C, d, E, F and a few more) can be built by hand.
Can I show negative numbers?
showNumberDec() handles them down to -999, using the first digit for the minus sign.
What about a MAX7219 display?
It is a different chip on a three-wire SPI-style bus, driven with LedControl.h. The simulator has it too; the TM1637 is cheaper and needs one pin fewer.
Build your own TM1637 Display project
Open this circuit in the editor, change the wiring or the code, and keep your version in a free account.