Vl530x TOF (Time of Flight distance sensor)
The VL53L0X is a Time of Flight distance sensor like no other you’ve used! The sensor contains a very tiny invisible laser source, and a matching sensor. The VL53L0X can detect the “time of flight”, or how long the light has taken to bounce back to the sensor. Since it uses a very narrow light source, it is good for determining distance of only the surface directly in front of it. Unlike sonars that bounce ultrasonic waves, the ‘cone’ of sensing is very narrow. Unlike IR distance sensors that try to measure the amount of light bounced, the VL53L0x is much more precise and doesn’t have linearity problems or ‘double imaging’ where you can’t tell if an object is very far or very close.
This is the ‘big sister’ of the VL6180X ToF sensor, and can handle about 50 – 1200 mm of range distance. If you need a smaller/closer range, check out the VL6180X which can measure 5mm to 200mm.
The sensor is small and easy to use in any robotics or interactive project. Since it needs 2.8V power and logic we put the little fellow on a breakout board with a regulator and level shifting.
The sensor can measure approximately 50mm to 1.2 meter in default mode.
In ‘long range’ mode you can detect as far as 1.5 to 2 meters on a nice white reflective surface.
Depending on ambient lighting and distance, you’ll get 3 to 12% ranging accuracy – better lighting and shiny surfaces will give you best results. Some experimentation will be necessary since if the object absorbs the laser light you won’t get good readings.
The VL53L0X is a I2C sensor. That means it uses the two I2C data/clock wires available on most microcontrollers, and can share those pins with other sensors as long as they don’t have an address collision.
For future reference, the default I2C address is 0x29. You can change it, but only in software. That means you have to wire the SHUTDOWN pin and hold all but one sensor in reset while you reconfigure one sensor at a time
- Vin – this is the power pin. Since the chip uses 2.8 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller – e.g. for a 5V micro like Arduino, use 5V
- 2v8 – this is the 2.8V output from the voltage regulator, you can grab up to 100mA from this if you like
- GND – common ground for power and logic
I2C Logic pins:
- SCL – I2C clock pin, connect to your microcontrollers I2C clock line.
- SDA – I2C data pin, connect to your microcontrollers I2C data line.
- GPIO – this is a pin that is used by the sensor to indicate that data is ready. It’s useful for when doing continuous sensing. Note there is no level shifting on this pin, you may not be able to read the 2.8V-logic-level voltage on a 5V microcontroller (we could on an arduino UNO but no promises). Our library doesn’t make use of this pin but for advanced users, it’s there!
- SHDN – the shutdown pin for the sensor. By default it’s pulled high. There’s a level-shifting diode so you can use 3-5V logic on this pin. When the pin is pulled low, the sensor goes into shutdown mode.
ou can easily wire this breakout to any microcontroller, we’ll be using an Arduino. For another kind of microcontroller, just make sure it has I2C, then port the API code. We strongly recommend using an Arduino to start though!
- Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
- Connect GND to common power/data ground
- Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & ‘328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
- Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & ‘328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
To begin reading sensor data, you will need to install the Adafruit_VL53L0X Library.
The easiest way to do that is to open up the Manage Libraries… menu in the Arduino IDE
Then search for Adafruit VL53L0X and click Install
Open up File->Examples->Adafruit_VL53L0X->vl53l0x and upload to your Arduino wired up to the sensor
hats it! Now open up the serial terminal window at 115200 speed to begin the test.
Move your hand up and down to read the sensor data. Note that when nothing is detected, it will say the reading is out of range
- From 3D mapping
- industrial automation
- obstacle detection
- autonomous vehicles
- indoor navigation
- gesture recognition
- object scanning
- measure volumes
- Surveillance to even augmented reality.