

The GY-VL53L0XV2 is a compact and highly accurate time-of-flight (ToF) sensor module that uses laser technology to measure distances. It operates by emitting a laser pulse and calculating the time it takes for the pulse to reflect back to the sensor, enabling precise distance measurements. This sensor is ideal for applications such as robotics, automation, obstacle detection, and proximity sensing. Its small size and low power consumption make it suitable for integration into a wide range of projects.








The GY-VL53L0XV2 module typically has six pins. Below is the pinout and description:
| Pin | Name | Description |
|---|---|---|
| 1 | VIN | Power supply input (2.6V to 5.5V). Connect to the 5V or 3.3V pin of your microcontroller. |
| 2 | GND | Ground. Connect to the ground of your circuit. |
| 3 | SDA | I²C data line. Used for communication with the microcontroller. |
| 4 | SCL | I²C clock line. Used for communication with the microcontroller. |
| 5 | XSHUT | Shutdown pin. Pull low to put the sensor in shutdown mode. |
| 6 | GPIO1 | Interrupt pin. Can be used for advanced configurations. |
Below is an example of how to use the GY-VL53L0XV2 with an Arduino UNO:
#include <Wire.h>
#include <VL53L0X.h>
// Create an instance of the VL53L0X sensor
VL53L0X sensor;
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
Wire.begin(); // Initialize I²C communication
// Initialize the sensor
if (!sensor.init()) {
Serial.println("Failed to initialize VL53L0X sensor!");
while (1); // Halt execution if initialization fails
}
sensor.setTimeout(500); // Set a timeout for distance measurements
Serial.println("VL53L0X sensor initialized successfully.");
}
void loop() {
// Measure distance in millimeters
uint16_t distance = sensor.readRangeSingleMillimeters();
// Check for timeout errors
if (sensor.timeoutOccurred()) {
Serial.println("Sensor timeout occurred!");
} else {
// Print the measured distance
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" mm");
}
delay(100); // Wait 100ms before the next measurement
}
VL53L0X library simplifies communication with the sensor.setTimeout() function prevents the program from hanging if the sensor fails to respond.delay() value in the loop() function to adjust the measurement frequency.Sensor Not Detected on I²C Bus:
Incorrect Distance Measurements:
Sensor Timeout Errors:
setTimeout() function.Multiple Sensors on the Same I²C Bus:
Q: Can the GY-VL53L0XV2 measure distances beyond 2 meters?
A: No, the maximum range of the sensor is 2 meters under optimal conditions.
Q: Is the laser emitted by the sensor safe for human eyes?
A: Yes, the VL53L0X uses a Class 1 laser, which is safe for human eyes under normal operating conditions.
Q: Can I use this sensor with a 3.3V microcontroller?
A: Yes, the sensor is compatible with both 3.3V and 5V systems.
Q: How do I modify the I²C address of the sensor?
A: Use the XSHUT pin to reset the sensor, then configure a new address in your code before reinitializing it.
By following this documentation, you can effectively integrate the GY-VL53L0XV2 LASER ToF sensor into your projects for accurate distance measurement.