VL6180X ToF Distance Sensor
Overview
An optical distance sensor that uses Time-of-Flight (ToF) technology to precisely measure distances to nearby objects (5~100mm) and has an integrated ambient light sensor. Uses I2C interface.

Specifications
- Power Supply Voltage: 3.3V~5V
- Operating Current: <5mA
- Measuring Distance: 5-100mm
- Emitter: 940nm invisible laser (VCSEL)
- I2C Address: 0x29
- Operating Temperature Range: -20℃~85℃
Supported GPIO
- Raspberry Pi 0~4
- Raspberry Pi 5
- BeagleBone Black/Green
- Jetson Nano
- FT232H, FT2232H, FT4232H
- MCP2221
Commands
[READ_RANGE]
Measures the distance to an object. Note that the measured distance is valid only when there is no measurement error (status code = 0).
Item | Type | Description |
---|---|---|
Distance (mm) | READ | Measured distance to the object. |
[READ_RANGE_STATUS]
Returns the distance measurement result as a status code. This command must be executed after READ_RANGE has been executed.
Item | Type | Description |
---|---|---|
Status Code * | READ | Measurement result status code. (0: No error, Others: Error occurred) |
* Status code descriptions are as follows:
0 : Success (No Error)
1 : System error
5 : System error
6 : Early convergence estimate fail
7 : No target detected
8 : Ignore threshold check failed
11 : Ambient conditions too high
12 : Raw range algo underflow
13 : Raw range algo overflow
14 : Raw range algo underflow
15 : Raw range algo overflow
0 : Success (No Error)
1 : System error
5 : System error
6 : Early convergence estimate fail
7 : No target detected
8 : Ignore threshold check failed
11 : Ambient conditions too high
12 : Raw range algo underflow
13 : Raw range algo overflow
14 : Raw range algo underflow
15 : Raw range algo overflow
[READ_LUX]
Measures ambient light (brightness).
Item | Type | Description |
---|---|---|
Gain | WRITE | Sets the gain value for ambient light measurement. Use high values in dark environments and low values in bright environments. |
Ambient Light (lux) | READ | Measured ambient light (brightness). |
[SET_ADDR]
Sets the I2C address.
Item | Type | Description |
---|---|---|
I2C Address | WRITE | Enter the I2C address to set. (e.g., 0x29) |
Example
Objective
Display the distance measured by the sensor using a dashboard label widget.
Parts
Part | Quantity |
---|---|
Raspberry Pi 4 * | 1 |
VL6180X | 1 |
* Other hardware can also be used. Refer to Supported GPIO.
Wiring
Connect the following pins horizontally to each other.
VL6180X | GPIO |
---|---|
VCC | 3.3V |
GND | GND |
SCL | 3 (I2C1 SCL) |
SDA | 2 (I2C1 SDA) |
