ESPHome GUI component using LVGL

In my experience when the screen seems to be functioning but is blank, it’s normally the backlight, just make sure there’s no pin or config missing to turn on the backlight

I believe it’s labelled as TFT_RS on that board. You’ll also want to specify CS and RESET. You’ll need a schematic or sample code to figure out which pins they are. And you’ll need to turn on the backlight with the TFT_BL pin - a monochromatic light component will allow you to adjust the brightness.

Thanks for the tips.

Based on this wiring diagram for the TFT:
image

I figured the RS/DC is IO2 and CS is IO15.

There’s that pin labeled RESET, but it seems to be hard-wired. Is that normal?

Regarding the BACKLIGHT, the screen seems to be lit up very bright (white). So at least I think it’s on by default.

There appears to be sample code here along with the wiring diagram I got here. (After translation, it says RESET is the LCD reset signal line. Because the GPIO on the start board is tight, it is connected to the RESET line of the system. Similarly, BL is the backlight control line of the LCD, which is also directly connected to 3.3V. – but I don’t know if that’s correct, or lost in translation. At least it would explain the backlight being always on.)

However, the sample code is very frustrating, because it uses macros like PIN_NUM_RST, bit the headers that define those constants are not available – or at least I couldn’t figure out how to get them, even after having Google translate the page from Chinese.

Any suggestions?

For those interested in working with LVGL, I’ve successfully configured it using the following hardware setup:

Microcontroller: Lolin D32 PRO
Display: TFT 2.4 Touch Shield
TFT Driver: ILI9341
Touch Controller: XPT2046

Also notice the framework, not esp-idf but arduino did the trick for me.

esphome:
  name: esp-display-lolin
  friendly_name: ESP Display Lolin
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"

esp32:
  board: lolin_d32_pro
  framework:
    type: arduino

external_components:
 - source: github://clydebarrow/esphome@lvgl
   components: [ lvgl ] 

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key:  !secret esphome_api

ota:
  - platform: esphome
    password: !secret esphome_ota

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
    
web_server:
  local: true

captive_portal:

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_gray
    red: 50%
    green: 50%
    blue: 50%
  - id: my_black
    red: 0%
    green: 0%
    blue: 0%
  - id: my_white
    red: 100%
    green: 100%
    blue: 100%

font:
  - file: "arial.ttf"
    id: arial_48
    size: 48
  - file: "arial.ttf"
    id: arial_36
    size: 36
  - file: "arial.ttf"
    id: arial_24
    size: 24
  - file: "arial.ttf"
    id: arial_12
    size: 12

time:
  - platform: homeassistant
    id: esptime

sensor:
  - platform: homeassistant
    id: inside_temperature
    entity_id: sensor.gw2000a_indoor_temperature
    internal: true

  - platform: homeassistant
    id: outside_temperature
    entity_id: sensor.gw2000a_temperature_1
    internal: true
    
  - platform: wifi_signal
    name: "WiFi Signal Strength"
    update_interval: 60s

spi:
 clk_pin: 18 
 mosi_pin: 23 
 miso_pin: 19

touchscreen:
  platform: xpt2046
  id: touch_key1
  cs_pin: 12
  update_interval: 50ms
  calibration:
    x_min: 281
    x_max: 3848
    y_min: 347
    y_max: 3878
  transform:
    mirror_x: false
    mirror_y: false
    swap_xy: false
            
lvgl:
  displays:
    - tft_ha_test
  pages:
    - id: main_page
      widgets:
        - label:
            align: CENTER
            text: 'Hello World!'
            
display:
  - platform: ili9xxx
    model: ili9341
    cs_pin: 14
    dc_pin: 27
    reset_pin: 33
    rotation: 90
    auto_clear_enabled: false
    invert_colors: false
    show_test_card: false
    id: tft_ha_test