Waveshare display glitch after backlight turn-on

Hi everyone, I own a 5-inch Waveshare ESP32-S3-Touch-LCD display (https://www.waveshare.com/esp32-s3-touch-lcd-5.htm).

I managed to successfully configure my display and started creating a project to monitor some sensors and control some actuators.

I’m trying to disable the display backlight using h422g. I managed to get it to work, so the backlight turns off, but when I turn it back on, I get a white ring very close to the edge of the display. The ring gets larger the longer the backlight is off.

I wrote to Waveshare support explaining the problem, and they replied:

The backlight can be turned off, but the RGB signal cannot be stopped. If it is stopped for too long, a white circle will appear.

Honestly, I don’t know how to fix it, despite the instructions.

I report below my configuration and I ask you if you have had similar experiences (in this case how you solved them) or if you have any advice to give me.

esphome:
  name: meter-display
  friendly_name: Meter Display
  platformio_options: 
    build_flags: 
      - "-DBOARD_HAS_PSRAM"
      - "-DLV_CONF_INCLUDE_SIMPLE"
      - "-DLV_USE_CHART=1"
    board_build.esp-idf.memory_type: qio_opi
    board_build.flash_mode: dio
    board_build.partitions: /config/esphome/partizioni_8mb.csv

esp32:
  board: esp32-s3-devkitc-1
  flash_size: 8MB
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_FREERTOS_HZ: "1000"
      CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240: y
      CONFIG_SPIRAM_MODE_OCT: y
      CONFIG_IDF_EXPERIMENTAL_FEATURES: y
      CONFIG_SPIRAM_SPEED_120M: y
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y
      CONFIG_ESP32S3_DATA_CACHE_64KB: y
      CONFIG_COMPILER_OPTIMIZATION_PERF: y

logger:

time:
  - platform: homeassistant
    id: homeassistant_time

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

psram:
  mode: octal
  speed: 80MHz

i2c:
  sda: GPIO8
  scl: GPIO9
  scan: true
  id: bus_a

touchscreen:
  platform: gt911
  id: main_touch
  interrupt_pin: GPIO4
  reset_pin:
    ch422g: ch422g_hub
    number: 1
  on_touch:
    - lambda: |-
        ESP_LOGI("Touch", "Touch detected at x=%d, y=%d", touch.x, touch.y);

        // Se la retroilluminazione è spenta, la riaccendiamo
        if (!id(backlight_switch).state) {
          id(backlight_switch).turn_on();
          ESP_LOGI("Backlight", "Backlight turned ON due to touch");

          // Abilita auto-off se necessario
          id(auto_off_enabled) = true;
          id(auto_off_timeout) = 60;  // qui puoi usare il valore dello slider se vuoi
        }

display:
  - platform: rpi_dpi_rgb
    id: main_display
    auto_clear_enabled: false
    show_test_card: false
    update_interval: never
    color_order: RGB
    pclk_frequency: 16MHz
    dimensions:
      width: 1024
      height: 600
    reset_pin:
      ch422g: ch422g_hub
      number: 3
    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
    hsync_back_porch: 40
    hsync_front_porch: 220
    hsync_pulse_width: 30
    vsync_back_porch: 8
    vsync_front_porch: 4
    vsync_pulse_width: 4
    data_pins:
      red:
        - 1
        - 2
        - 42
        - 41
        - 40
      blue:
        - 14
        - 38
        - 18
        - 17
        - 10
      green:
        - 39
        - 0
        - 45
        - 48
        - 47
        - 21


font:
  - !include fonts/montserrat_16_special.yaml
  - !include fonts/montserrat_18_special.yaml
  - !include fonts/montserrat_20_special.yaml

ch422g:
  - id: ch422g_hub

switch:
  - platform: homeassistant
    name: "Madia"
    entity_id: switch.madia
    id: ha_madia

  - platform: gpio
    name: backlight switch
    id: backlight_switch
    pin:
      ch422g: ch422g_hub
      number: 2
      mode:
        output: true
      inverted: False
    internal: true
    restore_mode: ALWAYS_ON

sensor:
  - !include sensors/pm1.yaml
  - !include sensors/pm25.yaml
  - !include sensors/pm4.yaml
  - !include sensors/pm10.yaml
  - !include sensors/co2.yaml
  - !include sensors/voc.yaml
  - !include sensors/nox.yaml
  - !include sensors/temp.yaml
  - !include sensors/humidity.yaml

binary_sensor:
  - !include binary_sensors/bagno_finestrato.yaml

lvgl:
  displays: main_display
  buffer_size: 100%
  pages:
    - !include pages/page1_homepage.yaml
    - !include pages/page0_pagesettings.yaml
    - !include pages/page2_roomselect.yaml
    - !include pages/page3_functionselect_zg.yaml
    - !include pages/page4_functionselect_cdl.yaml
    - !include pages/page5_functionselect_cd.yaml
    - !include pages/page6_functionselect_cs.yaml
    - !include pages/page7_functionselect_bc.yaml
    - !include pages/page8_functionselect_bf.yaml
    - !include pages/page9_functionselect_r.yaml
    - !include pages/page10_monitor_zg.yaml
    - !include pages/page17_control_zg.yaml
    - !include pages/page24_graphic_zg.yaml

globals:
  - id: co2_min
    type: float
    initial_value: '10000'
  - id: co2_max
    type: float
    initial_value: '0'
  - id: co2_sum
    type: float
    initial_value: '0'
  - id: co2_count
    type: int
    initial_value: '0'
  - id: chart
    type: lv_obj_t*
    restore_value: no
  - id: chart_series
    type: lv_chart_series_t*
    restore_value: no
  - id: selected_sensor
    type: int
    restore_value: no
    initial_value: '4'

  - id: history_pm1
    type: float[60]
  - id: history_pm25
    type: float[60]
  - id: history_pm4
    type: float[60]
  - id: history_pm10
    type: float[60]
  - id: history_co2
    type: float[60]
  - id: history_voc
    type: float[60]
  - id: history_nox
    type: float[60]
  - id: history_temp
    type: float[60]
  - id: history_humidity
    type: float[60]
  - id: history_idx
    type: int[9]

  - id: auto_off_enabled
    type: bool
    restore_value: true
    initial_value: 'true'

  - id: auto_off_timeout
    type: int
    restore_value: yes
    initial_value: "60"

  - id: last_touch
    type: int
    restore_value: no
    initial_value: '0'

interval:
  - !include intervals/update_clock.yaml
  - !include intervals/update_sensors.yaml
  - !include intervals/initialize.yaml

Thank you very much in advance for any advice

Regards
Matteo

The reply from Waveshare probably means that you can turn the backlight off, but you can not turn the signal for the RGB values for the pixels off.
The problem is that the ch422g do turn off both the backlight and the RGB signal.

Hi,
thank you for your answer. So is there a way to only turn the backliht off without turning off also the RGB signal? Can I make it with ch422g?

Tahnk You

I do not know, sorry.

I just had an idea about what Wave share meant and did a search for keywords based on that, which is where I found another old post with the same issue.
Sadly no solution was made in that post.

@Scarpetta3 did you get a solution to the problem? I am having the same issue with the same LCD and have tried may things but no solution

Hi,
No solution till now and nobody seems to add something to the situation to get to a solution.

What I understand is that you can arrive to the same goal (if we want to tell all the truth is more because you can set a precise backlight level and not only on/off it) by making some sort of soldering from a PWM to a GPIO but I really don’t know how to do it.

If u find a solution or if u have more information about what I describe above (PWM), please update me/us.

Thank you
Regards
Matteo

Since I don’t feel up to the task of re-soldering anything on the board I resorted to just rendering a black box on top of the entire display which I hide initially, display when on_idle is triggered and hide again when on_resume is triggered. If you wanna try this for yourself: At least for me I could only get this to work if I don’t call lvgl.pause in the same process. There may be a way to delay the pausing until the box has actually been rendered, but I couldn’t get that to work.

This may not be the solution you are after but I’m assuming that the screen burning in is a much higher risk than the backlight burning out, so I can live with the tradeoff. If your screen is situated in a way that the backlighting constitutes an annoyance it will probably not suffice.