Adafruit VL53L0X Time of Flight Micro-LIDAR Distance Sensor Breakout Created by lady ada Last updated on 2018-08-22 03:57:47 PM UTC
Guide Contents Guide Contents Overview Sensing Capablities Pinouts 2 3 5 8 Power Pins: I2C Logic pins: 8 8 Control Pins: Assembly 8 10 Prepare the header strip: Solder! Arduino Code Download Adafruit_VL53L0X Load Demo Connecting Multiple Sensors Python & CircuitPython CircuitPython Microcontroller Wiring Python Computer Wiring CircuitPython Installation of VL53L0X Library Python Installation of VL53L0X Library CircuitPython & Python Usage Full Example Code Python Docs Downloads Files & Datasheets Sch
Overview 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.
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. You can use it with any 3-5V power or logic microcontroller with no worries. Each order comes with a small piece of header. Solder the header onto your breakout board with your iron and some solder and wire it up for instant distance-sensing-success! © Adafruit Industries https://learn.adafruit.
Communicating to the sensor is done over I2C with an API written by ST, so its not too hard to port it to your favorite microcontroller. We've written a wrapper library for Arduino so you can use it with any of your Arduino-compatible boards. Sensing Capablities 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. © Adafruit Industries https://learn.adafruit.
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. © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
Pinouts 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 Power Pins: Vin - this is the power pin. Since the chip uses 2.
© Adafruit Industries https://learn.adafruit.
Assembly Don't forget to remove the protective cover off the sensor, it may be a clear or slightly tinted plastic! Otherwise you will get incorrect readings This page shows the VL53L0X or VL6180X sensor - the procedure is identical! Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down © Adafruit Industries https://learn.adafruit.
Place the Breakout board on top so the shorter ends of the pins line up though all the pads Solder! Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
OK You're done! Check your work over and continue on to the next steps © Adafruit Industries https://learn.adafruit.
Arduino Code You 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.
Then search for Adafruit VL53L0X and click Install We also have a great tutorial on Arduino library installation at: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use (https://adafru.it/aYM) Load Demo Open up File->Examples->Adafruit_VL53L0X->vl53l0x and upload to your Arduino wired up to the sensor Thats it! Now open up the serial terminal window at 115200 speed to begin the test. © Adafruit Industries https://learn.adafruit.
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 Don't forget to remove the protective plastic cover from the sensor before using! Connecting Multiple Sensors I2C only allows one address-per-device so you have to make sure each I2C device has a unique address. The default address for the VL53L0X is 0x29 but you can change this in software. To set the new address you can do it one of two ways.
sensor to 7. Repeat for each sensor, turning each one on, setting a unique address. Note you must do this every time you turn on the power, the addresses are not permanent! © Adafruit Industries https://learn.adafruit.
Python & CircuitPython It's easy to use the VL53L0X sensor with Python and CircuitPython, and the Adafruit CircuitPython VL53L0X (https://adafru.it/C62) module. This module allows you to easily write Python code that reads the range from the sensor. You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library (https://adafru.it/BSN).
adafruit_vl53l0x.mpy adafruit_bus_device You can also download the adafruit_vl53l0x.mpy from its releases page on Github (https://adafru.it/C63). Before continuing make sure your board's lib folder or root filesystem has the adafruit_vl53l0x.mpy, and adafruit_bus_device files and folders copied over. Next connect to the board's serial REPL (https://adafru.it/Awz)so you are at the CircuitPython >>> prompt.
See the simpletest.py example (https://adafru.it/C64) for a complete demo of printing the range every second. Save this as code.py on the board and examine the REPL output to see the range printed every second. That's all there is to using the VL53L0X with CircuitPython! Full Example Code # Simple demo of the VL53L0X distance sensor. # Will print the sensed range/distance every second. import time import board import busio import adafruit_vl53l0x # Initialize I2C bus and sensor. i2c = busio.I2C(board.
Python Docs Python Docs (https://adafru.it/C65) © Adafruit Industries https://learn.adafruit.
Downloads Files & Datasheets Datasheet for the VL53L0X (https://adafru.it/sDw) ST product page (https://adafru.it/sDx) with more details including API downloads Fritzing object in Adafruit Fritzing library (https://adafru.it/aP3) EagleCAD PCB files in GitHub (https://adafru.it/sDy) Adafruit VL53L0X library (https://adafru.it/sDz) Pololu Vl53L0X library (https://adafru.it/sTf) Schematic & Fabrication Print Use M2.5 or #2-56 screws to mount © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.