Blogs
VL53L0X Purple Laser Distance Sensor Module
VL53L0X Laser Distance Sensor Module
High-Speed, High-Precision Time-of-Flight Distance Measurement
Introduction
The VL53L0X is a state-of-the-art Time-of-Flight (ToF) laser-ranging sensor that provides accurate distance measurement up to 2 meters. Using an invisible 940nm laser, it offers millimeter precision with fast response times, making it ideal for applications requiring reliable proximity and distance sensing.
Key Features
High Precision
±3% accuracy with millimeter resolution
Fast Response
Measurement time as low as 30ms
Small Form Factor
Compact 4.9 × 2.5 × 1.56mm package
I2C Interface
Simple connection with 2.6V-3.5V microcontrollers
Technical Specifications
Measurement Range | 30mm – 2000mm (2m) |
---|---|
Accuracy | ±3% (typical) |
Laser Wavelength | 940nm (invisible to human eye) |
Interface | I2C (0x29 default address) |
Supply Voltage | 2.6V – 3.5V (5V tolerant I/O) |
Current Consumption | 19mA active, 5μA standby |
Field of View | 25° (typical) |
Measurement Time | 30ms (typical) |
Pin Configuration

Pin | Label | Description | Arduino Connection |
---|---|---|---|
1 | VCC | Power (2.6V-3.5V) | 3.3V |
2 | GND | Ground | GND |
3 | SCL | I2C Clock | A5 (Uno) or SCL |
4 | SDA | I2C Data | A4 (Uno) or SDA |
5 | GPIO1 | Interrupt output (optional) | Digital pin (optional) |
6 | XSHUT | Shutdown control (optional) | Digital pin (optional) |
Note: The sensor requires proper power supply (2.6V-3.5V) for accurate measurements
Wiring with Arduino
1 2 3 4 5 6 7 8 9 10 11 |
// Basic I2C Connections: // VCC → 3.3V // GND → GND // SCL → A5 (Uno) or SCL // SDA → A4 (Uno) or SDA // Optional connections: // GPIO1 → Digital pin (for interrupt functionality) // XSHUT → Digital pin (for sensor reset) // Requires Pololu VL53L0X library |
Important: Use proper voltage level shifting if connecting to 5V Arduino boards
Basic Distance Measurement Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
// VL53L0X Distance Sensor Basic Example #include <Wire.h> #include <VL53L0X.h> VL53L0X sensor; void setup() { Serial.begin(9600); Wire.begin(); sensor.init(); sensor.setTimeout(500); // Start continuous back-to-back mode sensor.startContinuous(); } void loop() { int distance = sensor.readRangeContinuousMillimeters(); if (sensor.timeoutOccurred()) { Serial.println("Timeout"); } else { Serial.print("Distance: "); Serial.print(distance); Serial.println(" mm"); } delay(100); } |
Advanced Features
High Speed Mode
1 2 3 |
// Set high speed measurement mode sensor.setMeasurementTimingBudget(20000); // 20ms timing budget sensor.startContinuous(); |
Long Range Mode
1 2 3 4 |
// Configure for longer range sensor.setSignalRateLimit(0.1); sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18); sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14); |
Interrupt Function
1 2 3 4 |
// Configure interrupt threshold sensor.setInterMeasurementPeriod(100); sensor.setInterruptThresholds(100, 200, false); // mm thresholds // Connect GPIO1 pin to handle interrupts |
Multiple Sensors
1 2 3 4 5 6 |
// Use XSHUT to change I2C addresses digitalWrite(XSHUT_PIN1, LOW); digitalWrite(XSHUT_PIN2, LOW); // Initialize sensors with different addresses sensor1.setAddress(0x30); sensor2.setAddress(0x31); |
Troubleshooting
Sensor Not Detected
- Verify I2C connections (SCL/SDA)
- Check sensor address (default 0x29)
- Ensure proper power supply (2.6V-3.5V)
Inaccurate Readings
- Ensure target is within 25° field of view
- Check for reflective/absorbent surfaces
- Adjust timing budget for conditions
Short Range Only
- Clean sensor lens from dust/dirt
- Check for ambient light interference
- Configure for long range mode