TM1637, TM1638 and MAX7219 Seven-Segment Display~
Info
This feature is included only in the tasmota*-display.bin" precompiled binary
To use this feature (i.e., if you're not using tasmota*-display.bin precompiled binary), you must compile your build after adding the following to user_config_override.h:
#ifndef USE_DISPLAY
#define USE_DISPLAY
#endif
#ifndef USE_DISPLAY_TM1637
#define USE_DISPLAY_TM1637
#endif
| | ![]() |
The TM1637, TM1638 and MAX7219 display modules are small (~ 10mm high digits) 7-segment, LED-based display units with 4/6 digits (TM1637), 8 digits and 8 digits (TM1638 and MAX7219) respectively. They use a two-wire (TM1637) or three-wire (TM1638 and MAX7219) I2C-like (but not exactly) protocol for communication with MCUs like the ESP8266 / ESP32 / Arduino etc.,
These modules are a great way to add a simple numeric display to any MCU project.
Features~
The Tasmota support for these modules can --
- display Numbers and Floats with control over position and leading zeros.
- display basic Text, for example, sending the text
22.5^will display:

- display Raw segments.
- display Level, like a bar graph
- display Scrolling text
- display a Clock in 12 hr and 24 hr format
- set Brightness (8 levels) and Clear the display.
Info
This driver does not support the buttons and LEDs on the TM1638
Configuration~
Wiring~
The TM1637 module needs to be connected to two GPIO pins and a 3.3V-5V power supply.
| TM1637 | ESP8266 based module |
|---|---|
| CLK | GPIOx |
| DIO | GPIOy |
| VCC | 3.3V (e.g., ESP-01) or 5V (e.g., Wemos D1 Mini) |
| GND | GND |
The TM1638 module needs to be connected to three GPIO pins and a 5V power supply.
| TM1638 | ESP8266 based module |
|---|---|
| CLK | GPIOx |
| DIO | GPIOy |
| STB | GPIOz |
| VCC | 5V |
| GND | GND |
The MAX7219 module needs to be connected to three GPIO pins and a 5V power supply.
| MAX7219 | ESP8266 based module |
|---|---|
| CLK | GPIOx |
| DIN | GPIOy |
| CS | GPIOz |
| VCC | 5V |
| GND | GND |
Tasmota Settings~
In Tasmota's Configuration -> Configure Module page, assign:
For TM1637
GPIOxtoTM1637 CLKGPIOytoTM1637 DIO
For TM1638
GPIOxtoTM1638 CLKGPIOytoTM1638 DIOGPIOztoTM1638 STB
For MAX7219
GPIOxtoMAX7219 CLKGPIOytoMAX7219 DINGPIOztoMAX7219 CS
For example, if x=0 and y=2, z=4 then the module configuration would look like the following:
TM1637
TM1638
MAX7219
Initial Setup~
DisplayModel:
Once the GPIO configuration is saved and the ESP8266 / ESP32 module restarts, set the Display Model to 15 using the command:
DisplayModel 15
DisplayWidth:
If you have a TM1637 with 6 digits, set the number of digits using the command:
DisplayWidth 6
DisplayType:
The 6-digit TM1637 has 2 known variants with different hardware wiring for the digit ordering.
You can switch between these two variants with the following commands:
DisplayType 0 - Use this for the Type 0 variant, with wiring similar to the TM1637 4-digit modules
DisplayType 1 - Use this for the Type 1 variant, with a different wiring that causes the text 123456 to appear as 321654
After the ESP8266/ESP32 module restarts again, the display module is ready to accept commands.
DisplayModes:
DisplayModes 0..3 are supported. The firmware default is DisplayMode 1.
To use the Seven-Segment specific Display- commands described below, set the DisplayMode to 0 with:
DisplayMode 0
DisplayDimmer:
The brightness of the display can be set using the DisplayDimmer command.
DisplayDimmer 0..100 maps the brightness value to 8 steps from 0..7
For a minimum brightness, make sure this value is at least about 13
7-Segment specific Commands~
The Display- commands listed below can be used from the Tasmota web-console, MQTT, and from Tasmota Rules
Commands and Usage~
| Console/MQTT Commands | Description | values |
|---|---|---|
| DisplayClear | Clears the display | |
| DisplayNumber | Clears and then displays number without decimal. command e.g., "DisplayNumber 1234". Control leading zeros, length and position. leading zeros can be 1 or 0 (default),length can be 1 to NUM_DIGITS (4 or 6), position can be 0 (left-most) to NUM_DIGITS (right-most). Command example: DisplayNumber 12, 1, 1, 3 This will display:![]() | num [, position[, leading_zeros[, length]]] |
| DisplayNumberNC | Display integer number as above, but without clearing first. e.g., "DisplayNumberNC 1234". Usage is same as above. | same as above |
| DisplayFloat | Clears and then displays float (with decimal point) command e.g., "DisplayFloat 12.34". Control precision, length and position. precision can be 0 to NUM_DIGITS (default), length can be 1 to NUM_DIGITS (4 or 6), position can be 0 (left-most) to NUM_DIGITS (right-most). Command example: DisplayFloat 2.48, 1, 1, 2 This will display:![]() | num[, position[, precision[, length]]] |
| DisplayFloatNC | Displays float (with decimal point) as above, but without clearing first. command e.g., "DisplayFloatNC 12.34" | same as above |
| DisplayRaw | Takes upto NUM_DIGITS comma-separated integers (0-255) and displays raw segments. Each number represents a 7-segment digit. Each 8-bit number represents individual segments of a digit. Segment a=1, b=2, c=4, d=8, e=16, f=32, g=64 and h (decimal point)=128. To turn on all segments, the number would be 1+2+4+8+16+32+64+128 = 255 For example, the command DisplayRaw 0, 2, 255, 255 would display:![]() | position, length, num1 [, num2[, num3[, num4[, ...upto NUM_DIGITS numbers]]...] |
| DisplayText | Clears and then displays basic text. Command e.g., DisplayText a.b12 Control length and position of the displayed text. length can be 1 to NUM_DIGITS , position can be 0 (left-most) to NUM_DIGITS-1 (right-most) A caret( ^) symbol in the text input is dispayed as the degrees(°) symbol. This is useful for displaying Temperature (or angle)! For example, the command DisplayText 22.5^ will display:![]() | text[, position[, length]] |
| DisplayTextNC | Clears first, then displays text. Usage is same as above. | same as above |
| DisplayScrollText | Displays scrolling text, upto 50 characters. Command example: DisplayScrollText tasmota is awesome | text |
| DisplayScrollDelay | Sets the speed of text scroll. Smaller delay = faster scrolling. | 0 to 15 |
| DisplayLevel | Display a horizontal bar graph. Command e.g., DisplayLevel 50 will display:![]() | 0 to 100 |
| DisplayClock | Displays a clock. DisplayClock 1 displays a clock in 12-hour format. DisplayClock 2 displays a clock in 24-hour format. DisplayClock 0 turns off the clock and clears the display | 1 or 2 or 0 |
Usage in Rules~
All the above commands can be used in Tasmota Rules, as usual.
For example, a simple digital thermometer can be implemented by connecting a DHT22 Temperature-Humidity Sensor and a TM1637 to a Wemos D1 Mini, and writing a Rule like the following:
Rule1
ON Tele-AM2301#Temperature DO DisplayText %value%^ ENDON
TM1637 Images~

The TM1637 4-digit module (front and back)

TM1637 4-digit module with Wemos D1 Mini




