Changing I2C address of VL53L0X

Hi, I'm trying to change the I2C address of a VL53L0X ToF sensor from the default 0x29 to something else. The problem is, that I have two TCS34725 (with an unchangeable address of 0x29) on my two hardware I2C buses of my ESP32. Due to time constrains, I sadly can't use a I2C multiplexer. To my knowledge, the I2C address for the VL53L0X has to be changed via software every time the powers turned on. But that doesn't really work, and I get this error message:

[  2849][E][Wire.cpp:539] write(): NULL TX buffer pointer
[  2854][E][Wire.cpp:449] endTransmission(): NULL TX buffer pointer
[  2860][E][Wire.cpp:485] requestFrom(): NULL buffer pointer
[  2866][E][Wire.cpp:566] read(): NULL RX buffer pointer
VL53L0X Info:
  Device Name: VL53L0X ES1 or later, Type: VL53L0X, ID: 
Rev Major: 1, Minor: 15
Error expected cut 1.1 but found 1,15
 VL53L0X Error: -5

I think this is because before the address is changed, there are two I2C devices with the same address (0x29) on the same bus. Therefore it can't write the address change for the VL53L0X. Has anyone an Idea on how I could either permanently change the VL53L0X address or some kind of different solution?

Try this link and see if it solves your problem. How to change the I2C address for VL53L0X laser distance sensor | Robojax.com

Sadly not. The change is only temporary, there is no user writable flash on the Sensor. It gets reset when power cycled. And I can't change it in software because in the beginning, the will be two 0x29, the TCS and the distance Sensor. I guess I will just use a different sensor. Put still thanks for your help

1 Like

which specific VL53L0X sensor module are you using?
when I used two of the Pololu VL53L0X on power up I used the XSHUT pin of one sensor to disable it while changing the I2C address of the other
this gave me two VL53L0X sensors with different I2C addresses

2 Likes

Yeah, that doesn't work. Maybe I wrote this weirdly, I only use one Distance Sensor and the other sensor with the same Address is a TCS34725 color sensor. And I can't disable it(I think), so this method wouldn't work. But still thanks for the answer

you can

  1. physically disconnect one of the TCS34725 change the VL53L0X I2C address then reconnect the TCS34725
  2. or try a software I2C for the third device, e.g. esp_software_i2c
1 Like

TCS34725 draws max 300uA, so you could power it from Gpio pin and disable (power off) when needed.

2 Likes

Wow, thanks a lot for both your answers! I will first try the power off idea, and if that won't work, I will try to use software I2C. @kmin I would just connect +3V3 on the Sensor to a GPIO, right?

Yes, choose gpio that doesn't have any special behavior, pins between 18-33 are all fine.

1 Like

remember you can disable the VL53L0X sensor using the XSHUT pin

So in the future, choose modules / chips where you can config the address. :+1:

1 Like

okay, everything seems to be working on my breadboard. Will test it now on my real robot

Yes, definitely. Will order some I2C Multiplexer as well

Hmm, sorry to reopen this topic, but I have a problem. The TCS34725 board has an LED, that is glowing in the beginning, before I set the GPIO Pin to either HIGH or LOW. I'm worried that it draws power over the SDA or SCL Lines. Is this a problem?

Strange, could it draw power from SCL then. I cannot say 100% it's nothing, however I wouldn't worry myself. It's not uncommon that electronics can be "stealing" some power through IO pins. You could do the opposite arrangement, switch off TCS34725 GND instead of Vcc.

1 Like

Yeah, that could be. But due to time constrains, I will settle for a simple limit switch. Does the job as well and is easier to use. But I will try to solve this after the championship.

Exciting, so get on it! :upside_down_face:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.