VL53L4CX Sensors


New member
Hi there, I am working on a project where I am using an array of 16 VL53L4CX to measure both the X and Y coordinate of any object in front of my sensor array. I want my loop time to be less than 50ms so I am using 1MHz I2c clock and currently I'm able to 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 to avoid 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 ). What can be the reason for this behaviour. I was previously using VL53L0X and it was actually working way better than this. The reason why I changed to VL53L4CX is to obtain higher I2c speed and proper readings. With VL53L0X sometimes the sensor was not giving any values as I was not using any blocking function. But using a blocking function might end up increasing my loop time. Is there anything I'm missing in this case.
My circuit uses 2.2k pull up resistor, I tried different pull up values as mentioned in the data sheet but it didn't had any effect. I am changing address of all the sensors on start up and it works fine. I'm using teensy 4.0 and have incremented the i2c buffer length to 255 in wire library, so that blocking function works properly. Any help would be appreciated. Thank you very much.

for (unsigned int i = 0; i < 16; i++)
            mcp.digitalWrite(i, HIGH);
            address = address + 2;
        void readDistance()
        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();
Hi jack.
I would suggest reposting your question with the smallest complete code that can be compiled and give the fault you describe.
I would also suggest providing a link to the library that you are using.
Sincerely Gavin.