Skip to content

Instantly share code, notes, and snippets.

@clydebarrow
Created November 20, 2024 23:46
Show Gist options
  • Save clydebarrow/2bb1472f5185dd0a39f84988a54f93e6 to your computer and use it in GitHub Desktop.
Save clydebarrow/2bb1472f5185dd0a39f84988a54f93e6 to your computer and use it in GitHub Desktop.
Sample ESPHome config for Waveshare 7 ESP32 Display
# For Waveshare 7" ESP32 board.
substitutions:
friendly_name: Waveshare 7
esphome:
name: wave-7
friendly_name: ${friendly_name}
platformio_options:
build_unflags: -Werror=all
board_build.flash_mode: dio
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
platform_version: 6.8.1
version: 5.3.0
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
api:
encryption:
key: !secret encryption_key
logger:
hardware_uart: UART0
wifi: !include wifi.yaml
ota:
platform: esphome
password: !secret ota_password
ch422g:
psram:
mode: octal
speed: 80MHz
output:
- platform: ledc
id: backlight_output
pin: 13
frequency: 1220Hz
inverted: true
# Note: this requires a hardware modification to work - GPIO 13 must be connected to the backlight PWM pad.
light:
- platform: monochromatic
output: backlight_output
name: LCD Backlight
id: lcd_backlight
restore_mode: ALWAYS_ON
default_transition_length: 0s
gamma_correct: 1.8
effects:
- pulse:
i2c:
sda: 8
scl: 9
frequency: 400kHz
scan: false
id: bus_a
button:
- platform: safe_mode
name: Safe Mode Boot
entity_category: diagnostic
touchscreen:
- platform: gt911
address: 0x5D
id: my_touchscreen
interrupt_pin: 4
reset_pin:
ch422g:
number: 1
display:
- platform: rpi_dpi_rgb
id: rpi_disp
#update_interval: never
#rotation: 90
auto_clear_enabled: false
color_order: RGB
pclk_frequency: 16MHz
dimensions:
width: 800
height: 480
reset_pin:
ch422g:
number: 3
enable_pin:
ch422g:
number: 2
de_pin:
number: 5
hsync_pin:
number: 46
ignore_strapping_warning: true
vsync_pin:
number: 3
ignore_strapping_warning: true
pclk_pin: 7
pclk_inverted: true
# 7" 800x480 params
hsync_back_porch: 8
hsync_front_porch: 8
hsync_pulse_width: 4
vsync_back_porch: 16
vsync_front_porch: 16
vsync_pulse_width: 4
# 5" 1024x600 params
# hsync_back_porch: 188
# hsync_front_porch: 44
# hsync_pulse_width: 88
# vsync_back_porch: 16
# vsync_front_porch: 3
# vsync_pulse_width: 6
# 4.3" 800x480 params
# hsync_back_porch: 8
# hsync_front_porch: 8
# hsync_pulse_width: 4
# vsync_back_porch: 16
# vsync_front_porch: 16
# vsync_pulse_width: 4
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
lvgl:
@bwze
Copy link

bwze commented Apr 10, 2025

I've altered my config file to use GPIO11 on the ESP32 and soldered a wire from GPIO11 to the solder pad. I also added a 30K resisitor at, what I assume to be, R7 (lower right in your image).

After flashing, the screen will turn off but the device will reboot if I try to turn it on again.

Here is my code: https://pastebin.com/ifPc6U2X

@clydebarrow
Copy link
Author

It works for me, but you commented out important bits, like the inverted setting on the output. Also, you will need to replace R6 (currently 0R, next to R7) with another value - I used 3K3 but 2K7 might be better. And change the light gamma to 1.0.

@bwze
Copy link

bwze commented Apr 10, 2025

That did it @clydebarrow .....thanks. Backlight LED is now responding correctly.

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