Blog

Ultimate VL53L0X Laser Distance Sensor Module – ToF Range Finder

Time-of-Flight Sensor

VL53L0X Laser Distance Sensor Module

High-Accuracy ToF Range Finder – Black Edition

The VL53L0X is a state-of-the-art laser ranging sensor based on time-of-flight (ToF) principle. It delivers precise absolute distance measurements up to 2 meters regardless of target reflectance. This black version offers the same reliable performance with a sleek matte finish for professional projects.

Up to 2 m
Measurement Range
1 mm
Resolution
I2C (400 kHz)
Interface

Key features

Time-of-Flight Technology

Uses VCSEL laser and SPAD array for accurate distance sensing independent of object color or texture.

Fast Measurement Speed

Capable of up to 50 Hz ranging rate for real-time applications.

Low Power Consumption

Operates at 2.6V to 3.5V with typical current draw of 19 mA during active ranging.

Programmable Resolution

Adjustable timing budget and inter-measurement period to trade speed for accuracy.

On-Chip Ambient Cancellation

Built-in ambient light suppression ensures reliable operation indoors and outdoors.

Compact Form Factor

Small 4.4 mm × 2.4 mm LGA package mounted on a breakout board with 7-pin header.

Technical specifications

Supply Voltage 2.6 – 3.5 V DC
Average Current 19 mA (active)
Standby Current < 5 µA
Ranging Range 30 mm – 2000 mm
Accuracy ±3% at 1 m
Resolution 1 mm
Field of View 25°
Communication I2C (up to 400 kHz)
I2C Address 0x29 (default)
Operating Temperature -20°C to 70°C
Dimensions 12.8 × 18.1 × 2.5 mm (board)
Weight 1.2 g

Pinout

PinFunction
VIN Power supply (2.6–3.5V)
GND Ground
SCL I2C clock line
SDA I2C data line
XSHUT Hardware shutdown / reset (active low)
GPIO General-purpose interrupt / output

Applications

Obstacle avoidance in robotics Proximity sensing for smart home devices Gesture recognition and user interfaces Distance measurement for drones and UAVs Level sensing in tanks or hoppers People counting and occupancy detection Industrial automation and safety systems

What's in the box

VL53L0X distance sensor module (black PCB)
2x 7-pin male header strips
1x 4-pin JST SH cable (optional)

Downloads

Datasheet (PDF) Application Note Arduino Library Schematic (PDF)
🔌
Pin Connections
1 Table
Pin Connections Table 1
Board NameComponent / SensorConnection Details
Arduino UnoVL53L0XVCC → 5V (sensor tolerant), GND → GND, SDA → A4, SCL → A5. I2C lines are 3.3V; sensor module has built-in level shifters, so direct connection is safe.
Arduino NanoVL53L0XVCC → 5V, GND → GND, SDA → A4, SCL → A5. Same as Uno.
Arduino MegaVL53L0XVCC → 5V, GND → GND, SDA → 20, SCL → 21. I2C lines are 3.3V; module has level shifters.
ESP32VL53L0XVCC → 3.3V (sensor can operate at 3.3V), GND → GND, SDA → GPIO21, SCL → GPIO22. I2C lines are 3.3V, direct connection fine.
ESP8266VL53L0XVCC → 3.3V, GND → GND, SDA → GPIO4 (D2), SCL → GPIO5 (D1). I2C lines are 3.3V, direct connection.
STM32VL53L0XVCC → 3.3V, GND → GND, SDA → PB7 (I2C1), SCL → PB6 (I2C1). Direct 3.3V logic connection.
Raspberry Pi PicoVL53L0XVCC → 3.3V, GND → GND, SDA → GP0 (I2C0), SCL → GP1 (I2C0). Direct 3.3V logic.
📟
VL53L0X ToF Distance Sensor
7 Examples • C/C++ | Boards: Arduino Uno, Arduino Nano, Arduino Mega, ESP32, ESP8266, STM32, Raspberry Pi Pico
VL53L0X on Arduino Uno
VL53L0X on Arduino Nano
VL53L0X on Arduino Mega
VL53L0X on ESP32
VL53L0X on ESP8266
VL53L0X on STM32
VL53L0X on Raspberry Pi Pico
Code Comments:
Arduino Uno code for VL53L0X using Wire library. VCC=5V, SDA=A4, SCL=A5.
📄 File: vl53l0x_on_arduino_uno_arduino_uno.inoArduino Uno
946 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// Arduino Uno - VL53L0X distance sensor
6// Wire uses default pins: SDA=A4, SCL=A5
7// Sensor VCC connected to 5V, GND to GND
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on Arduino Uno");
19
20 // Initialize I2C
21 Wire.begin();
22 if (!lox.begin()) {
23 Serial.println("Failed to initialize VL53L0X!");
24 while (1);
25 }
26 Serial.println("Sensor initialized.");
27}
28
29void loop() {
30 VL53L0X_RangingMeasurementData_t measure;
31 lox.rangingTest(&measure, false); // false = non-blocking
32
33 if (measure.RangeStatus != 4) { // 4 = out of range
34 Serial.print("Distance: ");
35 Serial.print(measure.RangeMilliMeter);
36 Serial.println(" mm");
37 } else {
38 Serial.println("Out of range!");
39 }
40 delay(500);
41}
Code Comments:
Arduino Nano code for VL53L0X. Same pins as Uno (A4, A5).
📄 File: vl53l0x_on_arduino_nano_arduino_nano.inoArduino Nano
868 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// Arduino Nano - VL53L0X distance sensor
6// Wire uses default pins: SDA=A4, SCL=A5
7// Sensor VCC=5V, GND=GND
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on Arduino Nano");
19
20 Wire.begin();
21 if (!lox.begin()) {
22 Serial.println("Failed to initialize VL53L0X!");
23 while (1);
24 }
25 Serial.println("Sensor initialized.");
26}
27
28void loop() {
29 VL53L0X_RangingMeasurementData_t measure;
30 lox.rangingTest(&measure, false);
31
32 if (measure.RangeStatus != 4) {
33 Serial.print("Distance: ");
34 Serial.print(measure.RangeMilliMeter);
35 Serial.println(" mm");
36 } else {
37 Serial.println("Out of range!");
38 }
39 delay(500);
40}
Code Comments:
Arduino Mega code for VL53L0X. I2C pins: 20(SDA), 21(SCL).
📄 File: vl53l0x_on_arduino_mega_arduino_mega.inoArduino Mega
866 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// Arduino Mega - VL53L0X distance sensor
6// Wire uses pins 20 (SDA) and 21 (SCL)
7// Sensor VCC=5V, GND=GND
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on Arduino Mega");
19
20 Wire.begin();
21 if (!lox.begin()) {
22 Serial.println("Failed to initialize VL53L0X!");
23 while (1);
24 }
25 Serial.println("Sensor initialized.");
26}
27
28void loop() {
29 VL53L0X_RangingMeasurementData_t measure;
30 lox.rangingTest(&measure, false);
31
32 if (measure.RangeStatus != 4) {
33 Serial.print("Distance: ");
34 Serial.print(measure.RangeMilliMeter);
35 Serial.println(" mm");
36 } else {
37 Serial.println("Out of range!");
38 }
39 delay(500);
40}
Code Comments:
ESP32 code for VL53L0X. I2C pins: GPIO21(SDA), GPIO22(SCL). 3.3V logic.
📄 File: vl53l0x_on_esp32_esp32.inoESP32
952 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// ESP32 - VL53L0X distance sensor
6// Wire uses default pins: SDA=21, SCL=22
7// Sensor VCC=3.3V, GND=GND (3.3V logic compatible)
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on ESP32");
19
20 // Initialize I2C with custom pins (optional, default is 21,22)
21 Wire.begin(21, 22);
22 if (!lox.begin()) {
23 Serial.println("Failed to initialize VL53L0X!");
24 while (1);
25 }
26 Serial.println("Sensor initialized.");
27}
28
29void loop() {
30 VL53L0X_RangingMeasurementData_t measure;
31 lox.rangingTest(&measure, false);
32
33 if (measure.RangeStatus != 4) {
34 Serial.print("Distance: ");
35 Serial.print(measure.RangeMilliMeter);
36 Serial.println(" mm");
37 } else {
38 Serial.println("Out of range!");
39 }
40 delay(500);
41}
Code Comments:
ESP8266 code for VL53L0X. I2C pins: GPIO4(SDA), GPIO5(SCL). 3.3V logic.
📄 File: vl53l0x_on_esp8266_esp8266.inoESP8266
931 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// ESP8266 - VL53L0X distance sensor
6// Wire uses custom pins: SDA=GPIO4 (D2), SCL=GPIO5 (D1)
7// Sensor VCC=3.3V, GND=GND
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on ESP8266");
19
20 // Set I2C pins: SDA=GPIO4, SCL=GPIO5
21 Wire.begin(4, 5); // SDA, SCL
22 if (!lox.begin()) {
23 Serial.println("Failed to initialize VL53L0X!");
24 while (1);
25 }
26 Serial.println("Sensor initialized.");
27}
28
29void loop() {
30 VL53L0X_RangingMeasurementData_t measure;
31 lox.rangingTest(&measure, false);
32
33 if (measure.RangeStatus != 4) {
34 Serial.print("Distance: ");
35 Serial.print(measure.RangeMilliMeter);
36 Serial.println(" mm");
37 } else {
38 Serial.println("Out of range!");
39 }
40 delay(500);
41}
Code Comments:
STM32 (BluePill) code for VL53L0X. I2C1: PB7(SDA), PB6(SCL). 3.3V logic.
📄 File: vl53l0x_on_stm32_stm32.inoSTM32
943 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// STM32 (BluePill) - VL53L0X distance sensor
6// I2C1 pins: SDA=PB7, SCL=PB6
7// Sensor VCC=3.3V, GND=GND
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on STM32");
19
20 // Initialize I2C1 with pins PB6 (SCL) and PB7 (SDA)
21 Wire.begin(); // default for STM32 is PB6/PB7
22 if (!lox.begin()) {
23 Serial.println("Failed to initialize VL53L0X!");
24 while (1);
25 }
26 Serial.println("Sensor initialized.");
27}
28
29void loop() {
30 VL53L0X_RangingMeasurementData_t measure;
31 lox.rangingTest(&measure, false);
32
33 if (measure.RangeStatus != 4) {
34 Serial.print("Distance: ");
35 Serial.print(measure.RangeMilliMeter);
36 Serial.println(" mm");
37 } else {
38 Serial.println("Out of range!");
39 }
40 delay(500);
41}
Code Comments:
Raspberry Pi Pico code for VL53L0X. I2C0: GP0(SDA), GP1(SCL). 3.3V logic.
📄 File: vl53l0x_on_raspberry_pi_pico_raspberry_pi_pico.inoRaspberry Pi Pico
953 characters
1/*
2 * ekostra.com
3 * ekostra electronics store in egypt
4 */
5// Raspberry Pi Pico - VL53L0X distance sensor
6// I2C0 pins: SDA=GP0, SCL=GP1
7// Sensor VCC=3.3V, GND=GND
8
9#include <Wire.h>
10#include <Adafruit_Sensor.h>
11#include <Adafruit_VL53L0X.h>
12
13Adafruit_VL53L0X lox = Adafruit_VL53L0X();
14
15void setup() {
16 Serial.begin(115200);
17 while (!Serial) { delay(10); }
18 Serial.println("VL53L0X test on Raspberry Pi Pico");
19
20 // Initialize I2C0 on GP0 (SDA) and GP1 (SCL)
21 Wire.setSDA(0);
22 Wire.setSCL(1);
23 Wire.begin();
24 if (!lox.begin()) {
25 Serial.println("Failed to initialize VL53L0X!");
26 while (1);
27 }
28 Serial.println("Sensor initialized.");
29}
30
31void loop() {
32 VL53L0X_RangingMeasurementData_t measure;
33 lox.rangingTest(&measure, false);
34
35 if (measure.RangeStatus != 4) {
36 Serial.print("Distance: ");
37 Serial.print(measure.RangeMilliMeter);
38 Serial.println(" mm");
39 } else {
40 Serial.println("Out of range!");
41 }
42 delay(500);
43}
Multi-board support for VL53L0X laser distance sensor using I2C. Includes voltage compatibility notes and pin mappings for each board.
For best accuracy, calibrate the sensor by measuring a known distance and adjusting the timing budget. Keep the cover glass clean and avoid direct sunlight for reliable readings.