pdf-icon

Unit LCD

SKU:U120

Description

Unit LCD is a 1.14-inch color LCD expansion screen unit. It uses the ST7789V2 driver with a resolution of 135 x 240 and supports RGB666 display (262,144 colors). It integrates an ESP32-PICO control core (with built-in firmware, making display development more convenient) and supports control and firmware upgrades via the I2C (addr: 0x3E) communication interface. The back of the screen features a magnetic design, allowing it to easily attach to metal surfaces for fixation. This LCD expansion is suitable for embedding into various instruments or control devices that require simple content display.

Features

  • 1.14-inch color LCD display panel
  • I2C communication interface
  • Viewing angle: Full viewing angle
  • Magnetic back design
  • Supports I2C firmware upgrade

Includes

  • 1 x Unit LCD
  • 1 x HY2.0-4P Grove cable (20cm)

Applications

  • Information display

Specifications

Specification Parameter
Screen Driver IC ST7789V2
Operating Current 45.7mA
Communication Interface I2C address: 0x3E
Display Size 1.14 inch
Pixel Pitch 0.1101 (H) x 0.1038 (V)mm
Resolution 135 x 240
Viewing Angle Full viewing angle
Operating Temperature 0 ~ 60°C
Net Weight 8.5g
Gross Weight 20g
Product Dimensions 48 x 24 x 8mm
Package Dimensions 67 x 52 x 12.5mm
Housing Material Plastic (PC)

Schematics

PinMap

Unit LCD

HY2.0-4P Black Red Yellow White
PORT.A GND 5V SDA SCL

Model Size

Datasheets

Softwares

Arduino

#include <M5UnitLCD.h>

M5UnitLCD display;

M5Canvas canvas(&display);

static constexpr char text[] = "Hello world ! こんにちは世界! this is long long string sample. 寿限無、寿限無、五劫の擦り切れ、海砂利水魚の、水行末・雲来末・風来末、喰う寝る処に住む処、藪ら柑子の藪柑子、パイポ・パイポ・パイポのシューリンガン、シューリンガンのグーリンダイ、グーリンダイのポンポコピーのポンポコナの、長久命の長助";
static constexpr size_t textlen = sizeof(text) / sizeof(text[0]);
int textpos = 0;
int scrollstep = 2;

void setup(void) 
{
  display.init();
  display.setRotation(2);
  canvas.setColorDepth(1); // mono color
  canvas.setFont(&fonts::lgfxJapanMinchoP_32);
  canvas.setTextWrap(false);
  canvas.setTextSize(2);
  canvas.createSprite(display.width() + 64, 72);
}

void loop(void)
{
  int32_t cursor_x = canvas.getCursorX()-scrollstep;
  if (cursor_x <= 0)
  {
    textpos = 0;
    cursor_x = display.width();
  }

  canvas.setCursor(cursor_x, 0);
  canvas.scroll(-scrollstep, 0);
  while (textpos < textlen && cursor_x <= display.width())
  {
    canvas.print(text[textpos++]);
    cursor_x = canvas.getCursorX();
  }
  display.waitDisplay();
  canvas.pushSprite(&display, 0, (display.height()-canvas.height()) >> 1);
}

Internal Firmware

Protocol

About Unit LCD

  • Unit LCD is an I2C unit with ESP32 and ST7789V2.
  • It has an IPS panel with a resolution of 135 x 240.
  • The number of displayable colors is 262,144 colors in RGB666, which is the specification of ST7789V2.
  • ESP32 is responsible for I2C communication and draws the frame buffer in memory based on the received content.
  • The content of the frame buffer in ESP32 memory is reflected in ST7789V2 through DMA transfer via SPI communication.
  • It is represented by 16,777,216 colors in RGB888 on the frame buffer.

About I2C Communication

  • You can use I2C communication to send commands and receive data to/from the Unit LCD.
  • The maximum communication speed for I2C communication is 400kHz.
  • The initial value of the 7-bit I2C address is 0x3E. It can be changed using the CHANGE_ADDR command.
  • The number of bytes required to send depends on the command. Some commands complete within 1 byte, while others require 7 bytes. There are also commands of indefinite length that do not end until communication stops.
  • If an I2C communication STOP or RESTART occurs during command transmission, the interrupted command will not be processed. It must be transmitted uninterrupted in a single transmission sequence until the end.
  • After sending a fixed-length command, you can send another command continuously.
  • After sending an indefinite-length command, you must stop I2C communication to indicate the end of the command.
  • If a NOP command or an undefined command is sent, the communication content will be ignored until I2C communication stops.
  • Since the I2C communication unit and the drawing processing unit operate in parallel, I2C communication can be performed even during drawing processing.
  • The I2C communication content is stored in the command buffer in ESP32 memory, and the drawing processing unit processes it sequentially.
  • You should use the READ_BUFCOUNT command to check the remaining amount of the buffer, as sending a large amount of heavy processing, such as extensive filling or range copying, may overflow the buffer.

About Drawing

  • You can draw a rectangle by using FILLRECT to fill any area with a single color.
  • If you want to draw only one pixel, you can use DRAWPIXEL instead of FILLRECT.
  • If you use a command that omits the foreground color, the last used color will be used.
  • You can specify the drawing range using CASET and RASET and send image data using the WRITE_RAW command.
  • You can use WRITE_RLE instead of WRITE_RAW to send run-length compressed image data.

Command List

※ Undefined commands are treated as no-operation instructions.

hex len command description send params
0x00 1-∞ NOP Do nothing until communication stops [0] 0x00
[1-∞] Ignored value
0x20 1 INVOFF Disable color inversion [0] 0x20
0x21 1 INVON Enable color inversion [0] 0x21
0x22 2 BRIGHTNESS Backlight brightness setting
0:Off-255:Full lights
[0] 0x22
[1] Brightness(0-255)
0x23 7 COPYRECT Rectangle range copy [0] 0x23
[1] Copy source X_Left
[2] Copy source Y_Top
[3] Copy source X_Right
[4] Copy source Y_Bottom
[5] Copy destination X_Left
[6] Copy destination Y_Top
0x2A 3 CASET X direction range selection [0] 0x2A
[1] X_Left
[2] X_Right
0x2B 3 RASET Y direction range selection [0] 0x2B
[1] Y_Top
[2] Y_Bottom
0x36 2 ROTATE Set drawing direction
0:Normal / 1:90° / 2:180° / 3:270°
4-7:flips 0-3 upside down
[0] 0x36
[1] Setting value (0-7)
0x38 2 SET_POWER Operating speed setting
(power consumption setting)
0:Low speed / 1:Normal / 2:High speed
[0] 0x38
[1] Setting value (0-2)
0x39 2 SET_SLEEP LCD panel sleep setting
0:wake up / 1:sleep
[0] 0x39
[1] Setting value (0-1)
0x41 2-∞ WRITE_RAW_8 Write image RGB332 [0] 0x41
[1] RGB332
until [1] communication STOP.
0x42 3-∞ WRITE_RAW_16 Write image RGB565 [0] 0x42
[1-2] RGB565
until [1-2] communication STOP.
0x43 4-∞ WRITE_RAW_24 Write image RGB888 [0] 0x43
[1-3] RGB888
until [1-3] communication STOP.
0x44 5-∞ WRITE_RAW_32 Write image ARGB8888 [0] 0x44
[1-4] ARGB8888
until [1-4] communication STOP.
0x45 2-∞ WRITE_RAW_A Write image A8
only alpha channel.
Use the last used drawing color.
[0] 0x45
[1] A8
until [1] communication STOP.
0x49 3-∞ WRITE_RLE_8 Write RLE image RGB332 [0] 0x49
[1-∞] RLE Data
0x4A 4-∞ WRITE_RLE_16 Write RLE image RGB565 [0] 0x4A
[1-∞] RLE Data
0x4B 5-∞ WRITE_RLE_24 Write RLE image RGB888 [0] 0x4B
[1-∞] RLE Data
0x4C 6-∞ WRITE_RLE_32 Write RLE image ARGB8888 [0] 0x4C
[1-∞] RLE Data
0x4D 3-∞ WRITE_RLE_A Draw RLE image A8
only alpha channel.
Use the last used drawing color.
[0] 0x4D
[1-∞] RLE Data
0x50 1 RAM_FILL Fill the selection with the last used drawing color [0] 0x50
0x51 2 SET_COLOR_8 Specify drawing color with RGB332 [0] 0x51
[1] RGB332
0x52 3 SET_COLOR_16 Specify drawing color with RGB565 [0] 0x52
[1-2] RGB565
0x53 4 SET_COLOR_24 Specify drawing color with RGB888 [0] 0x53
[1-3] RGB888
0x54 5 SET_COLOR_32 Specify drawing color with ARGB8888 [0] 0x54
[1-4] ARGB8888
0x60 3 DRAWPIXEL Draw a single point
Use the stored drawing color
[0] 0x60
[1] X
[2] Y
0x61 4 DRAWPIXEL_8 Draw a single point
RGB332 1Byte for drawing color specification
[0] 0x61
[1] X
[2] Y
[3] RGB332
0x62 5 DRAWPIXEL_16 Draw a single point
RGB565 2Byte for drawing color specification
[0] 0x62
[1] X
[2] Y
[3-4] RGB565
0x63 6 DRAWPIXEL_24 Draw a single point
RGB888 3Byte for drawing color specification
[0] 0x63
[1] X
[2] Y
[3-5] RGB888
0x64 7 DRAWPIXEL_32 Draw a single point
ARGB8888 4Byte for drawing color specification
Transparent composition with existing drawing content
[0] 0x64
[1] X
[2] Y
[3-6] ARGB8888
0x68 5 FILLRECT Fill rectangle
Use the stored drawing color
[0] 0x68
[1] X_Left
[2] Y_Top
[3] X_Right
[4] Y_Bottom
0x69 6 FILLRECT_8 Fill rectangle
RGB332 1Byte for drawing color specification
[0] 0x69
[1] X_Left
[2] Y_Top
[3] X_Right
[4] Y_Bottom
[5] RGB332
0x6A 7 FILLRECT_16 Fill rectangle
RGB565 2Byte for drawing color specification
[0] 0x6A
[1] X_Left
[2] Y_Top
[3] X_Right
[4] Y_Bottom
[5-6] RGB565
0x6B 8 FILLRECT_24 Fill rectangle
RGB888 3Byte for drawing color specification
[0] 0x6B
[1] X_Left
[2] Y_Top
[3] X_Right
[4] Y_Bottom
[5-7] RGB888
0x6C 9 FILLRECT_32 Fill rectangle
ARGB8888 4Byte for drawing color specification
Transparent composition with existing drawing content
[0] 0x6C
[1] X_Left
[2] Y_Top
[3] X_Right
[4] Y_Bottom
[5-8] ARGB8888
0xA0 4 CHANGE_ADDR I2C address change
Use [2] to specify the bit-inverted value of [1].
[0] 0xA0
[1] new I2C address.
[2] Bit[1] inverted
[3] 0xA0

Command List (Readable Commands)

| hex | len | command | description | return