Multiple Pimoroni VL53L1X sensors

How can I use multiple sensors of this type on the same raspberry pi? I can’t use Breakout Garden (https://shop.pimoroni.com/products/breakout-garden-hat) because I have to position them in a specific way.
I read about the change-address.py script. Do I have to use that to change address? And how do I connect both of them on the GPIO pins of the raspberry pi?
Thank you

i2c is a shared bus, you can have multiple devices as long as no two devices have the same address. That will happen if you connect two VL53L1X sensors to the one i2c bus that are at the factory settings.
Too get around this most of the Breakout Garden breakouts have a jumper on the back to change its i2c address. You do that to one of them and your good to go.
On that breakout it looks like you run the change-address.py script on “one” of them. Once you do that they will each have a different address and work on the same i2c bus.
Once you have changed the i2c address on one of them you just wire them up in parallel to i2c and power. You’ll have to edit the example and or your py file for two sensors.

What I have done on a couple of my setups is add a Proto Hat and some male headers for my i2c breakouts. Then use female to female jumper wires to connect them to the Proto Hat.

I never used the change-address.py script (https://github.com/pimoroni/vl53l1x-python/blob/master/examples/change-address.py), mine was just an idea. Does this script change the address permanently or does it have to be run at every start?
If it were final, I would have solved it.
Although I don’t know how to connect two sensors at the same time.

I assume its run once to change it. Then run it again if you want to change it back.
If you run i2cdetect -y 1 and take note of its address.
Then run the change-address.py on one sensor, change it, and reboot.
Then run i2c detect -y 1 again. If it has the new address its a only have to run once deal.
To hook up the two sensors you just wire them both to the same GPIO pins.
SDA > SDA >SDA, SCL > SCL> SCL. I would only hookup the INT pin if you have to. And use two different GPIO, a different GPIO for each sensors INT pin.

1 Like

The error is likely because its looking for the sensor at its old address. You have to edit one or two lines in the PY file telling it the new address.
For example in this line
tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29)
you have to change the 0x29 to the new address.

Thank you!!! I’ll try!!! :)

Hi, one question, on the VL53L1X O couldn’t find a jumper to change the I2C address. On the backside it’s only print on one address 0x29 (default). So is there really a jumper (one the BME680 theres is on alsp printed 2 I2C addresses).
So, if I want to use 2 VL53L1X Tofs, (as I understand the mail thread), I only have to run the sricpt once to change the address of one of my ToVs from 29 to 33?.
My thx

Peter

Hi,

did you have it up and running. I cascaded 2 ToFs and connected it as described above. Before I ran the change adress script. But I only see one I2C address 29 or 33. Cascaded I see only 29. For me it seems, Tov losses it new address after disconnecting. Both ToVFs are Pimoroni VL53L1x?

thx

Peter

I wouldn’t hook them both up at the same time while running the change address script. Just hook the one you want to change up, change its address, then check to see if it changed. Then swap the other one in and see what address it has. It sounds like you may have changed the address on both of them, instead of just one of them. You may have to change one back to its default.