TM1637 4 digit 7-segment display Arduino module

TM1637 4-digit 7-segment LED display Arduino tutorial

TM1637 4 digit 7-segment display Arduino module
TM1637 4 digit 7-segment display Arduino module

TM1637 4-digit 7-segment LED display Arduino tutorial

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 1602 display, connected using the i2c interface.

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

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

MODULE OVERVIEW

The module is a small board with a LED 4-digit seven-segment display based on the TM1637 i2c driver of the same name.

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

CONNECTION DIAGRAM

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

#include "dht"
#include "TM1637.h"
//{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
//0~9,A,b,C,d,E,F
#define dht_pin 2 // Pin sensor
#define CLK 3//Pins for TM1637      
#define DIO 2
TM1637 tm1637(CLK, DIO);
dht DHT;
void setup() {
  tm1637.init();
  tm1637.set(BRIGHT_TYPICAL);
  //BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7   0-7;
  delay(1500);//Delay
}
void loop() {
  DHT.read11(dht_pin);
  int temp = DHT.temperature;
  int humidity = DHT.humidity;
  int digitoneT = temp / 10;
  int digittwoT = temp ;
  int digitoneH = humidity / 10;
  int digittwoH = humidity ;
  tm1637.display(1, digitoneT);
  tm1637.display(2, digittwoT);
  tm1637.display(3, 12); //  C
  delay (5000);
  tm1637.display(1, digitoneH);
  tm1637.display(2, digittwoH);
  tm1637.display(3, 15); //  F
  delay(5000);
}

Find out about the update of this script first in our telegram channel: https://t.me/proweblabxyz