Maker Pro

All About TM1637

November 28, 2022 by Ashish Adhikari

In this tutorial, I am going to show you guys how to control the TM1637 4-Digit 7-Segment displays using an Arduino.

Topics Covered

Then we will have a look at some of these quick examples:

Example 1: Displaying String and a Number

Example 2: Displaying Scrolling and Blinking Text

Example 3: Creating a 4 Digit Counter

Example 4: Displaying Temperature & Humidity using DHT11/DHT22

Example 5: Creating an Arduino Based Digital Clock

And finally we will have a look at some common errors.

7-Segment Display Basics

A 7-Segment Displays consists of 7 LEDs making the shape of decimal number 8. These LEDs are called segments, because when they light up, each segments contributes in the formation of part of a decimal or hex digit.

These individual segments are labeled from ‘a’ to ‘g’ representing each individual LED. By setting a particular segment HIGH or LOW, a desired character pattern can be generated.

Hardware Overview and Pinout of TM1637 Module

The module comes with 4 right angle male pin headers. I find it a bit annoying to have the pin headers on the top side of the board. However, you can always unsolder and put them at the bottom of the board.

Now lets have a look at the GPIO pins:

CLK - is the clock input pin. You can connect it to any digital pin of an Arduino.

DIO - is the Data I/O pin. This can also connect to any digital pin of an Arduino.

VCC - Connects to 3.3V to 5V power supply.

GND - is the ground pin.

CLK and DIO pins can be connected to any digital pin of an Arduino. This gives us an opportunity to hook up a lot of these modules to an Arduino, as long as each instance has a pin pair of its own. When writing the code, we just need to specify the pin pair and then just go ahead and use them in your project.

If you run out of pins on your Arduino board you can use a GPIO Pin Extenders like the PCF8574. Please check out my tutorial on the Extender module, the link is in the description below.

PCF8574 GPIO Extender:

The module has 4 x 0.36 segment 7-Segment Displays and a ‘colon’ at the center for creating clock or time-based projects.

A bare four digit 7-Segment Displays usually requires 12 connection pins but the TM1637 LED Driver removes the need of the extra wiring for the 7-Segments and the entire setup can be controlled just by using 2 wires (DIO and CLK) and two more for power reducing the total wires to 4.

These modules communicate with the processor using "I2C-like protocol". The implementation is pure software emulation and doesn't make use of any special hardware (other than GPIO pins).

The module operates between 3.3v to 5v with a current consumption of 80ma and allows adjusting the brightness of the LEDs at the software level. They are available in few different colors.

TM1637 Library Installation

Interfacing TM1637 Module with an Arduino

Hooking up the TM1637 module to an Arduino is very easy. 

You just need to connect four wires: 2 for power and other 2 for controlling the display.

You can connect the VCC of the module to either 3.3v or 5v pin of the Arduino.

So, connect:

CLK - Pin 2 of Arduino

DIO - Pin 3 of Arduino

VCC - 5V  of Arduino

GND - GND  of Arduino

As previously advised, you can use any pin combination for the CLK and DIO on the Arduino board. Just make sure you change the pin numbers in the code to reflect the change of wiring.

So far, based on my experience I have only found one disadvantage.

This module is unable to display floating points or dots between numbers. However, you can use the "HT16K33 module" for displaying floating points.


For the rest of the examples, I am going to use this template to write the code.

I will only show you guys the bit which is different in each code.

Example 1: Displaying Strings and Numbers

Example 3: Creating a 4 Digit Counter

Example 4: Displaying Temperature & Humidity using DHT11/DHT22

You can also create an alarm clock using either the DS3231 or DS1302 RTC Module and display the data using this TM1637 module. 

I will cover that in full details in my next video. 


Related Content


You May Also Like