TM1637 a 4 digit 7 Segment display with Arduino

(Last Updated On: September 8, 2021)

TM1637 Digital Display:

TM1637 Digital Display Module with Arduino– I have been using different types of LCDs and Oled display modules in different types of projects. I have also a very detailed getting started tutorials on how to use the 16×2 LCD and Oled display modules. These LCDs and Oled display modules are expensive as compared to the digital display modules like for example the Seven Segment modules which are available in common anode and common cathode configuration. The seven segment modules can be used in simple counter type projects, can also be used for the temperature display, etc. Multiplexing seven segment display may be very time consuming for beginners as we cannot display multiple digits on the single seven segment display. We have a readymade multiplexed seven segment display module the TM1637. In this tutorial we will discuss how to use the TM1637 digital display with an Arduino and NodeMCU ESP8266.


Specification of TM1637:

  • 4 M2 screw holes for easy installation.
  • 4-digit LED display module with LED brightness adjustable and clock point.
  • Display device is a total of 4 red LED word tube. Digital tube 8 grayscale adjustable.
  • The driver IC is TM1637; only two signal lines can make MCU control four Digit 8-segments LED can be used to display decimal, letters and so on.
  • Display common anode for the four red LED
  • Size:42X24X12mm
  • Control interface: a total of 4 pins (GND, VCC, DIO, CLK), GND to ground, VCC for the power supply, DIO for the data input and output pins, CLK for the clock signal pin.

TM1637

Interfacing TM1637 with the arduino:

So the first thing you want to do is connect the clock pin to any pin on the Arduino.

  • I connected the clock pin of the TM1637 with the digital pin 3 of the arduno.
  • Now connect the DIO pin of the TM1637 with digital pin 4 of the arduino.
  • Now connect the VCC of the TM1637 with the 5V of the arduino.
  • Connect the ground of the TM1637 with the ground of the arduino.

TM1637

For now these connections are enough for you guys to get started with this amazing Seven Segment module. Let’s go ahead and write a very simple program.



TM1637 Arduino code:

TM1637 Arduino Code explanation:

So now let’s work on the software the first thing you want to do is to install the TM1637 library.

Download TM1637 Library

Or you can follow the instructions given below. So, to do that go to sketch include library and manage libraries.

TM1637

Now we will write TM1637 and pick the one that’s labeled Grove for digit display by seed studio and click install.

TM1637

So once that’s installed you want to include the library by typing it in the code.

After this let’s make variables for our clock pin and DIO pin. So our clock pin was pin 3 and DIO was pin 4

After this let’s initialize our TM1637 objects and name it TM and you pass in it the clock pin data as your first parameter and a DIO pin data as a second parameter.


After this we have to initialize it

After that we have to set the brightness and we do that with TM dot set and then you pass in a brightness value from 0 to 7. In our case we have pass in the value 3 to set the brightness.

So now we can actually make it display things so as an example let’s make a display 11 : ab. So to do that you just do TM dot display and you pass the two parameters the first is position where the first digit is 0 in the last digit is 3.

TM1637

The second is character where when we write the number 0 to 9 it display the number and when we write the number from 10 to 15 display the letters A to F on the display. So to make it display 1 as our first character we simply do tm.display position 0 and 1 for the two tm.display 1 and 2 because the position is 1 and the character is two to make it display.

For the “:” sign we will write tm.point and then one where one turns on point and zero turns off the point.

Then to display we will write the command tm.display  20 and 10 where 2 is for position which is the third position and 10 is the a character

Now for B, tm.display 3 and 11 where three represents the 4th position and 11 is for the b character. tm.display(3,11);

After uploading code to the arduino we will see the display on the TM1637.



IOT based clock using TM1637:

Now to make IOT based Clock we will use NodeMCU ESP8266 with TM1637. Now to interface the TM1637 with Nodemcu ESP8266 we will perform the following steps:

  • Connect the clock pin of the TM1637 with the digital pin 3 of the Nodemcu.
  • Now connect the DIO pin of the TM1637 with digital pin 4 of the Nodemcu
  • Now connect the VCC of the TM1637 with the 3V of the Nodemcu
  • Connect the ground of the TM1637 with the ground of the Nodemcu

TM1637

IoT digital Clock Nodemcu ESP8266 Complete code:


IoT digital Clock Nodemcu ESP8266 Code Explanation:

First of all we will include the NTPClient library which network time protocol and if we have access to the internet we can get and we do not require any hardware. This library will be used to get the time online. We will go to sketch and then go to manage library and write ntpclient and install it.

TM1637

After uploading the code to the nodemcu ESP8266 the current time will be shown on the TM1637 Seven Segment display module.

 

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

1 Comment

Leave a Reply

%d bloggers like this: