TM1650 Seven-Segment Display~
This feature is not included in precompiled binaries
When compiling your build add the following to
#ifndef USE_I2C #define USE_I2C #endif #ifndef USE_DISPLAY #define USE_DISPLAY #endif #ifndef USE_DISPLAY_MODES1TO5 #define USE_DISPLAY_MODES1TO5 #endif #ifndef USE_DISPLAY_TM1650 #define USE_DISPLAY_TM1650 #endif // ONLY XY-Clock #ifndef USE_RTC_CHIPS #define USE_RTC_CHIPS #endif #ifndef USE_DS3231 #define USE_DS3231 #endif
|TM1650 - XY-Clock||TM1650 - 303WiFiLC01|
The TM1650 display modules are usually found in "cheap" Wifi LED clock. They manage 7-segment LED displays (~ 27 mm high) with 4 digits. They use two wire I2C protocol to communicate with MCU such as ESP8266/ESP32/Arduino etc.,
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
- 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.
The TM1650 module needs to be connected to I2C GPIO pins and a 3.3V-5V power supply.
|TM1650||ESP based module|
|VCC||3.3V (e.g., ESP-01) or 5V (e.g., Wemos D1 Mini)|
In Tasmota's Configuration -> Configure Module page, assign:
For example, with XY-Clock hardware, the module configuration would look like the following:
TM1650 - XY-Clock
The power toggle button in webUI turns the display on or off. However, if there are additional relays defined, resulting in multiple power toggle buttons in WebUI, display power will create and map to the last button. Thus, it is necessary to ensure that relays are numbered from 1, otherwise a conflict will occur with the display power.
In the console, turn ON the display with the command
Once the GPIO configuration is saved and the ESP8266 / ESP32 module restarts, set the Display Model to 20 using the command:
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 XY-Clock, with wiring is equal to datasheet
DisplayType 2 - Use this for the Type 2 variant 303WifiLC01, with a different wiring
After the ESP8266/ESP32 module restarts again, the display module is ready to accept commands.
0..3 are supported. The firmware default is
To use the Seven-Segment specific Display- commands described below, set the
The brightness of the display can be set using the
DisplayDimmer 0..100 maps the brightness value to 8 steps from
For a minimum brightness, make sure this value is at least about
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~
|DisplayClear||Clears the display|
|DisplayNumber||Clears and then displays number without decimal. command e.g., "DisplayNumber 1234". |
|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". |
|DisplayFloatNC||Displays float (with decimal point) as above, but without clearing first. command e.g., "DisplayFloatNC 12.34"||same as above|
|DisplayRaw||Takes up to |
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
|DisplayText||Clears and then displays basic text. Command e.g., |
For example, the command
|DisplayTextNC||Displays text without first clearing the display. Usage is same as above.||same as above|
|DisplayScrollText||Displays scrolling text, up to 50 characters. |
|DisplayScrollDelay||Sets the speed of text scroll. Smaller delay = faster scrolling.||0 to 15|
|DisplayLevel||Display a horizontal bar graph. Command e.g., ||0 to 100|
|DisplayClock||Displays a clock. ||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 TM1650 to a Wemos D1 Mini, and writing a Rule like the following:
Rule1 ON Tele-AM2301#Temperature DO DisplayText %value%^ ENDON