LED indicator TM1637 and Arduino - wiring diagram

LED indicator TM1637 and Arduino - wiring diagram

Daniil Zhuk
Often projects require us to output data from various sensors and devices to a port monitor or to a display, for example, to output data from a temperature sensor. Many of you are already familiar with the budget LCD display 1602, connected via an i2c interface.

But there are also LED displays. They can be used to output the same data, but in a more convenient format: due to the larger display size, data is easier to read, and with their help, you can create a project like a real clock!

In this article, we will disassemble the device LED indicator TM1637, learn how to connect it to the Arduino and write the program code to work with it!

To implement the project from this article, we need the following components:
  • Arduino Uno R3
  • Seven-segment indicator TM1637
  • Breadboard
  • Wires


LED indicator TM1637 and Arduino - wiring diagram
The module is a small board on which a 4-digit seven-segment LED display is installed based on the TM1637 i2c driver of the same name.

Externally, the design is quite simple, and we will not dwell on this much. Unless, it can be noted that sometimes a module is sold as an 8-bit version, which will occupy more leads for connecting to the Arduino.

Also on some displays, there is a clock separator, in the form of a colon. That is why the TM1637 indicator found very wide use in DIY watches on the Arduino.


Due to the presence of the i2c interface onboard, the module is connected very simply - using four pins. Two of them are responsible for the power supply and are connected to the 5V and Gnd terminals on the Power panel of our controller; the other two, called CLK and DIO, will connect to digital outputs, for example, 3 and 2, respectively.

A visual wiring diagram, for your convenience, is shown in the picture on the right:

Before you start writing the program code, and then puzzling over more complex projects, you need to download a specialized library for our display - tm1637.h.
Simultaneously with the loaded library, three new codes will appear in the “examples” folder for review and performance checks. Let's get acquainted with one of them.
The code below displays any 4 characters that we pre-compile, and also turns the clock separator on and off with a delay of 1 second (1000 milliseconds):

#include "TM1637.h" 
int8_t DispMSG[] = {1, 2, 3, 4}; 
#define CLK 3
#define DIO 2
TM1637 tm1637(CLK, DIO);
void setup()
void loop()

After loading and successful compilation of this code, we will see the numbers 1, 2, 3, 4 on the LED screen.

If we want to display data on the display, for example from a temperature sensor, the following code will help us with this:

#include "dht.h"
#include "TM1637.h"
#define dht_pin 2 
#define CLK 3
#define DIO 2
TM1637 tm1637(CLK, DIO);
dht DHT;
void setup() {
void loop() {
int temp = DHT.temperature;
int humidity = DHT.humidity;
int digitoneT = temp / 10;
int digittwoT = temp % 10;
int digitoneH = humidity / 10;
int digittwoH = humidity % 10;
tm1637.display(1, digitoneT);
tm1637.display(2, digittwoT);
tm1637.display(3, 12);
delay (5000);
tm1637.display(1, digitoneH);
tm1637.display(2, digittwoH);
tm1637.display(3, 15);

Please note that we also first connect a separate library for the temperature and humidity sensor DHT. Numbers and letters are also written for our display, but they do not refer to the code — this part of the code only shows us that the library allows the module to display numbers from 0 to 9 in the usual mode, and from 10 to 15 in the form of letters.

Next, we prescribe what output we connect our modules to, compared to the previous scheme, we add a digital output connection from the temperature sensor to pin number 2.

In the void setup function, we initialize the sensors and start the cycle. In the cycle itself, we read the readings from the temperature sensor: in the variable temp we save the temperature value and in the humidity value humidity.

Next, these values ​​are divided by 10 in order to display these data on our display, since information on a seven-segment display can be displayed only character-by-character.

The last eight lines are devoted to displaying data directly on the display. The last value is the symbol C, for temperature and F for humidity. And also put a delay of 5 seconds between the transfer of evidence.

On this, our article came to an end. We hope that the material was useful for you and you can apply the knowledge and experience gained in your own cool projects! All successful compilation, follow our blog!

Add a comment

* Comments must be approved before being displayed.