TM1621 LCD Display

The tm1621 display platform allows you to use the popular TM1621 LCD display drivers with ESPHome, that can find in Sonoff device like THR316D, THR320D, POWR316D or POWR320D

../../_images/tm1621-full.jpg

TM1621 LCD Display.

The LCD have four signal, cs for chip select, data for data signal, read for reading data dir and write for writing data dir

# Example configuration entry
display:
  platform: tm1621
  id: tm1621_display
  cs_pin: GPIOXX
  data_pin: GPIOXX
  read_pin: GPIOXX
  write_pin: GPIOXX
  lambda: |-
    it.printf(0, "%.1f", id(my_sensor1).state);
    it.display_celsius(true);
    it.printf(1, "%.1f", id(my_sensor2).state);
    it.display_humidity(true);

Configuration variables:

  • cs_pin (Required, Pin Schema): The pin you have the CS line.

  • data_pin (Required, Pin Schema): The pin you have the DATA line.

  • read_pin (Required, Pin Schema): The pin you have the READ line.

  • write_pin (Required, Pin Schema): The pin you have the WRITE line.

  • lambda (Optional, lambda): The lambda to use for rendering the content on the TM1621. See Rendering Lambda for more information.

  • update_interval (Optional, Time): The interval to re-draw the screen. Defaults to 1s.

  • id (Optional, ID): Manually specify the ID used for code generation.

Rendering Lambda

The TM1621 has a similar API to the fully fledged Display Rendering Engine, but it’s only a subset as the TM1621 LCD displays don’t have a concept of individual pixels. In the lambda you’re passed a variable called it as with all other displays. In this case however, it is a TM1621 instance (see API Reference).

The most basic operation with the TM1621 is wiring a simple number to the screen as in the configuration example at the top of this page. But even though you’re passing in a string (here "0123"), ESPHome converts it into a representation that the TM1621 can understand.

Each of the three methods (print and printf) all optionally take a the line number (0 for first line and 1 for the second). This argument is 0 by default.

Also note that the . (dot) character is special because when ESPHome encounters it in the string the dot segment of the previous position will be enabled.

display:
  - platform: tm1621
    # ...
  lambda: |-
    it.printf(0, "%.1f", id(my_sensor1).state);
    it.display_celsius(true);
    it.printf(1, "%.1f", id(my_sensor2).state);
    it.display_humidity(true);

Please see Formatted Text for a quick introduction into the printf formatting rules.

Also we have five function to display or not some unites:
  • °C on the first line : display_celsius(bool)

  • °F on the first line : display_fahrenheit(bool)

  • %HR on the second line : display_humidity(bool)

  • V on the first line and A on the second line : display_voltage(bool)

  • kW/h on the first line and W on the second line : display_kwh(bool)

See Also