I can’t get the PiicoDev VL53L1X Distance Sensor (PiicoDev Distance Sensor VL53L1X - Raspberry Pi Pico Guide - Tutorial Australia) to work with an Adafruit LTC4316 I2C Address Translator (Adafruit LTC4316 I2C Address Translator - Stemma QT / Qwiic | ADA5914 | Core Electronics Australia) with Python 3 on a Raspberry Pi Zero 2 W or a Raspberry Pi Pico. I’m using this translator so that I can have two of these sensors connected at the same time (they have a fixed I2C address of 0x29). It’s possible to change the device address by software, but a pin on the IC must be asserted while doing this which isn’t convenient with the PiicoDev module. I’m using the PiicoDev library, the device file is PiicoDev_VL53L1X.py.
With one device connected directly and one connected via the address translator (with the default switch settings which flips only address bit A6) the first sensor initialises at 0x29 but the second fails to initialise at 0x69 (0x29 XOR’d with 0100 0000 - but 6 inverted). The error I get is:
Traceback (most recent call last):
File “”, line 1, in
File “…/PiicoDev VL53L1X.py”, line 114, in init
raise RuntimeError(‘Failed to find expected ID register values. Check wiring!’)
RuntimeError: Failed to find expected ID register value
5. Check wiring!
The ID value being returned from the call to self.read_model_ID() is not the expected value of 0xEACC.
I made a copy of PiicoDev_VL53L1X.py from Github and added a print statement ahead of this test to see what the ID value is, plus also commenting out the raise exception line. Using this version shows that 0xEACC (60108) is returned without the translator but 0x0F0F (3855) is returned when the translator is inline. These patterns don’t seem relayed in an obvious way (inverted, byte swapped…) so perhaps a different register is being read?
PiicoDev_VL53L1X.read_model_ID() seems to be misbehaving when address bit 6 is inverted. I thought maybe the device would still work despite the incorrect ID but when I tested it with the modified library code and the code from the Raspberry Pi guide (PiicoDev Distance Sensor VL53L1X - Raspberry Pi Pico Guide - Tutorial Australia) the distance returned is fixed at 35209 mm. Looks like reading data is affected by address translation as well.
I switched the modules across to a Raspberry Pi Pico and tried the same code. Same result - works without the address translator but not with it:
Traceback (most recent call last):
- File “”, line 1, in *
- File “PiicoDev_VL53L1X.py”, line 115, in init*
RuntimeError: Failed to find expected ID register values. Check wiring!
I’ve connected the sensors in different ways and swapped around sensors and cables with no joy; there seems to be something amiss with the library code when the address translator is inline. I can’t find any sign in the device library code of the address being hard coded or calculated that might fall over with a translated address. I haven’t looked at the PiicoDev Unified code yet. I’m studying the code and the VL53L1X data sheet (https://www.st.com/resource/en/datasheet/vl53l1x.pdf)) but perhaps somebody more familiar with the code and device can spot the problem.
I will be using PiicoDev 3 axis accelerometer modules (PiicoDev 3-Axis Accelerometer LIS3DH | Core Electronics Australia) with the address translator as well. These aren’t working with the address translator either but I have not investigated these yet.
I also have an Adafruit PCA9548 8-Channel STEMMA QT / Qwiic I2C Multiplexer (Overview | Adafruit PCA9548 8-Channel STEMMA QT / Qwiic I2C Multiplexer | Adafruit Learning System) which works differently, which I haven’t tried yet. I see that the VL53L1X uses different addresses for read and write (address LSB is different) so this device might not work.