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
Guide to the HWFS-1 Anemometer
A passive, cup-style wind speed sensor with a built-in voltage generator, no external power needed. This guide covers the analog output, wiring to an ESP32 ADC pin, and the calibration formula to convert voltage into km/h or m/s.
Read more
Reference
INA219 / INA226 Voltage, Current and Power Sensor Complete Guide
The INA219 and INA226 measure voltage, current and power on a low-voltage DC bus over I2C, using a shunt resistor and Ohm's law, not the mains-AC energy-meter ICs this site already covers. This guide covers both chips' real specs, wiring one to an ESP32, and which to pick for a battery or power-budget project.
Read more
Reference
MH-RD Raindrop Detection Module
A low-cost rain sensor built from two boards: a copper-trace sensor plate and an LM393 comparator breakout. Covers the pinout, how the analog/digital outputs behave when the plate gets wet, and wiring it to an ESP32 or Arduino.
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