Wiring guide

How to wire a TM1637 display to an Arduino Nano

To wire a TM1637 display to an Arduino Nano, connect VCC to 5V, GND to GND, CLK to pin 2 and DIO to pin 3. The module runs from 5 V and its CLK and DIO lines idle at 5 V through the module’s pull-ups, the Arduino Nano’s own level. The sketch below uses the TM1637Display (TM1637Display.h) library. It counts up on the four digits of the display.

  • 5 V logic
  • Library: TM1637Display.h
  • 4 wires
Arduino Nano · TM1637 displaylive0.000 s 0.00x
Click to open it in the editor
The circuit itself, running on the simulator with the sketch below. Press what can be pressed; click anything else to open it in the editor.
Pin to pin

TM1637 display to Arduino Nano wiring table

Every wire in the circuit above, with the part’s pin names and the board’s own labels. The wire colors are the ones the circuit uses; on a real bench any colors work.

TM1637 display pinArduino Nano pinWire colorWhy
VCC5VredThe TM1637 runs from 3.3 to 5 V; brighter at 5 V.
GNDGNDblueCommon ground.
CLKpin 2cyanClock. Any digital pin: it is not I2C, despite looking like it.
DIOpin 3violetData, both directions.
Voltage

Power and logic levels for TM1637 display and Arduino Nano

Logic level

The Arduino Nano’s pins are 5 V logic. A 5 V part can drive them directly; a part whose signal pins are limited to 3.3 V needs a level shifter.

Supply

The TM1637 display takes 5 V from 5V. That is the Arduino Nano’s 5 V rail, so the part shares the current the board can supply.

This pair

The module runs from 5V and its CLK and DIO lines idle at 5 V through the module’s pull-ups, the Arduino Nano’s own level.

Pins to leave alone

A6 and A7 are analog only: pinMode(A6, OUTPUT) does nothing and digitalRead(A7) is not there to call. D0 and D1 are the USB serial port.

The sketch

The working code for the Arduino Nano

Library: TM1637Display (TM1637Display.h). This is the sketch the circuit above runs.

TM1637 clock on Arduino Nano
#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);
}
Output

What you should see

The four digits count up. The serial monitor, at 9600 baud, prints Counting once. The module takes two data pins, CLK and DIO, and these are not I2C even though there are two of them.

A dark display with the supply connected usually means CLK and DIO are swapped or on pins other than the ones the sketch names.

The serial monitor prints this, recorded from the circuit above running:

Counting
Pitfalls

Common mistakes wiring a TM1637 display to an Arduino Nano

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.

Picking A6 or A7

A6 and A7 look like the other analog pins but are inputs to the ADC and nothing else. CLK or DIO on either of them never sees a digital level. Any of D2 to D13 or A0 to A5 works.

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.