2025-05-02 3:34 AM
Hi all,
I'm currently developing test code for the VL53L1 ToF sensor using STM32CubeIDE, and I'm aiming to optimize the sensor's performance for close-range measurements — specifically in the 10mm to 200mm range — with a target accuracy of around 1–2%.
I'm currently using the bare driver files provided by ST, which I’ve manually integrated into my STM32 project.
I'm aware of the various distance modes (Short, Medium, Long) offered by the sensor, and I plan to experiment with them. From what I understand, the Short distance mode is generally preferred for close ranges due to better ambient light immunity and reduced signal crosstalk. I'm also considering manually configuring a Region of Interest (ROI) centered around the sensor’s optical center to help reduce edge-related anomalies.
My questions to the community are:
Which distance mode and ROI settings have yielded the best results for others in this close-range context?
What other parameters should I tune to achieve maximum accuracy over this short range? I’ve read a bit about tweaking:
Timing budget
Inter-measurement period
Sigma threshold
Signal rate threshold
I can afford a slower sampling rate (~200ms), so I’m happy to increase timing budgets or reduce the measurement frequency if it improves consistency and accuracy.
Any insights, advice, or sample configurations would be greatly appreciated!
Thanks in advance,
Matthew
2025-05-02 10:23 AM
the reason 'short' works better for the short distances is that the pulse repetition rate can be faster.
We don't need to wait as long for the light to go out to the max distance and come back. And more pulses = more accuracy. But if you can afford 200ms it really doesn't matter that much. You have plenty of pulses.
But what really counts is the quality of your target.
If you have something like a piston moving in and out, and want to know where that piston is, you can choose a relatively reflective target giving you lots of signal. And a matte finish is preferred.
At 20cm you are going to have lots of signal and choosing an ROI does make sense.
I'd get some idea of how many SPADs your system is using and create a region slightly larger than that.
If you are only using 10 SPADs worst case a 4x4 area would be fine.
20cm is NOT very far and I'd be willing to be a 4x4 will be fine. But if you have a dull target, then a 5x5 might be required.
Sigma and Signal settings allow the chip to return a different status if the Sigma is too high or the signal too low.
But they really don't affect the range. It's more like a warning. But in your case if you get either of these then you need more SPADS.
the Inter-measurement period is only useful if you want to save power and only need sparce ranging. It allows the chip to rest in between ranges.
If you want the best accuracy, consider building system where the temperature does not vary. Changes in temperature affect the sensor. And it self-heats to a minor degree.
- john
2025-05-05 5:42 AM
Hi John,
Thank you very much for your detailed reply — I really appreciate your insights!
The system I’m developing uses three VL53L1 ToF sensors to measure the relative distance between the device and a wall. These measurements are then used to calculate the tilt or angular misalignment between the device and the wall’s surface. The wall surface may vary in finish — such as bare brick, plaster, or paint — depending on the environment.
Given this variability in surface texture and reflectivity, do you think the VL53L1 is a suitable choice for this application? Would the system require recalibration for each different surface type, or would you recommend a different sensor technology that’s less sensitive to surface finish?
Any suggestions on alternative sensors or approaches would be greatly appreciated.
Best regards,
Matthew
2025-05-05 8:08 AM
One of the thinks we can do with the VL3L1 is focus a projector. And do that one needs to correct for angle. It's called Keystone correction if the projector is looking up or down siightly and some even correct for right or left offsets.
this seems similar to what you want to do.
But the projector idea has some advantages. One, we are always looking at a reflective screen - where you have a random wall. And we have distance - where you have basically none.
The sensor is accurate to +/- 3% (Check the datasheet, it's more complex than just one number.)
And up close even that does not hold well.
And the subtle difference in angle is going to get lost.
You need a better sensor. - one with a wider field of view.
I'm going to suggest you use the VL53L8CX. With 8x8 zones and a wider field of view, you are going to get much better angles.
And the idea is going work, for any 'normal surface' (called Lambertian). But against a mirror-like (sepecular) surface the photon that hit at an angle will simply bounce away.
Invest $56 dollars in the P-Nucleo-53L8A1.
Put this evaluation kit up to a wall and try it.
If it works - keep going. If not, you are out $56 dollars and a few hours of test time.
Try it before you invest too much effort - but my guess is the VL53L8 will work for you.
- john