LVGL twitches with Dallas DS18B20 temperature sensor

I’m trying to create a sauna control panel using an ESP32 display and LVGL. I’ve connected a dallas DS18B20 temperature sensor and have run into the problem that the display image twitches every time the sensor updates.

I have tried with JC8048W550 and 8048s070 display, different GPIOs and also separate power supplies for the display and temperature sensor and always with the same result.

Any tips how to solve this issue?


Additional info:
DS18B20 sensor is connected with this module.

Connection is:
5V power supply to the display and to the DS18B20 module, sensor to module,
GPIO13 to DAT on the module (also tried pins 17 and 18)

In YAML i have this which causes the screen to glitch every 5 seconds:

one_wire:
  - platform: gpio
    pin: 13

sensor:
  - platform: dallas_temp
    id: sauna_temperature
    name: Teplota
    update_interval: 5s
    on_value:
      - lvgl.indicator.update:
          id: temperature_needle
          value: !lambda return x * 10;
      - lvgl.label.update:
          id: temperature_text
          text:
            format: "%.1f°C"
            args: [ 'x' ]

Board and display settings YAML:

esphome:
  name: 5inch-display
  friendly_name: 5inch display
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.esp-idf.memory_type: qio_opi
    board_build.flash_mode: dio
    board_upload.maximum_ram_size: 524288

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 16MB
  partitions: "default_16MB.csv"
  framework:
    type: esp-idf
# Required to achieve sufficient PSRAM bandwidth
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
      CONFIG_ESP32S3_DATA_CACHE_64KB: y
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y

psram:
  mode: octal
  speed: 80MHz 

touchscreen:
  platform: gt911

display:
  - platform: rpi_dpi_rgb
    id: main_display
    color_order: RGB
    invert_colors: True
    update_interval: never
    auto_clear_enabled: false # takes 2.8 seconds to clear the display
    dimensions:
      width: 800
      height: 480
    de_pin: 40
    hsync_pin: 39
    vsync_pin: 41
    pclk_pin: 42
    pclk_frequency: 12MHz
    data_pins:
      red:
        - 45
        - 48
        - 47
        - 21
        - 14
      green:
        - 5
        - 6
        - 7
        - 15
        - 16
        - 4
      blue:
        - 8
        - 3
        - 46
        - 9
        - 1

For best support, post your yaml and wiring.

Thanks, I added more information

What ESPHome version are you using?

If that module has pullup to Vcc (5V), you are feeding 5V to your gpio pin.
Try powering DS-module at 3.3V, it has a voltage range from 3V to 5.5V so it should work.

ESPHome version is 2024.12.2

The problem persists when powering the module by 3.3V.

I actually started by powering the module by 3.3V at first, but then while searching for the cause of the problem I tried various things and then connected the module incorrectly to 5V.

Anyway, it’s good to know that the gpio pins only support 3.3 volts.

The twitching also persists when reducing lvgl to the minimal configuration

sensor:
  - platform: dallas_temp
    id: sauna_temperature
    name: Teplota
    update_interval: 5s

lvgl:

My guess is that the one wire component, which uses timing critical looping functions in IRAM, is hogging bus bandwidth so the RGB driver DMA is starved of data. That would cause the symptoms you describe.

1 Like

Hi Martin,

i have too the Guition JC8048W550.
I tryed with your .yaml - code but with no success, the display remains black. But Esphome works on the esp32, because i recive log-infos from the device…

Because i don’t know nothing about “default_16M.csv” i searched it in internet and found one, but i am not sure if it is the same like yours and if it is relevant to my problem.

Or maybe your .yaml-code you pasted here is not complete?

Strange is too, that the "touchscreen: - part isn’t acepted from the “esphome builder” so i commented it out.

Can you send me please your .yaml-code so i can test if i can get working the display with esphome?
The preinstalled example from Guition worked fine, so the display itself should be ok…

ok, this worked for me to see something on the display:

esphome:
  name: 5inch-display
  friendly_name: 5inch display
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.esp-idf.memory_type: qio_opi
    board_build.flash_mode: dio
    board_upload.maximum_ram_size: 524288

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 16MB
  framework:
    type: esp-idf
# Required to achieve sufficient PSRAM bandwidth
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
      CONFIG_ESP32S3_DATA_CACHE_64KB: y
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y

psram:
  mode: octal
  speed: 80MHz 

i2c:
  sda: 19
  scl: 20
  scan: true

output:
  - id: gpio_backlight_pwm
    platform: ledc
    pin: 2
    frequency: 1220

light:
  - id: backlight
    name: Backlight
    platform: monochromatic
    output: gpio_backlight_pwm
    restore_mode: ALWAYS_ON

display:
  - platform: rpi_dpi_rgb
    id: main_display
    color_order: RGB
    invert_colors: True
    update_interval: never
    auto_clear_enabled: false # takes 2.8 seconds to clear the display
    dimensions:
      width: 800
      height: 480
    de_pin: 40
    hsync_pin: 39
    vsync_pin: 41
    pclk_pin: 42
    pclk_frequency: 16MHz
    data_pins:
      red:
        - 45
        - 48
        - 47
        - 21
        - 14
      green:
        - 5
        - 6
        - 7
        - 15
        - 16
        - 4
      blue:
        - 8
        - 3
        - 46
        - 9
        - 1


lvgl:

touchscreen:
  platform: gt911
  address: 0x5D
  update_interval: 16ms

Hi Martin, did you ever solve this Dallas twitching problem?
I have the same issue with twitching / flickering screen LVGL graphics during temp update. I have tried on two different Waveshare ESP32 7” and 4.3” touch-screens. I have also tried different GPIO’s and reduced all code to bare minimum with no luck. It seems to be related to the DS18B20 and/or one_wire component in ESPhome. It has been like this for 5-6 months or longer across different ESPhome and LVGL updates.