!!! 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
In case you want MAX7219 also add:
#ifndef USE_DISPLAY_MAX7219
#define USE_DISPLAY_MAX7219
#endif
TM1637 | TM1638 | MAX7219 |
---|---|---|
![]() |
![]() |
![]() |
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.
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
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 |
In Tasmota's Configuration -> Configure Module page, assign:
For TM1637
GPIOx
toTM1637 CLK
GPIOy
toTM1637 DIO
For TM1638
GPIOx
toTM1638 CLK
GPIOy
toTM1638 DIO
GPIOz
toTM1638 STB
For MAX7219
GPIOx
toMAX7219 CLK
GPIOy
toMAX7219 DIN
GPIOz
toMAX7219 CS
For example, if x=0 and y=2, z=4 then the module configuration would look like the following:
TM1637
TM1638
MAX7219
The power toggle button in webUI turns the display on or off.
Once the GPIO configuration is saved and the ESP8266 / ESP32 module restarts, set the Display Model to 15 using the command:
DisplayModel 15
If you have a TM1637 with 6 digits, set the number of digits using the command:
DisplayWidth 6
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 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
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
The Display- commands listed below can be used from the Tasmota web-console, MQTT, and from Tasmota 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
Another example, using a MAX7219 and a SHT3X temp/humidity sensor, with value comparison so dispaytext only fires when the value changes. The first four digits display the temperature and the second four digits dispay the humidity. The DisplayTextNC command is used to leave unused digits illuminated, so both numbers can be independently updated.
Rule1
on sht3x#Temperature!=%var1% do backlog displaytextnc %value%^;var1 %value% endon on sht3x#Humidity!=%var2% do backlog displaytextnc %value%h,4;var2 %value% endon on system#init do power 1 endon
The TM1637 4-digit module (front and back)
TM1637 4-digit module with Wemos D1 Mini