In this tutorial, we will learn how to use the TM1637 4-digit 7-segment LED display with Arduino. These displays are cheaper & best for displaying sensor data, time, stopwatch, random numbers, etc. It is similar to other 4-digit 7-segment displays but has a TM1637 LED Driver IC embedded in it. This removes the extra wiring and using only 2 wires the display can be controlled.

I have explained three TM1637 Arduino example in this tutorial. In the first example, we will look at the basic functions of the TM1637 Display library & display some random numbers and letters. In the second example, we will use TM1637 with Arduino to create a simple temperature display in combination with the DHT11. In the third example, we will use the DS3231 Real Time Clock Module to display the Time on TM1637 Display.


Bill of erials

We need the following components for this tutorial. You can purchase all these components from Amazon.

S.N.ComponentsQuantityPurchase Links
1Arduino Nano Board1Amazon | AliExpress
2TM1637 4-Digit 7-Segment Display1Amazon | AliExpress
3DS3231 RTC Module1Amazon | AliExpress
4DHT22/11 Sensor1Amazon | AliExpress
5Jumper Wires20Amazon | AliExpress
6Breadboard1Amazon | AliExpress



TM1637 4-digit 7-segment LED display

The Bare 4-digit 7-segment displays usually require 12 connection pins. But the TM1637 IC is mounted on the back of the display module, which reduces the total wire to 4. Two pins are required for the power connections and the other two pins are used to control the segments.

The TM1637 module includes four 0.36″ segment 7-segment displays. The module has a ‘colon’ at the center useed to create clock or time-based projects. At the back of the display, there is an inexpensive serial LED driver from Titan MicroElectronics called TM1637. The TM1637 supports many functions – including ON/OFF and brightness control of the LEDs as well as accessing each of the segments.

The module operates between 3.3V to 5V with a current consumption of 80mA. We can interface TM1637 with Arduino or any other microcontroller using the two data pins. There is multiple TM1637 Library for Arduino that removes the complexities and makes it easier to communicate with the display.


TM1637 Module Pinout

There is a 4-pin male header on the module for making connections.

TM1637 Pinout

1. GND: Ground Pin
2. VCC: 3.3V to 5V power supply Pin
3. DIO: Data Input/Output Pin
4. CLK: Clock Input Pin




Interfacing TM1637 4-digits LED Display with Arduino

Now, let us interface TM1637 4-digits LED Display with Arduino Nano Board. The connection is fairly simple. Make a connection between TM1637 & Arduino Nano Board as shown in image.

TM1637 Arduino

Connect the VCC & GND Pin of TM1637 Module to Arduino 5V & GND Pin. Similarly, connect the Module CLK & DIO Pin to Arduino digital pin 2 & 3 respectively.

Arduino TM1637 Connection


TM1637 Arduino Library Installation

There are several libraries for TM1637 Display. Out of all those libraries, the library from Avishay Orpaz is the most popular one. This library has several built-in functions that make controlling the display simple. We need to specify which number to display and it will handle.

You can download the TM1637 Library from the Github Link.

You can also visit the Library manager and install the library directly. Search by typing ‘tm1637‘ & check for the library by Avishay Orpaz. Click on that and then select Install.

TM1637 Library

This library has several built-in functions that make controlling the display fairly easy.

  • setSegments() – Set the raw value of the segments of each digit
  • showNumberDec() – Display a decimal number
  • showNumberDecEx() – Display a decimal number with decimal points or colon
  • setBrightness() – Set the brightness of the display
  • clear() – Clear the display

Basic TM1637 Arduino Example Code

This is the basic example code taken from the example of TM1637 Library. Copy the following code and paste it on your Arduino IDE. Then you can compile and upload the code.



The TM1637 Display will immediately turn ON and starts displaying the random numbers and characters as per the code.


Code Explanation

The code starts with including the library. Install the correct library else you will get an error message while compiling the code.

Next we need to specify the connection pins for CLK & DIO.

You can create arrays to spell words. Each segment is separated by a | and digits of the display are separated by a comma. This array will display “done” on LED Display.

This is the amount of time in milliseconds between the tests. This means the next thing will be displayed after an interval of 200 milliseconds.

Then we need to create a new instance of the TM1637Display class with the function TM1637Display(). This function requires two parameters, first the CLK pin and the second the DIO pin.

The first option to set individual segments is to use hexadecimal numbers. Hexadecimal 0xFF translates to 11111111 in binary, and it turns all segments ON while 0x00 will turn OFF all segments.

This function is used to set the brightness of the display using the syntax setBrightness(brightness,on). You can specify a brightness level from 0 (lowest brightness) to 7 (highest brightness). You can pass it true (display ON) or false (display OFF).

This function can be used to set individual segments of a display. The first argument is the array that contains the segment information. The second argument specifies the number of digits to be updated between 0 to 4. The third argument determines the position from which you want to print (0-leftmost, 3-rightmost).


Displaying Temperature Value on TM1637 using DHT11 Sensor

We can make our own Digital Thermometer using DHT22/11 Sensor along with the TM1637 Display & Arduino. The connection diagram is fairly simple. You can use a breadboard to assemble the circuit.

TM1637 Arduino DHT11

The DHT11/22 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal on the data pin. To learn more about this sensor follow up the DHT11 Arduino Interfacing tutorial. In this project, I used breadboard to assemble DHT22 Sensor with Arduino & TM1637 Display.



Source Code/Program

This code will simply display the temperature value of the surrounding on TM1637 Display.

Copy the following code and paste it on your Arduino IDE. Before compiling this code, you need to add DHT Library to the library folder.

The display will start displaying the temperature both in degrees Celcius and Fahrenheit.


Creating a Clock with TM1637 and DS3231 RTC Module

We can use the TM1637 Display & DS3231 RTC Module with Arduino to create a Real Time Clock as well. The connection diagram is given below.

TM1637 Arduino DS3231

The DS3231 RTC module Precise Real-Time Clock Module is a low-cost, extremely accurate I²C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The module can be interfaced with Arduino & any other controller to design a Real-Time Clock. Check our previous DS3231 & Arduino Interfacing tutorial.


Source Code/Program

This code will display the time in minute and hour on TM1637 Display.

Copy the following code and upload it to the Arduino Board. But before that add the DS3231 RTC Library to the Library Folder.


The TM1637 Display will start showing the Time immediately after you load the code.


Video Tutorial & Guide

How to use TM1637 4-digit 7-segment LED display with Arduino | Quick & Brief Tutorial

You can also use TM1637 with MicroPython Code on Raspberry Pi Pico Board.