VL53L0X TOF sensor on "is marked FAILED" on ESPhome

Hello,
This is a desperate call for help after a day unsucessfully trying to make it work!

  • I first tried with an esp8266, connecting directly (no external pulllup) the sensor to I2C bus removing everything I had on other GPIOs.

  • I tried with a different VL53L0X sensor. It didn’t work.

  • I installed an ESP32 board and I tried with a 3rd fresh VL53L0X.

  • The VL53L0X is supposed to be powered on 3.3v. I tried also with 5v.

In all cases I get the same error: “Component vl53l0x.sensor is marked FAILED

I spent all day without any success, so any help would be moooore than welcome!

This is the full log:

INFO ESPHome 2024.5.5
INFO Reading configuration /config/esphome/led-escalier32.yaml...
INFO Starting log output from 192.168.20.247 using esphome API
INFO Successfully connected to led-escalier32 @ 192.168.20.247 in 0.160s
INFO Successful handshake with led-escalier32 @ 192.168.20.247 in 0.150s
[16:44:22][I][app:100]: ESPHome version 2024.5.5 compiled on Jun 8 2024, 16:31:05
[16:44:22][C][wifi:580]: WiFi:
[16:44:22][C][wifi:408]: Local MAC: B0:A7:32:2F:CE:94
[16:44:22][C][wifi:413]: SSID: 'Guaguanco'[redacted]
[16:44:22][C][wifi:416]: IP Address: 192.168.20.247
[16:44:22][C][wifi:420]: BSSID: B2:8B:A9:D4:13:CA[redacted]
[16:44:22][C][wifi:421]: Hostname: 'led-escalier32'
[16:44:22][C][wifi:423]: Signal strength: -53 dB ▂▄▆█
[16:44:22][C][wifi:427]: Channel: 13
[16:44:22][C][wifi:428]: Subnet: 255.255.255.0
[16:44:22][C][wifi:429]: Gateway: 192.168.20.1
[16:44:22][C][wifi:430]: DNS1: 8.8.8.8
[16:44:22][C][wifi:431]: DNS2: 8.8.4.4
[16:44:23][C][logger:185]: Logger:
[16:44:23][C][logger:186]: Level: DEBUG
[16:44:23][C][logger:188]: Log Baud Rate: 115200
[16:44:23][C][logger:189]: Hardware UART: UART0
[16:44:23][C][i2c.arduino:071]: I2C Bus:
[16:44:23][C][i2c.arduino:072]: SDA Pin: GPIO21
[16:44:23][C][i2c.arduino:073]: SCL Pin: GPIO22
[16:44:23][C][i2c.arduino:074]: Frequency: 50000 Hz
[16:44:23][C][i2c.arduino:086]: Recovery: bus successfully recovered
[16:44:23][I][i2c.arduino:096]: Results from i2c bus scan:
[16:44:23][I][i2c.arduino:102]: Found i2c device at address 0x29
[16:44:23][C][vl53l0x:024]: VL53L0X 'VL53L0x Distance'
[16:44:23][C][vl53l0x:024]: Unit of Measurement: 'm'
[16:44:23][C][vl53l0x:024]: Accuracy Decimals: 2
[16:44:23][C][vl53l0x:024]: Icon: 'mdi:arrow-expand-vertical'
[16:44:23][C][vl53l0x:025]: Update Interval: 0.5s
[16:44:23][C][vl53l0x:026]: Address: 0x29
[16:44:23][C][vl53l0x:030]: Timeout: 10000us
[16:44:23][E][component:082]: Component vl53l0x.sensor is marked FAILED
[16:44:23][C][captive_portal:088]: Captive Portal:
[16:44:23][C][mdns:115]: mDNS:
[16:44:23][C][mdns:116]: Hostname: led-escalier32
[16:44:23][C][ota:096]: Over-The-Air Updates:
[16:44:23][C][ota:097]: Address: led-escalier32.local:3232
[16:44:23][C][ota:100]: Using Password.
[16:44:23][C][ota:103]: OTA version: 2.
[16:44:23][C][api:139]: API Server:
[16:44:23][C][api:140]: Address: led-escalier32.local:6053
[16:44:23][C][api:142]: Using noise encryption: YES
[16:48:50][I][ota:117]: Boot seems successful, resetting boot loop counter.
[16:48:50][D][esp32.preferences:114]: Saving 1 preferences to flash...
[16:48:50][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

And this is my config on the ESP32:

esphome:
  name: led-escalier32
  friendly_name: LED Escalier32

esp32:
  board: esp32dev
#  framework:
#    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx="

ota:
  password: "xxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Led-Escalier32 Fallback Hotspot"
    password: "xxx"

captive_portal:


i2c:
#  sda: GPIO4
#  scl: GPIO5
  scan: true


sensor:

  - platform: vl53l0x
    name: "VL53L0x Distance"
    address: 0x29
    long_range: true
#   # timeout: 200us
    update_interval: 500ms
    unit_of_measurement: "m"
    signal_rate_limit: 1
    internal: true

And finally my config on the esp8266:

esphome:
  name: leds-escalier
  friendly_name: LEDs Escalier
   
esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx="

ota:
  password: "xxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Leds-Escalier Fallback Hotspot"
    password: "xxx"

captive_portal:

# Example configuration entry for ESP32
i2c:
#  sda: GPIO4
#  scl: GPIO5
  scan: true


sensor:
  - platform: vl53l0x
    name: "VL53L0x Distance"
    address: 0x29
    long_range: true
#   # timeout: 200us
#   update_interval: 500ms
    unit_of_measurement: "m"

Use the best quality power supply you have on hand (for phone etc), and then see if any of these tricks help.