cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L4CX - Connecting Multiple Sensors

isaacjack
Associate II

Hi there, 

I am involved in a project comprising 16x VL53L4CX Sensors, we are trying to measure and track the x and y coordinates of an object in front of the sensor array. Currently, I can read from all sensors in 33ms on average. Even though I'm using the blocking function which is VL53L4CX_WaitMeasurementDataReady(), I'm seeing a pattern of no values at times.

Initially, when I was not waiting for measurement I was getting around 12 proper readings and 12 no object detections. This behaviour was happening all the time so I decided to use the blocking function. This eventually helped me to correct that behaviour, but now when I read from more than one sensor, 90% of the time I get no object detection or some random reading in alternate loops. I tested the same by placing an object only in the line of sight of one sensor in my array and it works perfectly. In this case all the other sensors were detecting my roof which is around 1.7m. But the moment I place an object in 5cm to 60cm range(I haven't tested above that as my area of interest is 60cm * 60cm) It gives me either no object detection(Range status = 255 ) or some value around 160cm in alternate cycles. I tried waiting until a sensor gives any other Range status but in that case my loop time went to 60 - 70ms and I stopped getting Range status 255, with the reading equal to 170cm when the object is placed somewhere around 15cm.

 

 
This is my code:
 
void init(){
for (unsigned int i = 0; i < 16; i++)
{
mcp.digitalWrite(i, HIGH);
sensors[i].VL53L4CX_WaitDeviceBooted();
sensors[i].begin();
sensors[i].InitSensor(address);
sensors[i].VL53L4CX_StartMeasurement();
address = address + 2;
delay(10);
}
Wire.setClock(1000000);
}
void readDistance(bool instrumentint modSensorsPosint modSensorsNum)
{
VL53L4CX_MultiRangingData_t MultiRangingData;
VL53L4CX_MultiRangingData_t *pMultiRangingData = &MultiRangingData;

for (int i = 0; i < 16; i++)
{
status = sensors[i].VL53L4CX_WaitMeasurementDataReady();
status = sensors[i].VL53L4CX_GetMultiRangingData(pMultiRangingData);
distI[i] = pMultiRangingData->RangeData[0].RangeMinMilliMeter / 10.0; // mm to cm
status = sensors[i].VL53L4CX_ClearInterruptAndStartMeasurement();
}
}

 

2 REPLIES 2
isaacjack
Associate II

Is the VL53L4CX Driver Header File something that could assist with this issue? 

Hi 

Could you please share one picture of your test setup, and your target size and material?

From your description, when you place a target at 15cm, sensor will report ceiling distance 170cm. this seems your target reflect back much less signal compare with the ceiling, which lead sensor reporting ceiling distance instead of your target distance.

 

About your issue description, there is something need your clarify. 

" but now when I read from more than one sensor, 90% of the time I get no object detection or some random reading in alternate loops. I tested the same by placing an object only in the line of sight of one sensor in my array and it works perfectly,In this case all the other sensors were detecting my roof which is around 1.7m."

Does this mean if you only enable one sensor, it works perfect, and issue only happen with multi sonsor ranging at same time?

 

"But the moment I place an object in 5cm to 60cm range(I haven't tested above that as my area of interest is 60cm * 60cm) It gives me either no object detection(Range status = 255 ) or some value around 160cm in alternate cycles

if you put target at 10cm just at the center of sensor FOV, still same behavior, sensor will report no object and 160cm alternately?

 

Br

Zhiyuan.Han


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.