Other Arduino Codes and Videos by Robojax

Measure Distance with Laser VL53L0X 6 pin module for Arduino

دروس آردوینو به فارسی

Measure Distance with Laser VL53L0X 6 pin module for Arduino

This code is to measure distance using laser module ToF Time of Flight VL53L0X 6 pin module. This module is sold on eBay or AliExpress in different color but mostly (as of Jun 2018) sold in pink color.

Use I2C scanner (link below ) to see if wiring is done properly.

VL53L0X Dimensions


VL53L0X Dimensions 2

Dimensions 2

VL53L0X Emitter and Collector cone angles

VL53L0X Emitter and Collector cone angles

Related Videos:

Where to buy it?

-Search eBay (no affiliation) Here
-Search Amazon (no affiliation) Here
-Search AliExpress (no affiliation) Here
-Search Banggood (no affiliation) Here

  /* This example shows how to use continuous mode to take
range measurements with the 6 pin VL53L0X module. It is based on
vl53l0x_ContinuousRanging_Example.c from the VL53L0X API.

The range readings are in units of mm. 

Original source: https://github.com/adafruit/Adafruit_VL53L0X
Modified by Ahmad Shamshiri for RoboJax.com
Date modified: May 31, 2018 at 19:25 at Ajax, Ontario, Canada
Watch the instruciton video for this code https://youtu.be/S2jaAQEv3Yo

Pin connection
VL53L0X Pin  Arduino Pin
VCC         5V
GND         GND
SDA         A4 or SDA if available
SCL         A5 or SCL if available
GPIO1       leave it unconnected
XSHUT       D12 (digital 12 or pin 12)

#include <Wire.h>
#include <VL53L0X.h>

VL53L0X sensor;

void setup()


  // Start continuous back-to-back mode (take readings as
  // fast as possible).  To use continuous timed mode
  // instead, provide a desired inter-measurement period in
  // ms (e.g. sensor.startContinuous(100)).

void loop()
  int distance =sensor.readRangeContinuousMillimeters();
  //int distance =sensor.startContinuous(100);
 //distance = distance;
  Serial.print("Distance: ");
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }


If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal