Reference
VL53L0X / VL53L1X Time-of-Flight Distance Sensor Complete Guide
ST Microelectronics' VL53L0X and VL53L1X measure distance by timing a laser pulse's actual flight time, not by inferring it from an echo like an ultrasonic sensor. This guide covers both chips' real specs, wiring one to an ESP32, and which of the two to pick.
The VL53L0X and VL53L1X are laser-ranging (Time-of-Flight, ToF) distance sensors from STMicroelectronics, sold on small breakout boards by Adafruit, Pololu and others. Unlike the ultrasonic HC-SR04, they measure distance by timing a laser pulse’s actual round-trip flight time, giving accurate, narrow-beam readings that work on small or soft targets an ultrasonic sensor can miss.
VL53L0X vs. VL53L1X: real differences
| VL53L0X | VL53L1X | |
|---|---|---|
| Max range | ~1.2m (up to ~2m in long-range mode) | ~4m |
| Field of view | 25° fixed | 15°–27°, programmable |
| Ranging speed | up to 50Hz | up to 50Hz |
| I2C address (default) | 0x29 | 0x29 |
They are not interchangeable drop-ins, the VL53L1X’s library API differs from the VL53L0X’s. Pick the L1X if you need range beyond ~1.2m or a narrower, adjustable field of view, otherwise the cheaper, more common L0X is fine for most robotics/proximity projects.
Pinout and Wiring to an ESP32
| Pin | Function | ESP32 Pin |
|---|---|---|
| VIN | Power, 3.3V–5V (breakout-regulated) | 3.3V |
| GND | Ground | GND |
| SDA | I2C data | GPIO21 |
| SCL | I2C clock | GPIO22 |
| XSHUT | Shutdown (active-low), used to assign a unique address when running multiple sensors on one bus | any free GPIO (optional) |
| GPIO1 | Interrupt output on new-data-ready (optional) | any free GPIO (optional) |
Both chips default to I2C address 0x29. Running more than one on the same bus requires holding all but one in reset via XSHUT, bringing that one up, changing its address in software, then releasing the next, a real, common gotcha for multi-sensor proximity arrays.
Arduino Code Example
VL53L0X (Adafruit_VL53L0X library)
#include <Wire.h>
#include "Adafruit_VL53L0X.h"
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
if (!lox.begin()) {
Serial.println("Failed to find VL53L0X");
while (1) delay(10);
}
}
void loop() {
VL53L0X_RangingMeasurementData_t measure;
lox.rangingTest(&measure, false);
if (measure.RangeStatus != 4) {
Serial.print("Distance (mm): ");
Serial.println(measure.RangeMilliMeter);
} else {
Serial.println("Out of range");
}
delay(200);
}Install “Adafruit VL53L0X” for the L0X, or “Adafruit VL53L1X” for the L1X, both via the Arduino Library Manager, their APIs differ so example code isn’t directly portable between the two chips.
Practical Applications
- Robotics obstacle avoidance: narrower beam than ultrasonic, less prone to false readings off soft/angled surfaces.
- Liquid level sensing: measuring distance down to a surface through open air.
- Gesture/proximity detection: fast enough ranging rate for hand-wave detection.
- Tank/bin fill-level monitoring: the VL53L1X’s longer range suits larger containers.
Conclusion
Both chips give you accurate, narrow-beam laser distance sensing over I2C with almost no external components needed. Pick the VL53L0X for short-range, low-cost projects, or the VL53L1X when you need real range beyond about a meter, and pair either with an ESP32 for a compact proximity sensor.
Related
Reference
STM32F103C8T6 “Blue Pill” Pinout
This site's first STMicroelectronics board and first chip with no wireless radio at all: an Arm Cortex-M3 on a breadboard-friendly board with a decade-long tutorial and library ecosystem, and two well-known clone-batch quirks worth knowing before you plug one in.
Read more
Reference
JL-AD3W-HT-V3 – Everything You Need to Know About This AC-DC Power Supply Module
A compact, mains-connected switch-mode power module that converts AC directly into a regulated 5V DC output, popular in low-cost embedded electronics. This guide covers its electrical specs, pinout, output filtering, and the mains-safety rules that come with using bare board-mount SMPS hardware.
Read more
Guide
Arduino Nano Pinout
The complete pin reference for the classic ATmega328P-based Arduino Nano: 14 digital pins, 8 analog inputs, and the exact pins you can safely reuse.
Read more
More guides
Keep building.
From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.
All guides