Open MartinR3924 opened 3 months ago
Hello,
I was able to reproduce some similar behavior to what you described; with your settings, I got a reading roughly every 20 ms when there was nothing in front of the sensor, but when there was something that it could detect, the interval would often double to closer to 40 ms.
There is a discussion on the ST community site with a lot of good information about setting up consistent fast readings. This library sets up the sensor to use the LOWPOWER_AUTONOMOUS preset mode, and in that mode, John Kvam recommends using an inter-measurement period (the value passed to startContinuous()
in our library) of at least 5 ms longer than the timing budget. So using startContinuous(25)
seems to work and consistently give me readings every 25 ms. Or if you really need readings every 20 ms, it also seems to work if I do setMeasurementTimingBudget(15000)
and startContinuous(20)
, even though 15 ms is below the supposed minimum timing budget of 20 ms .
John recommends using the LITE_RANGING preset mode for predictable timing, but unfortunately this library does not support any preset modes other than LOWPOWER_AUTONOMOUS. If you want to look into that configuration, you might consider trying the full ST VL53L1X API instead of this library; we have an example implementation for Arduino.
I'm using the VL53L1X sensor with the following configuration in continuous mode:
sensor.setDistanceMode(VL53L1X::Long); sensor.setMeasurementTimingBudget(50000); sensor.startContinuous(50); I tried adjusting the settings as follows:
sensor.setDistanceMode(VL53L1X::Short); sensor.setMeasurementTimingBudget(20000); sensor.startContinuous(20); However, I noticed that the sensor's readings do not occur every 20ms as expected but instead take longer, approximately 30ms. I’ve verified that the startContinuous() period is at least as long as the timing budget, but the issue persists.
Question:
Is there any additional configuration I need to set to ensure the measurements occur exactly at the specified intervals, or is there an inherent limitation in the timing precision of the sensor?