PiicoDev Laser Distance Sensor VL53L1X (CE07741)

This is a placeholder topic for “PiicoDev Laser Distance Sensor VL53L1X” comments.

The PiicoDev® Distance Sensor is a long-distance laser-ranging sensor that uses Time-of-Flight (ToF) to accurately measure distances up to 4m.

Read more

How much hPa can this sensor (PiicoDev Laser Distance Sensor VL53L1X) messure? And another Question can you change it to messure in Bar ?

This question re pressure was asked on the Laser Distance sensor, wrong product perhaps?


Have you tried using this as a (UV) laser cutter autofocus sensor? I think it could be great, but I can’t see a minimum sensing distance listed, and I’m not sure how its sensor would hold up so close to a very strong UV source. Whaddya reckon?

Hi James,

Certainly the first time this has been asked!

ST doesn’t mention anything about that on the datasheet, but I think for the price you might as well just give it a go :slight_smile:

I’d assume the optics on the front would be filtering out things that aren’t in the wavelength of interest (940nm), but that’s certainly something only ST would know. UV has a tendency to degrade everything it touches given long enough, so you’d have to test for quite a while I think.

All the best with your experiments!

1 Like

Looking at page 11/35 Section 2.5.2 the mean standard deviation of error in distance measurement is between 2.5mm - 5mm. Unfortunately this excludes it from usability as a focus sensor for a later engraver/cutter (Diode, CO2, Fibre, UV). Focus for these devices is often set to <1mm.


I am using a Laser Distance Sensor as part of a garage door and light controller project to measure the distance to the garage door and derive its rate of change in position to classify it as “Open, Opening, Closing or Closed”.

Unfortunately, there are too many false readings during daylight hours as the door moves. I am assuming this is from reflected sunlight affecting the sensor accuracy.

Has anyone used the Ultrasonic distance sensor within a space like a garage and would it be a suitable alternative to measure the distance to the door?


Hey Stephen,

That’s no good! I think there may be some interference there as those sensors have been extremely accurate when we have tested them. It is likely it was environmental changes that could be affecting it.

I think an Ultrasonic distance sensor would be a great module to use here. As long as it is mounted in the right way, it would be pretty resistant to external interference and would be very accurate for your specific project needs.


Hi Stephen, Blayden.

Could be the irregular surface of the door causing reflections in all different directions. I think these devices would work better with a flat reflective surface.
Cheers Bob

Hi Blayden

Thanks for the feedback, I will order an ultrasonic sensor and give it a try.

I found with the laser sensor in a fixed location using a white interior wall, it reports +/- up to 20 mm on continuous readings, which is within tolerance when I checked the datasheet. However the variance I am seeing is far greater than that, hundreds of mm in many cases.

One thing I did notice is that the driver software is not explicitly checking for a 0 status code before returning a ‘valid’ distance measurement, so that might be a factor.

Cheers, Steve

1 Like

Hi Bob

A good thing to check but I aimed the sensor at a flat white plate at the top of the door which is perpendicular to it as the door moves.

Unfortunately the erroneous readings continue even when the door is stationary in the open position during daylight hours.

The house across the street has a large white garage door and I think the reflections from this are overwhelming the laser sensor. The guide does says its not intended for outdoor use.

Hopefully the ultrasonic unit will door the job otherwise it will be a series of limit switches to detect the changes in position and a lot more logic to debug. :slight_smile:

Cheers, Steve

1 Like

Sometimes noise is a part of the process in some environments (regardless of sensor type). Have you tried filtering it out by taking a generous number of samples (eg 11) and then using the median (bubble sort the results from smallest to largest, take the middle value) to reject outliers?

1 Like

Hi @Stephen202603

I did find that if the sensor looks into ‘free space’ > its’ nominal max range, (5m) it can send spurious readings back. The detection angle is relatively narrow, so you might have some of the detection zone open to free space as the door moves.


1 Like

Hi Bob

I’ve had another idea, do you think I could place a few hall effect sensors along the door track and wire them into some GPIO’s on a Pico with ethernet twisted pair cable and then glue some magnets on the edge of the door ?

With a latched hall sensor and a strong magnet it would be much more reliable than the laser solution.


Hi Gramo

I’ve done a range of experiments compare inside to outside measurements across a variety of distances using solid walls as targets.

Exterior :
Sample size 46, Mean 2418 mm, Standard Deviation 1047, Max 5180 mm, Min 282 mm
57, 1077mm, 1388, 5164 mm, 632 mm

27, 623.81 mm, 1.144, 626 mm, 622 mm
40, 4437.87 mm, 37.489, 4509 mm, 4355 mm
46, 2313.41 mm, 4.9647, 2323 mm, 2303 mm

So I think there are definite issues with solar interference.
I could bring my self to use bubble sort but python includes a sorted() function anyway, so we can avoid coding that.

Cheers, Steve

1 Like

Hey Steve,

The noise-filtering technique Gramo mentioned would definitely be worth giving a go. In my opinion as Bob mentioned earlier:

This would likely be amplified by use of an ultrasonic sensor due to the nature of how sound tends to struggle to remain collimated, although it’d still be worth giving a go, the inaccuracy may actually be useful here for ‘missing’ the case where the reflection isn’t from the location you’re expecting.

Both ToF and Ultrasonic sensors both struggle to measure distance to irregularly shaped surfaces, and in the case of ToF, even indirect sunlight if strong enough and matching the wavelengths of the light being used for measuring the distance can easily be enough to cause invalid measurements.

If you’re just after motion detection rather than measuring distance, doppler microwave radar detection would likely be most reliable, there’s very little interference that impacts these forms of sensors, and they typically have built in countermeasures for it. They’re very good at detecting microwave reflecting materials:

As for minimizing noise from a distance sensor, a technique such as applying a factor of the capped difference from the current measurement to the next would probably be the best way to go. Something like this ought to do the trick:

from time import sleep

def main():
    # use a function to get the first raw
    distance = raw()
    while True:
        distance = filtered(distance, raw())
        print(f"{distance} mm")

def raw():
    # TODO: write me
    return 0

def filtered(prev, curr):

    # how much did the measurement change
    delta = curr - prev

    # cap it between some reasonable delta values for the units to minimize outlier impact
    MAX_CAP_MM = 1
    MIN_CAP_MM = -1
    delta = max(min(delta, MAX_CAP_MM), MIN_CAP_MM)

    # return the prev, combined with some small factor of the delta, so it smoothly transitions between values
    return prev + (delta * SMOOTHING_FACTOR)

if __name__ == "__main__":

Should do something like this (this is just a random image of a similar filter being applied to temperature measurements):


i Bryce, Steve

As I have always understood it with Doppler detection the target has to be moving away from or toward the detecting source to be seen and would primarily measure speed (speed cameras). This measures the phase shift of a (or 2) modulating signal (s) whereas what you describe as TOF (what I have always known as “pulse echo”) measures (as the name implies) the time elapsed between TX and RX of a microwave pulse.

I think probably the most reliable would be a sensor at the top and bottom to sense open or closed and some form of sensing arrangement to provide quadrature pulses like a rotary encoder attached to the roller drive to be decoded and indicate movement and direction. I would not use hall devices but go for magnetic reed switches or ones I have used provide their own magnetic field and responded to holes drilled in a steel disc (2 required suitably spaced). These were pretty easy to use and were open collector NPN output so easily interfaced.
Cheers Bob

1 Like

Add on.
From memory the sensors I used were something like this

with an M10 (Think) thread almost all the way up. We used the open collector version (3 wire) at 24V and as this page jogged my memory the sensor picked up the steel section between the holes and 2 sensors were arranged to provide a quadrature signal to 2 inputs of a PLC which had inbuilt decoding facility. Use for turns counting and rotation sensing on coil winding machines. Our particular set up gave a resolution of 0.1 turn.

This type of sensor is very easy to use and very reliable. They have been going now for something like 20 years.
Cheers Bob

Search for “Magnetic proximity sensors” for lots of info.

Note. You will have to debounce reed switches so not as convenient.


You’re spot on Bob, that was a mistake on my part. Microwave presence detection sensors such as the one I linked often use the doppler effect for detecting speed or motion (for anyone else reading this, it’s simply how frequency changes depending on relative velocity to the signal source, and is why you get the euphonious Wee-Woo-Wee-Woo-Weeeee-Wooooo-Weeee-Woooooo as an ambulance flies past, these sensors often do the same thing with microwaves to detect motion)

It is stated in the product description

It can detect the difference between the transmitted wave and reflection wave to judge whether there is an object moving in the detection area.

Should still work for detecting a moving garage door, although without two points, you wouldn’t be able to tell if it is opening or closing. As Bob has suggested a rotary encoder, hall effect sensors, or other magnetic proximity sensors like the RedLion pickups ought to do the trick nicely.

Doppler Effect Demonstrations and Animations

1 Like

Hi Stephen,

If you stick down a couple of magnets with varying strength/ direction you could use a magnetometer to determine the direction/distance.

Unfortunately you’d need a MUX to have multiple but a magnet one the start and end of the garage door with different polarities will let you estimate distance near the ends.

1 Like