ESP32 VL6180X Time-of-Flight Sensor Pinout, Wiring, ESP32 and more
Overview
The VL6180X is a short-range proximity and ambient light sensor that combines a 3-in-1 system: IR emitter, sensor, and ranging processor. It is ideal for gesture recognition, presence detection, and compact robotics applications.
Choose Your Platform
About VL6180X Time-of-Flight Sensor
📏 VL6180X Sensor Overview
- Range: 0cm to 50cm (Max)
- Interface: I²C digital communication
- Resolution: 1mm precision
- Field of View: 25°
- Operating Voltage: 2.8V to 5V (via onboard regulator)
- Typical Current: ~20–30mA
- Wavelength: 850nm IR
- Integrated Ambient Light Sensor
Where to Buy VL6180X Time-of-Flight Sensor
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
VL6180X Datasheet and Technical Specifications
VL6180X Pinout Diagram
The VCC pin is used to supply power to the sensor,
and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements).
The GND pin is the ground connection and must be
connected to the ground of your ESP32.
- VIN: Power supply input (3.3V–5V)
- GND: Ground
- SHDN: Shutdown (active low)
- SDA: I²C Data
- SCL: I²C Clock
- GPIO: Interrupt or general I/O
- 2v8: Regulated 2.8V output
VL6180X Troubleshooting Guide
Common Issues
❌ No Output or Initialization Failure
Issue: Sensor not responding or Adafruit library cannot detect it.
Solution: Verify wiring, power level, and ensure SHDN is pulled high.
📉 Distance Stuck at Zero or Max
Issue: Only returns 0mm or 50mm constantly.
Solution: Ensure target is in range and sensor is facing it directly. Check for surface reflectivity.
⚡ Unstable Power Supply
Issue: Fluctuating or erratic readings.
Solution: Use a clean 3.3V/5V supply and decoupling capacitor. Avoid connecting SHDN to a floating pin.
Debugging Tips
🔍 Serial Monitor
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
⚡ Voltage Checks
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
VL6180X Code Examples
Arduino Example
#include <Wire.h>
#include "Adafruit_VL6180X.h"
Adafruit_VL6180X vl = Adafruit_VL6180X();
void setup() {
Serial.begin(115200);
Wire.begin();
if (!vl.begin()) {
Serial.println("Failed to find VL6180X sensor!");
while (1);
}
Serial.println("VL6180X ready!");
}
void loop() {
uint8_t range = vl.readRange();
Serial.print("Distance: ");
Serial.print(range);
Serial.println(" mm");
delay(500);
}
ESPHome Example
i2c:
sda: 21
scl: 22
sensor:
- platform: vl6180x
name: "VL6180X Distance"
update_interval: 1s
MicroPython Example
from machine import I2C, Pin
import time
from vl6180x import VL6180X
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
tof = VL6180X(i2c)
while True:
distance = tof.read()
print("Distance: {} mm".format(distance))
time.sleep(0.5)
vl6180x.py driver module.
Conclusion
The ESP32 VL6180X Time-of-Flight Sensor is a powerful distance sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.








