VL53L0X ToF Laser Distance Sensor
Overview
A high-precision distance sensor based on ToF (Time-of-Flight) principles. Unlike conventional technologies, the VL53L0X provides accurate distance measurements regardless of target reflectance. It can measure absolute distances up to 2m. It uses an I2C interface.

Specifications
- Operating voltage: 3.3V/5V
- Ranging distance: 30 ~ 2000mm
- Ranging accuracy: ±5% (high speed mode), ±3% (high accuracy mode)
- Ranging time (min): 20ms (high speed mode), 200ms (high accuracy mode)
- Field of view: 25°
- Laser wavelength: 940nm
- Operating temperature: -20 ~ 70°C
Supported GPIO
- Raspberry Pi 0~4
- Raspberry Pi 5
- BeagleBone Black/Green
- Jetson Nano
- FT232H, FT2232H, FT4232H
- MCP2221
Commands
[INIT]
Enters initial configuration settings.
Item | Type | Description |
---|---|---|
Timeout (ms) | WRITE | Sets the maximum measurement wait time. |
2V8 Mode | WRITE | Determines whether to use 2V8 mode. Used when power supply is limited, such as with batteries. However, sensor performance and accuracy may be somewhat reduced in this mode. |
[START_CONT]
Starts continuous measurement mode.
[READ_CONT]
Reads the distance measured in continuous measurement mode.
Item | Type | Description |
---|---|---|
Measured Distance (mm) | READ | Distance measured in continuous measurement mode. |
[READ_SINGLE]
Performs a single measurement and reads the distance.
Item | Type | Description |
---|---|---|
Measured Distance (mm) | READ | Distance from a single manual measurement. |
[SET_TIMEOUT]
Sets the timeout duration.
Item | Type | Description |
---|---|---|
Timeout (ms) | WRITE | Sets the maximum measurement wait time. |
[SET_MODE]
Sets the measurement mode.
Item | Type | Description |
---|---|---|
Measurement Mode | WRITE | Sets the measurement mode. (default, long range, high speed, high accuracy) |
[SET_ADDR]
Sets the I2C address.
Item | Type | Description |
---|---|---|
I2C Address | WRITE | Sets the I2C address. The default address is 0x29 and can be changed using this command. |
Example
Objective
Display the measured distance on dashboard widgets. Test by adjusting the distance with your hand and verify that the distance changes.
Parts
Part | Quantity |
---|---|
Raspberry Pi 4 * | 1 |
VL53L0X | 1 |
Wiring
Connect each component to the corresponding connection as listed in each row below.
VL53L0X | GPIO |
---|---|
VIN | 3.3V or 5V |
GND | GND |
SCL | 3 (I2C1 SCL) |
SDA | 2 (I2C1 SDA) |

Project Link