Using more than fifteen VL53L0X on Arduino Mega

Hello everyone,

I tried to connect twenty VL53L0X to an Arduino Mega but found, that fifteen seams to be the limit.

From my understanding, the reason are the pull up resistors which are added to the I2C line on every VL53L0X.
15x 10k resistor sums up to 666 ohm.


A possible solution is to build a software I2C and sperate the VL53L0X. Ten to hardware I2C and ten to software I2C.

Using this library: GitHub - stevemarple/SoftWire: Software I2C implementation for Arduino and other Wiring-type environments
I tried to set up a Software I2C: SoftWire sw(sdaPin, sclPin);

And later set the bus for a specific sensor like it is described in the pololu library: Sensors[1].setBus(&sw);

Unfortunately, I get a compile error:
Compilation error: no matching function for call to ‘VL53L0X::setBus(SoftWire*)’

libraries\VL53L0X/VL53L0X.h:102:10: note: no known conversion for argument 1 from ‘SoftWire*’ to ‘TwoWire*’

Does someone know how to fix that problem?
Thanks for any kind of support

Hello.

If you are up to the task, I would recommend just removing the pull-up resistors between VIN and the I2C pins on several of your VL53L0X boards. Since you are just removing components, it should not be too difficult to make that modification, even if you just have a regular soldering iron and some tweezers. Just be careful to avoid touching any nearby components. I posted a picture identifying the resistors below.

We could offer some suggestions for how you might be able to modify our library to work with SoftWire. However, we expect the modifications would be extensive and messy, and we are not especially familiar with that library, so modifying the hardware like I suggested is probably going to be the simpler and more elegant solution.

- Patrick

Hello Patrick

thank you for your quick reply.
I also thought about this but if I want to build the system e.g., three times, I have to remove 120 resistors.

Another solution would be to use a microcontroller which provides two hardware I2C interfaces.

I will keep looking for a better solution.
I just wanted to know if I’m doing something wrong with the “setBus“ function.

Since you only need to remove components, my guess is that once you learn how the process it should only take a few seconds per board. Additionally, based on your testing, it sounds like you will probably be fine if you make that modification on just half of the boards.

- Patrick

I have found a better solution
My problem is solved with the TCA9548A I2C multiplexer.
I simply separate the devices

2 Likes