Measuring Distance with a Laser VL53L0X 6-Pin Module and LCD1602-I2C for Arduino
In this tutorial, we will learn how to measure distance using the VL53L0X laser sensor and display the results on an LCD1602 with I2C interface. This project allows you to obtain precise distance measurements in either millimeters or centimeters, making it a versatile addition to any Arduino-based project. By the end of this tutorial, you will have a fully functional distance measurement system that is easy to set up and use.

To achieve this, we will utilize the VL53L0X laser distance sensor, which communicates with the Arduino via I2C. The LCD1602 display will provide a clear visual representation of the measured distance. For clarity on the coding process, please refer to the video at (in video at 00:00).
Hardware Explained
The main components in this build are the VL53L0X laser distance sensor and the LCD1602 display. The VL53L0X utilizes a laser to measure distance accurately, making it suitable for various applications, including robotics and automation. It operates using I2C communication, which allows for easy integration with the Arduino.
The LCD1602 display is an I2C-enabled character display that can show up to 16 characters on two lines. It simplifies the process of displaying data, as it requires fewer pins than traditional LCDs. Together, these components create a powerful and user-friendly distance measurement system.
Datasheet Details
| Manufacturer | STMicroelectronics |
|---|---|
| Part number | VL53L0X |
| Logic/IO voltage | 1.8 V to 2.8 V |
| Supply voltage | 2.6 V to 3.5 V |
| Output current (per channel) | … |
| Peak current (per channel) | … |
| PWM frequency guidance | … |
| Input logic thresholds | … |
| Voltage drop / RDS(on) / saturation | … |
| Thermal limits | … |
| Package | … |
| Notes / variants | … |
- Ensure proper power supply voltage (2.6 V to 3.5 V).
- Use pull-up resistors on SDA and SCL lines if needed.
- Keep the sensor away from reflective surfaces to avoid erroneous readings.
- Verify I2C address (default is 0x29 for VL53L0X).
- Consider heat dissipation if using in high-temperature environments.
Wiring Instructions

To wire the VL53L0X sensor and the LCD1602 display, start by connecting the power and ground. Connect the VCC pin of the VL53L0X to the 5V pin on the Arduino and the GND pin to the Arduino's ground. For the LCD1602, connect its VCC to the same 5V and GND to ground as well.
Next, connect the I2C communication lines. The SDA pin of the VL53L0X should be connected to the A4 pin on the Arduino, and the SCL pin should go to A5. The XSHUT pin can be connected to D12 on the Arduino, but it can also be left unconnected. For the LCD1602, ensure SDA and SCL are also connected to the same pins as the VL53L0X sensor.
Code Examples & Walkthrough
VL53L0X sensor;
#include
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
Wire.begin();
sensor.init();
sensor.setTimeout(500);
sensor.startContinuous();
lcd.begin();
lcd.backlight();
}
In the setup function, we initialize the serial communication and the I2C bus. The sensor.init() initializes the VL53L0X sensor, while lcd.begin() initializes the LCD display. The display's backlight is turned on, allowing for easy visibility.
void loop() {
int distance = sensor.readRangeContinuousMillimeters();
Serial.print("Distance: ");
lcd.clear();
lcd.print("Robojax VL53L0X");
lcd.setCursor(0,1);
lcd.print("Dist.: ");
lcd.setCursor(7,1);
lcd.print(distance);
Serial.println();
delay(100);
}
Inside the loop, we continuously read the distance using sensor.readRangeContinuousMillimeters() and print it to the serial monitor. The LCD is updated with the distance measurement, providing real-time feedback. The delay of 100 milliseconds ensures that the readings are not updated too frequently, allowing for easy reading.
Demonstration / What to Expect
When powered on, the system will continuously measure the distance and display the results on the LCD. You can expect to see the distance values change as you move objects closer or further away from the sensor. If there are any issues with the sensor, such as timeout errors, appropriate messages will be printed to the serial monitor (in video at 03:15).
Things you might need
-
AmazonPurchase VL53L0X from Amazonamzn.to
-
eBayPurchase VL53l0x from eBayebay.us
-
AliExpressPurchase 1 to 10 pcs of VL53L0X from AliExpresss.click.aliexpress.com
-
BanggoodPurchase 1 to 10 pcs of VL53L0X from Banggoodbanggood.com
Resources & references
-
ExternalAdafruit download pagelearn.adafruit.com
-
ExternalPurchase 1 to 10 pcs of VL53L0X from AliExpresss.click.aliexpress.com
-
ExternalPurchase 1 to 10 pcs of VL53L0X from Banggoodbanggood.com
-
ExternalPurchase VL53l0x from eBayebay.us
-
ExternalVL53L0X datasheet (PDF)st.com
Files📁
Fritzing File
-
VL53L0X_Distance_sensor_Squares
application/zip0.02 MB
Other files
-
Adafruit VL53L0X library from Robojax
robojax-VL52L0X_Adafruit_VL53L0X-master.zip -
VL53L0X_Distance_sensor_purple
application/zip0.01 MB