2026-05-11 3:23 AM - last edited on 2026-05-11 4:01 AM by Andrew Neil
Would it be possible to use a Time-of-flight sensor to measure water level in a pipe?
The pipe is vertical with a diameter of 50 or 75 mm and a height of 800 mm. At bottom there is a 90 degree bend. Sensor should be at top looking down the pipe. I assume that best sensor would be VL53L4CD since it has smallest field of view. Would reflection from pipe walls disturb measurements?
2026-05-11 3:31 AM
Hello @kurtm and welcome to the ST community,
AN5851 "Water and liquid level monitoring using VL53L4CD Time-of-Flight high accuracy proximity sensor"
For other sensor part numbers:
AN5843 "Water and liquid level measurement using VL53L5CX Time-of-Flight 8x8 multizone sensor with wide field of view"
Liquid Level Monitoring using ST Time-of-Flight technology
Liquid Level Monitoring using ST’s Time-of-Flight: VL53L5CX
2026-05-11 6:07 AM
I have checked the suggested documents but not found what I am looking for. The problem I see is that you will get some reflected light from the pipe walls that will increase with distance. What I would like to know is a little more what I can expect. In my case, pipe is plastic type and water is waste water which can vary from none to almost clean to water with foam and movements. The important thing is to detect if water level is rising above 200 - 300 mm from bottom.
2026-05-12 3:59 AM
Hi:
Thank you for the additional application details. Based on your geometry and the principles AN5851 described in for liquid level sensing.
A VL53L4CD can be evaluated for this application, but the main challenge is indeed pipe wall reflections, especially in a narrow pipe with a long top-down measurement path.
In the chapter 2.1 of AN5851 , the ToF sensor FoV is conical, so the container geometry has a direct impact on the measurement. FoV is approximately 18°, So the beam expands with distance. The footprint diameter can be roughly estimated as D≈2h*tan (9°).
If your decision point is about 200~300mm above the bottom, with a total pipe height of about 800mm, then the sensor-to-surface distance is roughly 500~600mm. we can get the diameter D is 158.5~190.2mm.
At that distance, the beam footprint becomes much larger than a 50~75mm pipe diameter, so part of the light will inevitably hit the pipe walls. Therefore, the optical situation is intrinsically one of *mixed returns*, not direct clean liquid-surface ranging.
your requirement is only to detect whether the level has crossed a fixed threshold, for example around 200~300mm from the bottom, so this application is better positioned as threshold detection rather than continuous level gauge.
Based on AN5851 and your use case, you can follow the setup of chapter4:
1. Validate the setup using the real pipe, real wastewater, and real flow conditions;
2. choosing one clear threshold first, for example a liquid level at 250mm from the bottom, this corresponds to a theoretical sensor-to-surface distance of about 550mm.
- Empty pipe
- Clean water, static
- Clean water, moving
- Wastewater, static
- Wastewater, moving
- Foam condition
- 100mm
- 200mm
- 250mm
- 300mm
- 400mm
from the bottom. This covers below-threshold, near-threshold, and above-threshold cases.
For each condition and each level point, collecting 100 samples.
- Raw distance values
- Valid / invalid status
- Current condition and level point
- Whether the outputs below and above the threshold are separable
- Whether the empty pipe causes false detection
- Whether foam and motion create significant instability
3. If the results show that the two sides of the threshold can be distinguished, the next step would be to optimize the solution with filtering, hysteresis, and simple decision logic. or if the outputs overlap too much across different conditions, then the structure or sensing approach may need to be reconsidered.
Hope this will help for you.
Best Regards,
Bin FAN
2026-05-12 4:48 AM
Hi Bin,
Thank you very much for your detailed answer. I have located some more info about your sensors, but it is not so easy to find it. From what I understand the VL53L4CD or VL53L4CX would be most suitable. I suspect there can be a situation where there is one return from water level and one from the bottom. Would the VL53L4CD only respond with the distance to the largest return? With the VL53L4CX histogram, I suppose that I can see both bottom and water level and maybe also have a zero histogram as reference and then compare measurements with the reference and look for deviations.
I have noted that you shouldn't use any optics at the laser because of eye safety. However, I suppose that a plus lense at about 50 mm distance from the sensor where beam is about 15 mm could fix the wall problem. Do you have any more information about beam properties? Will it vary between individual units?
Kurt Mirdell