Close

Improve speed/pixel of TOF Camera (1)

A project log for Gesture/Pattern Recognition Without Camera : TOF !

Grumpy Hedgehog is a connected device that allows you to read and interact with movements. Its LCD screen displays the Hedgehog's expression

jeanperardeljean.perardel 10/31/2021 at 12:180 Comments

I chose to make a board allowing to integrate 4 VL53LXX on the same I2C bus. 

As all the sensors are at the same address (0x52), we are obliged to integrate a small trick at the startup of the system by using the PIN XSHUT : 
We have to set the XSHUT of all the sensors to LOW and then turn them on one by one in the following way: 

// START First TOF SENSOR
digitalWrite(VL53L1X_1, HIGH); // Turn HIGH XSHUT PIN
delay(150); // Wait for sensor to start
if (distanceSensor_1.begin() != 0) //Begin returns 0 on a good init
{
  Serial.println("Sensor 1 failed to begin. Please check wiring. Freezing...");
  while (1);
}
Serial.print("Sensor 1 address : 0x"); // Return 0x52
Serial.println(distanceSensor_1.getI2CAddress(), HEX);
delay(100);
distanceSensor_1.setI2CAddress(0x11);
delay(100);
Serial.print("Sensor 1 new address : 0x");
Serial.println(distanceSensor_1.getI2CAddress(), HEX); // Return 0x11

// START Second TOF SENSOR
digitalWrite(VL53L1X_2, HIGH); // Turn HIGH XSHUT PIN
delay(150); // Wait for sensor to start
if (distanceSensor_2.begin() != 0) //Begin returns 0 on a good init
{
  Serial.println("Sensor 2 failed to begin. Please check wiring. Freezing...");
  while (1);
}
Serial.print("Sensor 2 address : 0x"); // Return 0x52
Serial.println(distanceSensor_1.getI2CAddress(), HEX);
delay(100);
distanceSensor_1.setI2CAddress(0x22);
delay(100);
Serial.print("Sensor 2 new address : 0x");
Serial.println(distanceSensor_1.getI2CAddress(), HEX); // Return 0x22

When the second sensor is started with this same method, the first sensor is no longer at address 0x52. This allows to configure the address of the second sensor without disturbance. 

To add more sensors, you just have to add the same piece of code for the others.

Discussions