How to read only distance and signal strength from VL53L4CX and how to get better performance in a sunlit room.
Hi,
I am using VL53L4CX sensors with a custom-made board which uses the STMH755ZI. I am using the library provided by STM to get the sensor measurements.
Initially, my tests were done using a Teensy 4.0. At that point, I noticed that a single VL53L4CX sensor takes around 3ms to get data through I2C when using the VL53L4CX library. However, when I switched to the VL54L4CD library, it was much faster, taking around 0.5ms per sensor. This includes all the data that the sensor provides.
After that, I moved to the STMH755ZI. Since this is an STM chip, I thought it might be more compatible and faster compared to the Teensy, as the TOF sensor is also made by STM. Contrary to my expectations, the time it takes to read one sensor significantly increased. Using the VL53L4CX library, it takes around 10-11ms to read data for a single sensor. Then I tried the VL53L4CD library and was able to reduce the time to 1ms per sensor.
I am working on a project with strict time constraints, so I commented out reading the unwanted data in the VL53L4CD library such that I am only reading the signal rate and distance. Now, I was able to reduce the time taken to 0.5ms. For all the above tests, I was using a 1MHz I2C speed. Why is it varying this much between microcontrollers when the I2C speed is the same?
I checked whether it is waiting for the data to be ready or not, but it is not. It is the I2C transmission that is taking all this time.
In almost all scenarios, the data I need is just distance and signal rate. The range I need is around 50cm, and the VL53L4CD library works the way I need it to. However, when I use it in sunlight (not directly under the sun but in a sunlit room), as expected, the sensor gives terrible results. I noticed that the datasheet says the VL53L4CD will give 90% readings for a gray target under 400mm outdoors, whereas the VL53L4CX will give the same performance up to 1100mm. Is this purely based on hardware? I am actually getting really poor readings after 330mm and I am using the VL53L4CD library with the VL53L4CX sensor. Will changing the library help in this scenario? If I change the library, will I be able to reduce the time taken for reading the data to 0.5ms by reading just the distance and signal strength? If so, how can I do it, as it looks much more complex than the VL53L4CD library?
Thanks,
Kiran
