Time of flight with the new VL53L0X on the Raptor G400

Hello,

I have adapted the driver from Pololu (arduino driver) for the FEZ Raptor for the VL53L0X Time-of-Flight Distance Sensor Carrier with Voltage Regulator, 200cm Max.
This driver is left “like this”

It’s work on my robot. (you can download the zip file). 2 classes (I2C and VL53L0X.cs and VL53L0X.h)

To initialize the sensors, just send this command :

        #region Démarrage des Télémetre lasers
    VL53L0X LIDARLIN = new VL53L0X(0x29, 400, 500);             // Lidar lineaire VL53L0X
        if(LIDARLIN.init(false))       // Pas besoin de travailler avec 2.8V sur le capteur
        {
            RobotBluetooth.EnvoiCaracteresAuPC("Capteur VL53L0X ok\n\r");
        }
        else
        {
            RobotBluetooth.EnvoiCaracteresAuPC("ERREUR Probleme avec le Capteur VL53L0X\n\r");
        }
        // Just choose between this 3 modes. 
        // 
        #if (LONG_RANGE)
        #region LONG_RANGE

        // lower the return signal rate limit (default is 0.25 MCPS)
        LIDARLIN.setSignalRateLimit(0.1f);
        // increase laser pulse periods (defaults are 14 and 10 PCLKs)
        LIDARLIN.setVcselPulsePeriod((int)(vcselPeriodType.VcselPeriodPreRange), 18);     // Prerange 
        LIDARLIN.setVcselPulsePeriod((int)(vcselPeriodType.VcselPeriodFinalRange), 14);     // Finalrange

        #endregion
        #endif
        #if(HIGH_SPEED)
        #region HIGH_SPEED
                        // reduce timing budget to 20 ms (default is about 33 ms)
                        LIDARLIN.setMeasurementTimingBudget(20000);
        #endregion
        #endif
        #if(HIGH_ACCURACY)
        #region defined HIGH_ACCURACY
                        // increase timing budget to 200 ms
                        LIDARLIN.setMeasurementTimingBudget(200000);
        #endregion
        #endif
        #endregion

And for use this sensor.

                UInt16 distancemm= LIDARLIN.readRangeSingleMillimeters();
                LogInfo("L," + RobotBluetooth.EnvoiCaracteresAuPC("Distance[mm]: "+ distancemm.ToString()+"\n\r"));
                if (LIDARLIN.timeoutOccurred()==true)
                {
                    LogInfo("L," + RobotBluetooth.EnvoiCaracteresAuPC("Timeout LIDAR VLX\n\r"));
                }

Enjoy !

Excuse me for the french comments… I speak french and sometimes I forget my english… :wink:

Original Pololu link : GitHub - pololu/vl53l0x-arduino: Pololu Arduino library for VL53L0X time-of-flight distance sensor

4 Likes

THANK YOU for sharing!

I have been looking at several Time-of-Flight sensors but I cannot decide on using short or long range.

I guess I will have to try both.
You code will be a BIG help!

Awesome, I was just in the process of converting the same driver for my implementation!

:+1:
Hope I can help you !

I’ve been looking at this sensor for while but haven’t had the time to dive in. Do you have any idea what kind of precision you can achieve? I don’t usually care about absolute accuracy but I do need to be able to detect a small change in motion. One simple test would be to record 100 or so measurements from a target that is absolutely stationary. If you’re interested in doing that and posting or sending me the data, I’ll be happy to run some statistics.

Hello,

After somes test :
The absolute precision is about 5% in HIGHSPEED mode.
In HIGHACCURACY mode, the absolute précision is better about 3%.
In HIGHSPEED mode, the relative precision is about 2%
In HIGHACCURACY, the relative precision fall to 1% (or litte bit better).
Well, all tests was be done with as a reflector an flat white wall. If you put a cylinder on the beam, the results will be bad…

In HIGHACCURACY, the time for read the values is more than in HIGHSPEED mode.
ST don’t give any informations (datasheet) how we can use the sensor more accuratly. I use the originals values from the pololu driver

It’s my observations.

@septic - Did you build or buy a VL53L0X sensor? If you bought it, which one?

@munderhill,
Ihave bought these sensors at

Thanks very much for the update. Can you explain in a little more detail what you mean by “absolute precision” and “relative precision”?

Hi,

Excuse my for my english…

Relative precision is relative accuracy… (my robot move of 100mm and the sensor value change of 98 mmm = 2% of error)
The absolute precision is the value measured by the sensor and compared with the real distance.

I Hope help you .

Perfect, thanks very much.