adafruit / Adafruit_CircuitPython_VL53L4CD

CircuitPython helper library for the VL53L4CD time of flight distance sensor.
MIT License
3 stars 6 forks source link

Runtime error: wrong sensor ID or type! #12

Open Tylersuard opened 1 year ago

Tylersuard commented 1 year ago
Traceback (most recent call last):
  File "code.py", line 10, in <module>
  File "adafruit_vl53l4cd.py", line 78, in __init__
RuntimeError: Wrong sensor ID or type!

I am using the correct sensor and it is plugged in and the light is on.

tekktrik commented 1 year ago

Can you please provide the code being used, as well as potentially a picture of the wiring setup?

Tylersuard commented 1 year ago

@tekktrik Thank you for the quick reply. The code I was using is just the example code:

import board
import adafruit_vl53l4cd

#i2c = board.I2C()  # uses board.SCL and board.SDA
i2c = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller

vl53 = adafruit_vl53l4cd.VL53L4CD(i2c)

# OPTIONAL: can set non-default values
vl53.inter_measurement = 0
vl53.timing_budget = 200

print("VL53L4CD Simple Test.")
print("--------------------")
model_id, module_type = vl53.model_info
print("Model ID: 0x{:0X}".format(model_id))
print("Module Type: 0x{:0X}".format(module_type))
print("Timing Budget: {}".format(vl53.timing_budget))
print("Inter-Measurement: {}".format(vl53.inter_measurement))
print("--------------------")

vl53.start_ranging()

while True:
    while not vl53.data_ready:
        pass
    vl53.clear_interrupt()
    print("Distance: {} cm".format(vl53.distance))

It always fails at: vl53 = adafruit_vl53l4cd.VL53L4CD(i2c)

This is a photo of my setup: It is just an ESP32-S3 plugged into the TOF laser sensor via a qwiic connector. IMG_3175

caternuson commented 1 year ago

Cross posted: https://forums.adafruit.com/viewtopic.php?t=201790

caternuson commented 1 year ago

OK, recreated on S3 (works on S2).

Adafruit CircuitPython 8.1.0 on 2023-05-22; Adafruit QT Py ESP32-S3 no psram with ESP32S3
>>> 
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 7, in <module>
  File "adafruit_vl53l4cd.py", line 78, in __init__
RuntimeError: Wrong sensor ID or type!

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.
Tylersuard commented 1 year ago

That is odd that this problem would occur specifically on S3 but not on S2. Thank you for helping.

jposada202020 commented 1 year ago

Just for reference, Another sensor that does not work with the S3 here: https://github.com/adafruit/circuitpython/issues/7923

caternuson commented 1 year ago

And a couple more: https://github.com/adafruit/circuitpython/issues/6311 https://github.com/adafruit/circuitpython/issues/8049

This looks like something S3 specific, still on going, and potentially in the underlying support software (ESP IDF)