VL53L0X Arduino Interface

This Article describes about VL53L0X Arduino Interface and worlds smallest Time of Flight ranging and gesture sensor from st and Adafruit breakout board.




We use different types of sensors to measrue distance and proximity, those are gives range and distance details by using different techniques, however when we consider the size of sensor, it may large than the microcontroller IC, and those sensors may not accurate from mm (millimeter) distance measurement.

The VL53L0X (ToF) Time of Flight laser ranging module housed in the smallest package (4.4 x 2.4 x 1.0 mm) from st. This module will provide accurate distance measurement and it can measure absolute distance upto 2m.

VL53L0X Block diagram

from st VL53L0X datasheet 

VL53L0X uses single photon avalanche diodes (SPAD) array, and 940nm vertical cavity surface emitter laser (invisible to human eye) enables longer ranging distance. This sensor module has higher immunity to ambient light and better robustness.

VL53L0X Breakout Board

Time of Flight micro LIDAR distance sensor breakout board from Adafruit. This breakout works with different microcontrollers through I2C communication and it is Arduino friendly, the Adafruit gives arduino library to VL53L0X. By using that library we can easily interface the breakout board and measure distance.

Arduino VL53L0X Interfacing

Connect the breakout board pins to Arduino board as shown in connection diagram, Vin pin of breakout board is connected to 5V Arduino pin and this board can operate by 3.3V also, Gnd to Arduino Gnd pin then SCL, SDA pins of breakout board to Arduino SCL, SDA pins.

Note: here PC5 (SCL), PC4 (SDA) pins after AREF used as I2C pins, if you can’t find those pins in your Arduino board simply use A4(SDA), A5(SCL) pins.




VL53L0X Arduino Example Code

 

#include "Adafruit_VL53L0X.h"

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);

  // wait until serial port opens for native USB devices
  while (! Serial) {
    delay(1);
  }
  
  Serial.println("Adafruit VL53L0X test");
  if (!lox.begin()) {
    Serial.println(F("Failed to boot VL53L0X"));
    while(1);
  }
  // power 
  Serial.println(F("VL53L0X API Simple Ranging example\n\n")); 
}


void loop() {
  VL53L0X_RangingMeasurementData_t measure;
    
  Serial.print("Reading a measurement... ");
  lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!

  if (measure.RangeStatus != 4) {  // phase failures have incorrect data
    Serial.print("Distance (mm): "); Serial.println(measure.RangeMilliMeter);
  } else {
    Serial.println(" out of range ");
  }
    
  delay(100);
}

Going Further

  1. http://www.st.com/en/imaging-and-photonics-solutions/vl53l0x.html
  2. https://www.adafruit.com/product/3317
  3. https://github.com/adafruit/Adafruit_VL53L0X

Add a Comment

Your email address will not be published. Required fields are marked *