Owner: Kaveesha Abeysundara (SID: 201578163)
Project: Automated Tracking of Assembly Line-Side Flow Rack Parts
School of Mechanical Engineering
University of Leeds
LS2 9JT
Arduino code and experimental setup for measuring distances using a VL53L1X laser time-of-flight sensor on an ESP32 board.
- About
- Hardware Setup
- Prerequisites
- Installation
- Usage
- Experimentation & Data Logging
- Repository Structure
- License
- Contact
This repository contains sketches and documentation for experiments with the VL53L1X laser time-of-flight (ToF) sensor on an ESP32. The code demonstrates how to initialize the sensor, perform range measurements and output timestamped distance readings over serial.
Full source code and wiring diagrams are available at laserexperimentcode on GitHub.
Connect the VL53L1X sensor to an ESP32 as follows:
| Sensor Pin | ESP32 Pin | Description |
|---|---|---|
| VIN | 5V | Sensor power |
| GND | GND | Ground |
| SDA | 21 | I2C data line |
| SCL | 22 | I2C clock line |
| XSHUT | 19 | Optional reset |
Ensure 5 V and ground rails are common between sensor and ESP32.
- Arduino IDE v1.8.10 or later
- ESP32 board support installed via Board Manager
- VL53L1X Arduino library (e.g., from Pololu or Adafruit)
- USB cable and ESP32 development board
- Clone the repository:
git clone https://github.com/kav12ab/laserexperimentcode.git
cd laserexperimentcode- Open
laser_experiment.inoin the Arduino IDE. - Install the VL53L1X library if not already installed (Sketch → Include Library → Manage Libraries). Search for "VL53L1X" and install.
- Select your ESP32 board and COM port in Arduino IDE.
- Upload
laser_experiment.inoto the board. - Open the Serial Monitor at 115200 baud.
- Observe output lines in the format:
<timestamp_ms>,<distance_mm> - Press the XSHUT pin low (via a jumper) to reset the sensor mid-run.
- Readings are printed every 100 ms by default. You can change the interval in the
loop()function. - To log data, copy the serial output to a CSV file or use a serial-to-file tool (e.g., PlatformIO Serial Monitor).
laserexperimentcode/
├── .vscode/ # JSON files for VSCODE Arduino Configuration
├── build/ # Build logs, libraries and other files
├── laser.ino # Main Arduino sketch
├── ESP32_VL53L1X_Wiring_Diagram.png # Wiring Diagram
└── README.md # This file
All rights reserved.
This code and documentation are proprietary. You may not copy, modify, or distribute without permission.
Author: Kaveesha Abeysundara (SID: 201578163)
Open an issue at laserexperimentcode issues.
