Calibration of PiicoDev Distance Sensor VL53L1X

I’m using a PiicoDev Distance Sensor VL53L1X for my project and when I move a distance of 300mm within a range of 1m, the sensor is reading an error of 30-40mm. And my usage environment is favorable for a better reading state(indoor).

  • Is it possible to calibrate the sensor? If so, can someone help me with the code, please?

  • Also wondering how can I check and change the ‘distance mode’ in the sensor using ‘VL53L1_SetDistanceMode()’ to ‘short’, ‘medium’ or ‘long’?

3 Likes

Hi Russell,

Welcome to the forum!!

Would it be possible to send through a photo of your setup and clarify which dev board you were using?
What were you looking to measure? The IR laser emitted from the distance sensor can have trouble measuring some surfaces.

I havent sifted through the datasheet but to calibrate any sensor you usually have to provide a known reference then any deviations can be added or subtracted from that. In this case we already have a reference, the speed of light so from my knowledge you shouldnt have to?

Unfortunately that code is from the Sparkfun reference - using an Arduino library to talk to the sensor. No worries though! With a few changes to the code you’ll be able to implement the functionality, here’s a link to the repo: GitHub - CoreElectronics/CE-PiicoDev-VL53L1X-MicroPython-Module: Firmware repo for the Core Electronics PiicoDev Laser Distance Sensor VL53L1X
from here you could take a shot at porting the code over or raising an issue to request a function to be added.

2 Likes

Thanks Liam,

I have attached a photo of my sensor. A raspberry pi 3 is used to run the system.

I think my sensor is giving a reading close to a true reading. But I am aiming to get a much more precise data out of it by changing the ‘distance mode’ to ‘short’ which gives better data in ambient light conditions.
Any help to switch modes of VL53L1X in python is much appreciated. Thanks in advance.


2 Likes

Hey Russell,

Welcome to the forum! :partying_face:

I’d suggest looking into some data filtering techniques too (personally, for this sensor I’d suggest looking into implementations of a Kalman filter). Even just taking a large number of readings quickly and then averaging them out after removing the outliers tends to work quite nicely for measurements from distance sensors.

1 Like

Hi Russel,

I’ve just had a bit of a squiz at the documentation. The register details aren’t actually available in the documentation, you’ll need to download the API and get them from there:

I’d recommend going through the documentation from ST:

Here’s the file I think you’d need to modify to get it working:

2 Likes