Closed Dario-Ciceri closed 10 months ago
Hello @Dario-Ciceri ,
it's normal. The address that you assign in the "InitSensor" is in 8-bits format. The value that you read in the I2C scanner is in 7-bits format. 0x18 is 0x30 shifted by 1. So everything should be fine. Consider when you assign the I2C address in the "InitSensor" that you have actually 2 addresses allocated (one for the write operation and one increased by one for the read operation ); for example, when you call vl53lx.InitSensor(0x30);
you are allocating the 0x30 address for the write operations and the 0x31 address for the read operations. So, if you want to assign a new I2C address to another ToF sensor you must pass as parameter at least 0x32.
I hope that it can help you.
Best Regards,
Carlo
Hello @Dario-Ciceri , it's normal. The address that you assign in the "InitSensor" is in 8-bits format. The value that you read in the I2C scanner is in 7-bits format. 0x18 is 0x30 shifted by 1. So everything should be fine. Consider when you assign the I2C address in the "InitSensor" that you have actually 2 addresses allocated (one for the write operation and one increased by one for the read operation ); for example, when you call
vl53lx.InitSensor(0x30);
you are allocating the 0x30 address for the write operations and the 0x31 address for the read operations. So, if you want to assign a new I2C address to another ToF sensor you must pass as parameter at least 0x32. I hope that it can help you. Best Regards, Carlo
Thanks Carlo, I hadn't thought about the 1bit shift actually and I was also assigning 0x30 and 0x31 as addresses... I can try 0x30 and 0x3F to be sure, I'll try now, in the meantime thanks.
If I wanted to test only one sensor at a time, without being able to disconnect them from the board, I would just turn off one sensor via xshut right?
Hello @Dario-Ciceri , yes you can have all sensors connected. You just need to put low all the xshut pins and then initializing the sensors one by one. Best Regards, Carlo
Hello @Dario-Ciceri , yes you can have all sensors connected. You just need to put low all the xshut pins and then initializing the sensors one by one. Best Regards, Carlo
Thank you
I set on both sensors XSHUT to low and then called
sxTof = new Vl53lxWrapper(sxTofXshutPin,
sxTofInterruptPin,
sxTofAddress,
SDA_PIN,
SCL_PIN);
dxTof = new Vl53lxWrapper(dxTofXshutPin,
dxTofInterruptPin,
dxTofAddress,
SDA_PIN,
SCL_PIN);
however it doesn't seem to be working, if it's not too much to ask it would be helpful to have an example with two sensors, in the meantime I'll try to see if I can figure it out
Hello @Dario-Ciceri , You can give a look at the example here. It is based on a shield that mounts 3 VL53L3CX sensors with an IO expander. Anyway, I think that you can check how the several sensors are initialized to get them working. Best Regards, Carlo
Hello @Dario-Ciceri , gpio0 pin in the VL53L3CX library should be the xshut pin. The interrupt pin is not managed inside this library but only at application level. Best Regards, Carlo
Hello @Dario-Ciceri , gpio0 pin in the VL53L3CX library should be the xshut pin. The interrupt pin is not managed inside this library but only at application level. Best Regards, Carlo
yes my fault!
you want to laugh? after 5 hours of programming in the cold, moreover I have the flu, I realized a delay that obviously with interrupts doesn't go very well and was the cause of all evil... thanks again... I'd say it's better if I take a break for today after certain mistakes...
Hi, I am trying to manage two sensors, if I do an i2c scan I see a sensor at 0x29 (the other sensor I keep off by putting xshut to HIGH) but the moment I run vl53lx.InitSensor(0x30); I get 0x18 with an i2c scan instead of 0x30 and I don't understand why, I don't know if I am doing something wrong but if you have ideas you would do me a favor, thanks!
I'm using an esp32 and an adapted code