Skip to content

Instantly share code, notes, and snippets.

@itmaybeokay
Last active December 11, 2025 11:10
Show Gist options
  • Select an option

  • Save itmaybeokay/bd5c7aa574e8ed517148cf9c4c267bdb to your computer and use it in GitHub Desktop.

Select an option

Save itmaybeokay/bd5c7aa574e8ed517148cf9c4c267bdb to your computer and use it in GitHub Desktop.
Waveshare ESP32-S3 4.3inch Touch LCD Development Board Type B, 800×480 - ESPhome YAML example
esphome:
name: panel
friendly_name: panel
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM"
board_build.arduino.memory_type: qio_opi
board_build.flash_mode: dio
board_upload.maximum_ram_size: 524288
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
CONFIG_ESP32S3_DATA_CACHE_64KB: y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
# Enable logging
logger:
i2c:
sda: GPIO08
scl: GPIO09
# scan: True
id: bus_a
ch422g:
- id: ch422g_hub
address: 0x24
# Of the CH422's twenty-four i2c addresses, 0x24 is the correct one to use in the setup here.
# Still, wow, that's a lot of i2c addresses.
# Enable Home Assistant API
api:
encryption:
key:
ota:
- platform: esphome
password:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Panel Fallback Hotspot"
password:
captive_portal:
psram:
mode: octal
speed: 80MHz
# Define display
display:
- platform: rpi_dpi_rgb
id: my_display
auto_clear_enabled: false
color_order: RGB
pclk_frequency: 16MHZ
dimensions:
width: 800
height: 480
de_pin:
number: 5
hsync_pin:
number: 46
ignore_strapping_warning: true
vsync_pin:
number: 3
ignore_strapping_warning: true
pclk_pin: 7
reset_pin:
ch422g: ch422g_hub
number: 3
enable_pin:
ch422g: ch422g_hub
number: 2
hsync_back_porch: 16
hsync_front_porch: 16
hsync_pulse_width: 8
vsync_back_porch: 16
vsync_front_porch: 16
vsync_pulse_width: 8
data_pins:
red:
- 1 #r3
- 2 #r4
- 42 #r5
- 41 #r6
- 40 #r7
blue:
- 14 #b3
- 38 #b4
- 18 #b5
- 17 #b6
- 10 #b7
green:
- 39 #g2
- 0 #g3
- 45 #g4
- 48 #g5
- 47 #g6
- 21 #g7
touchscreen:
platform: gt911
id: my_touch
# Uncomment below if you got the janky OTHER i2c address this time
#address: 0x14
# Probably fixed by adding reset_pin via CH422 though
interrupt_pin: GPIO4
# DEFINE RESET PIN for consistent i2c address selection
# CTP_RST is wired to IO1 of CH422G
reset_pin:
ch422g: ch422g_hub
number: 1
mode: OUTPUT
on_touch:
- lambda: |-
ESP_LOGI("Touch", "Touch detected at x=%d, y=%d", touch.x, touch.y);
# Define fonts
font:
- file: "gfonts://Roboto"
id: roboto24
size: 24
bpp: 4
- file: "gfonts://Roboto"
id: roboto18
size: 18
bpp: 4
binary_sensor:
- platform: homeassistant
id: demo_light_status
entity_id: light.demo
internal: true
on_state:
then:
- lambda: |-
if (id(demo_light_status).state) {
lv_obj_add_state(id(lv_button_demo_light), LV_STATE_CHECKED);
lv_label_set_text(id(demo_light_status_label), "On");
} else {
lv_obj_clear_state(id(lv_button_demo_light), LV_STATE_CHECKED);
lv_label_set_text(id(demo_light_status_label), "Off");
}
lvgl:
displays:
- my_display
touchscreens:
- my_touch
theme:
button:
bg_color: 0x333333
bg_grad_dir: VER
text_color: 0xFFFFFF
checked:
bg_color: 0xcc9900
text_color: 0x000000
bg_grad_color: 0x664d00
pressed:
border_color: 0xff6600
pages:
- id: main_page
layout:
type: flex
flex_flow: column_wrap
width: 100%
bg_color: 0x000000
bg_opa: cover
pad_all: 5
widgets:
- button:
checkable: true
id: lv_button_demo_light
width: 140
height: 150
widgets:
- label:
text_font: roboto24
text: "Demo\nLamp"
- label:
id: demo_light_status_label
text: "Off"
align: bottom_left
on_click:
then:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.demo
interval:
- interval: 20s
#startup_delay: 15s
then:
- lambda: |-
if (id(demo_light_status).state) {
lv_obj_add_state(id(lv_button_demo_light), LV_STATE_CHECKED);
lv_label_set_text(id(demo_light_status_label), "On");
} else {
lv_obj_clear_state(id(lv_button_demo_light), LV_STATE_CHECKED);
lv_label_set_text(id(demo_light_status_label), "Off");
}
@nottledim
Copy link

I gave up using touch because of this problem. It would be good if you can find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment