LCD Unit

Unit LCD is a 1.14 inch color LCD expansion screen unit. It adopts ST7789V2 drive scheme, the resolution is 135*240, and it supports RGB666 display (262,144 colors). The internal integration of ESP32-PICO control core (built-in firmware, display development is more convenient), support through I2C (addr: 0x3E) communication interface for control and firmware upgrades. The back of the screen is integrated with a magnetic design, which can easily adsorb the metal surface for fixing. The LCD screen extension is suitable for embedding in various instruments or control devices that need to display simple content as a display panel.

Support the following products:

LCDUnit

UiFlow2 Example

Draw Text

Open the cores3_lcd_example.m5f2 project in UiFlow2.

This example displays the text “LCD” on the screen.

UiFlow2 Code Block:

example.png

Example output:

None

MicroPython Example

Draw Text

This example displays the text “LCD” on the screen.

MicroPython Code Block:

 1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import os, sys, io
 6import M5
 7from M5 import *
 8from hardware import I2C
 9from hardware import Pin
10from unit import LCDUnit
11
12
13label0 = None
14label1 = None
15i2c0 = None
16lcd_0 = None
17
18
19def setup():
20    global label0, label1, i2c0, lcd_0
21
22    M5.begin()
23    Widgets.fillScreen(0x222222)
24    label0 = Widgets.Label("CoreS3", 127, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
25
26    i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
27    lcd_0 = LCDUnit(i2c0, 0x3E)
28    label1 = Widgets.Label("LCD", 48, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18, lcd_0)
29
30
31def loop():
32    global label0, label1, i2c0, lcd_0
33    M5.update()
34
35
36if __name__ == "__main__":
37    try:
38        setup()
39        while True:
40            loop()
41    except (Exception, KeyboardInterrupt) as e:
42        try:
43            from utility import print_error_msg
44
45            print_error_msg(e)
46        except ImportError:
47            print("please update to latest firmware")

Example output:

None

API

class LCDUnit

class unit.lcd.LCDUnit(i2c, address=62)

Bases: object

Initialize the LCD Unit.

Parameters:
  • i2c (I2C | PAHUBUnit) – The I2C bus the LCD Unit is connected to.

  • address (int) – The I2C address of the LCD Unit, default is 0x3E.

UiFlow2 Code Block:

init.png

MicroPython Code Block:

from unit import LCDUnit
lcd_0 = LCDUnit(i2c0, 0x3e)

LCDUnit class inherits Display class, See hardware.Display for more details.