Measure distance using VL53L0X ToF LASER Range sensor + Arduino + OLED (mm/cm/in)
A video tutorial if needed
Hi, this tutorial is about distance measuring using the GY-VL53L0X ToF sensor, with Arduino Uno board, we’ll go through a test then a little project using an OLED screen and a pushbutton to measure in different units (Metrics, Imperial).
So the sensor uses the ToF (Time of Flight) technique, it sends a LASER beam to the target and as long as it’s in the range, the LASER reflects back and get detected by the sensor, the duration between emitting and receiving is measured, the velocity is already known (approx = c, speed of light, and if there’s a mistake, a calibration is always possible), then we can calculate the distance, Distance = Velocity * Time.
One of the advantages of the ToF method, is that it can achieve higher ranges, of course depending on the module used, here as usual we’re using 2-3$ ones, but it’s a very precise module thanks to the fine LASER used, not like the Ultrasound modules, or IR ones, that spreads a wide wave, and can mislead the readings, but they have their own useful applications though.
Range and accuracy
The module’s range depends on the surface colour and the mode, there are two modes: default one (we’re using) and the long range one, in the default mode it can handle up to 1200mm (1,2m ; 40 in).
So for this project, alongside some jump wires we’ll be using
The module is actually very small, around (1.5cm by 1cm) very useful for small applications like ToF10120
- VL53L0X library: Download here Adafruit VL53L0X library
- OLED libraries: – Download here Adafruit OLED SSD1306 library – Download here Adafruit GFX Library
- The first code I tried is a library example, you’ll find one that uses the OLED too
- The second code that uses the OLED and button you can download it here
First test with Serial monitor
Second test using OLED + push button
The strange part here, is that I couldn’t write some sentences in the OLED screen, like as Out of range, I just wrote OoR, I wanted to add “distance” while measuring but couldn’t too, the whole OLED goes black, also there are some strange spotson the bottom right, if someone can explain please welcome. Otherwise here are the results:
You can of course add or remove units as you want, it’s simple. Check the video tutorial if you need help, or want to see the demo.
Yassine View All
Automation and Electrical Engineer, Electronics amateur trying to share my little projects.
Leave a Reply