Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Build a handheld distance-measuring prototype with an ESP32-class board, a VL53L0X time-of-flight (ToF) sensor, and a color display running LVGL. The sensor reports distance over I²C; the microcontroller handles readings and the display interface. ST specifies the VL53L0X for absolute distance measurement up to approximately 2 m under suitable conditions—not the tens-of-metres range of many commercial laser meters.

What this project builds—and what it does not

This is a compact electronic prototype, not a professional surveying instrument. Its core is a ToF sensor that emits invisible infrared light and calculates distance internally; you do not need to assemble a separate laser diode and photodetector. An ESP32 reads the sensor and updates a graphical screen.

VL53L0X ToF sensor --I²C--> ESP32 or ESP32-S3 --display interface--> TFT running LVGL
                                                                     ├─ Measure / hold
                                                                     ├─ Unit selection
                                                                     └─ Distance and status

Compared with many ultrasonic modules, a ToF module is small, silent, and has a relatively narrow sensing field. It provides digital readings over I²C rather than requiring analog signal processing. That narrow field also makes aiming important, and readings can be affected by target surface, angle, ambient conditions, optical alignment, and cover materials. Dark, glossy, transparent, or angled targets may produce unstable or invalid results.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ST describes the VL53L0X as using an invisible-to-the-eye 940 nm VCSEL emitter, communicating over I²C, and supporting programmable I²C addressing. ST advertises an absolute measurement range up to 2 m and identifies the component as Class 1 under its stated IEC 60825-1:2014 compliance conditions. Those claims apply to the specified component and conditions, not to arbitrary laser parts or modified optical assemblies. ST VL53L0X specifications

#1 Best Overall
Nikon Laser 30 Rangefinder | Long-distance weatherproof rangefinder with a 1,600-yard range, incline/decline detection and a bright, clear OLED internal display
  • SUPERIOR ACCURACY - Delivers precise measurements up to 1600 yards with +/-0.50m/yd accuracy under 700m/yd, ensuring reliable readings for critical distance assessments in various outdoor environments.
  • ENHANCED MAGNIFICATION - Features a 6x magnification and a 21mm objective diameter, providing clear and detailed views of distant targets, crucial for accurate ranging and target identification in the field.
  • DURABLE & WEATHERPROOF - Designed to withstand harsh conditions, this rangefinder is waterproof up to 1m for 10 minutes and fogproof, ensuring reliable performance in challenging weather scenarios.
  • ANGLE COMPENSATION - Equipped with angle compensation technology, providing accurate horizontal distance and height measurements, essential for precise shot placement in uneven terrains and forestry.
  • EXTENDED BATTERY LIFE - Offers approximately 8500 actuations on a single CR2 battery, minimizing downtime and ensuring prolonged usage during extensive outdoor activities and professional tasks.

Choose the controller and sensor

Use an ESP32-class board for the full interface

An Arduino-compatible ESP32 or ESP32-S3 is a better fit than an Uno or Nano for a color LVGL interface. LVGL recommends a sufficiently capable board and uses ESP32 as an example. A Uno or Nano can be useful for a stripped-down sensor-and-serial experiment, but its memory and display resources make it a poor default for the complete graphical project. LVGL 9.5 Arduino integration guidance

An integrated ESP32-S3 display board can reduce wiring, but its screen, touch controller, SD card, and other peripherals may occupy many pins or require a board-specific display library. A separate ESP32 and SPI TFT is easier to explain and replace, although it adds wiring and configuration steps. Choose a specific board before assigning GPIOs; there is no safe universal pin map for all ESP32 display boards.

Start with the VL53L0X

The VL53L0X is a practical beginner sensor for short-range demonstrations. Arduino lists Pololu’s VL53L0X library as compatible with Arduino architectures; the listing records version 1.3.1, published April 6, 2022, which is a catalog record rather than proof of the latest release. Check the selected library’s current examples and API before compiling. Arduino library listing Pololu VL53L0X Arduino library

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A VL53L1X is an alternative when a different range or configuration is needed, but verify the exact breakout and library. More capable hardware does not, by itself, guarantee long-range accuracy. Pololu advertises its VL53L3CX carrier for up to 5 m and multi-target ranging, while warning it is not recommended for 8-bit microcontrollers; it is not the simplest beginner choice. Pololu VL53L3CX carrier

Rank #2
HiLetgo VL53L0X Time-of-Flight Flight Distance Measurement Sensor Breakout VL53L0X ToF Laser Range Finder for Arduino
  • Advantage: A time-of-flight ranging system integrated into a compact module
  • Strong point: A carrier for the VL53L0X
  • Accuracy: Range from ±3% at best to over ±10% in less optimal conditions
  • Maximum Sensoring Distance: 2m
  • Working Voltage: 2.6V - 5.5V

Gather the parts

  • Arduino-compatible ESP32 or ESP32-S3 development board.
  • VL53L0X breakout/carrier board; a breakout is easier to wire than the bare fine-pitch sensor.
  • Color TFT supported by the display-driver path you choose, unless your controller board includes one.
  • Momentary pushbutton for measurement or hold control.
  • USB cable and jumper wires for the first prototype; a small prototype PCB is optional.
  • For a handheld version: a protected battery arrangement supported by the board, suitable charger/regulator, power switch, enclosure, and mounting hardware.
  • Optional: sensor shutdown (XSHUT) and interrupt connections if your design needs them.

Do not buy a generic high-power laser diode for this project. The ToF module already integrates its emitter and ranging electronics.

Wire the sensor safely

Use the ESP32 board’s documented I²C pins and the breakout’s documentation. Breakout boards differ: some include regulation and level shifting, while others do not. Never infer that a board accepts 5 V just because a pin is labelled VIN.

VL53L0X breakout pin Connection Note
VIN or VCC Supply approved for that breakout Check its input-voltage range; do not power a bare sensor from 5 V.
GND ESP32 GND All devices need a common ground.
SDA ESP32 SDA pin Confirm the selected board’s pin assignment and pull-up voltage.
SCL ESP32 SCL pin Keep prototype bus wires short.
XSHUT Optional ESP32 GPIO Use only if the design needs to control sensor shutdown.
GPIO1 / INT Optional ESP32 GPIO Use only if the selected library/design uses the interrupt output.

Connect the display according to its controller and driver documentation; SPI TFT pin assignments are board-specific. On a battery build, do not connect an unprotected Li-ion cell directly unless the board explicitly includes the required charging and protection circuitry. Account for display backlight current, regulation, power switching, and low-battery indication.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set up software without mixing LVGL generations

Install Arduino IDE, the ESP32 board package, the chosen display driver, LVGL, and the VL53L0X library. Record the exact versions and board selection in your project notes: Arduino-ESP32, LVGL, sensor libraries, and display drivers change, and examples for one combination may not compile with another.

Rank #3
ACEIRMC 2pcs VL53L0X Time-of-Flight Flight Distance Measurement Sensor Breakout VL53L0X ToF Laser Range Finder for Arduino (Black)
  • 1.The VL53L0X from ST Microelectronics is a time-of-flight ranging system integrated into a compact module. This board is a carrier for the VL53L0X, so we recommend careful reading of the VL53L0X datasheet (1MB pdf) before using this product.
  • 2.The VL53L0 uses ST's FlightSense technology to precisely measure how long it takes for emitted pulses of infrared laser light to reach the nearest object and be reflected back to a detector, so it can be considered a tiny, self-contained lidar system.
  • 3.Ranging measurements are available through the sensor's I⊃2;C (TWI) interface, which is also used to configure sensor settings, and the sensor provides two additional pins: a shutdown input and an interrupt output.
  • 4.The VL53L0X is a great IC, but its small, leadless, LGA package makes it difficult for the typical student or hobbyist to use. It also operates at a recommended voltage of 2.8 V, which can make interfacing difficult for microcontrollers operating at 3.3 V or 5 V. Our breakout board addresses these issues, making it easier to get started using the sensor, while keeping the overall size as small as possible.
  • 5.A time-of-flight ranging system integrated into a compact module

Use one coherent LVGL/display integration path. LVGL 9.5’s Arduino guidance recommends LovyanGFX as a general TFT-driver path; older LVGL 8 guidance uses TFT_eSPI. Do not combine setup instructions or APIs across those generations without adapting the code. LVGL requires display-driver integration and configuration such as resolution, color depth, and timing. LVGL 9.5 Arduino framework guide LVGL 8 Arduino guide

Install LVGL through the Arduino library workflow and configure its lv_conf.h for the selected version and board. Follow the chosen display driver’s integration example for initialization, buffer setup, and flush callback; those details depend on the display and board, so a pin-agnostic code listing would not be reliable.

Bring up each part before combining them

  1. Test the sensor alone. Wire power and I²C, run the selected library’s example, and print readings to Serial Monitor. Check the library API and expected address for that version.
  2. Test the display alone. Run the display vendor’s example, then a static LVGL label example. Confirm the controller, pins, rotation, color order, resolution, backlight, and LVGL configuration.
  3. Combine the hardware. Initialize I²C and verify sensor response; initialize the display driver; initialize LVGL; create the interface; then start periodic measurement and service LVGL’s timer handler regularly.

Keep the UI responsive: avoid long blocking delay() calls, and update only the distance and status widgets that changed instead of redrawing the whole screen on every reading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Design the screen and measurement behavior

A first screen should make the value legible and the instrument state unambiguous. Include a large distance, its unit, status, and a clear way to take or hold a reading. A battery indicator or min/max values can wait until the basic flow works.

Rank #4
Arccos Smart Golf Laser Rangefinder PlayBetter Bundle
  • Slope Plus Wind: Arccos Smart Laser factors slope and live weather into every reading for complete distance adjustments. Traditional slope-only rangefinders miss 81% of variables so Smart Laser Rangefinder delivers true "Plays Like" yardages accounting for conditions.
  • AI Strategy Included: Smart Laser Rangefinder provides optimal targets and layup recommendations built on 1.5 billion shots analyzed. This Arccos rangefinder with AI Strategy helps you make smarter decisions so Smart Laser guides course management like a Tour-level caddie.
  • Tour-Trusted Accuracy: Arccos Smart Laser is used by Major Champion Matt Fitzpatrick and LPGA players proving elite reliability. This golf rangefinder delivers Smart Laser precision that professionals trust when accurate distances determine tournament outcomes and prize money.
  • Free Year Included: Smart Laser Rangefinder comes with a first-year membership providing advanced AI features and weather data at no cost. After year one, Arccos Smart Laser requires separate subscription billing for continued access so Game Tracking members connect seamlessly without additional setup.
  • Ultimate Rangefinder Bundle: Arccos Smart Laser Rangefinder, 1st Year's Smart Laser Subscription, 2 x CR2 Batteries, Protective Carry Case, & PlayBetter Microfiber Towel
Condition Suggested screen text
Startup Starting sensor…
Sensor initialization failed Sensor not found
Measurement in progress Measuring…
Valid reading 842 mm
Sensor timeout Timeout
Invalid or out-of-range reading Out of range
Held reading 842 mm — HOLD

Choose one interaction model first. Live mode refreshes at a controlled rate; single-shot mode measures when the user presses a physical or on-screen button and is often easier to aim; hold mode freezes the last valid value. A physical trigger remains useful even with touch because it can be operated while aiming.

Optional filtering can reduce random variation. Average several valid readings or use a median/moving average, but filtering cannot correct a bad reference offset, target angle, optical crosstalk, or systematic sensor error. Do not update the displayed value with zero when the sensor reports failure.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle timeouts and invalid readings explicitly

The following is illustrative pseudocode, not a universal library API. The Pololu library and ST APIs differ; confirm the method names and timeout behavior in the exact library version you install.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
if (millis() - lastMeasure >= measureInterval) {
    lastMeasure = millis();

    uint16_t mm = readUsingSelectedLibrary();

    if (sensorTimedOut()) {
        showStatus("TIMEOUT");
    } else if (mm == 0 || mm > MAX_VALID_MM) {
        showStatus("OUT OF RANGE");
    } else {
        updateDistanceLabel(mm, mm / 25.4f);
        showStatus("READY");
    }
}

Keep sensor status separate from the last valid value: an invalid new reading should not silently look like a real zero-distance measurement. Set the measurement interval to suit the sensor’s configuration and the display workload rather than assuming every module supports the same update rate.

Best Value
AITIAO 3Pcs GY-530 VL53L0X Laser Ranging Sensor Module GY-530 VL53L0X Time-of-Flight (ToF) Laser Distance Sensor 2.8-5V I2C IIC Interface Communication
  • Using the chip: VL53L0X
  • Power supply: 2.8 to 5V
  • Ranging time:less than 30ms
  • Operating mode: Power consumption 20mW;Standby power consumption: 5μA
  • Communication: the IIC communication protocol (fully compatible with 3-5 v system)

Define and calibrate the distance reference

Decide whether the displayed distance starts at the sensor face, enclosure front, or another reference plane. If the sensor sits behind the case opening, document a fixed offset and apply it consistently, for example displayedMm = sensorMm + referenceOffsetMm.

  1. Place a large, flat, matte target at a known distance measured from the chosen sensor reference plane.
  2. Record several raw readings at that distance and calculate their average.
  3. Compare the average with the known distance and record the error.
  4. Apply a documented offset only if appropriate, then verify at a second distance.

Do not call a reading millimetre-accurate merely because the screen displays millimetres. Display resolution, repeatability, absolute accuracy, useful range, and calibration offset are different properties. No calibration measurements are supplied here, so treat this as a procedure rather than a claim of achieved accuracy.

Fit and align the sensor in an enclosure

  • Keep both optical apertures unobstructed and the sensor board fixed relative to the enclosure.
  • Make the front opening perpendicular to the measurement axis and add a notch or sighting mark to show approximate aim.
  • Keep the sensor window clean. Do not put a transparent cover over the sensor without considering optical crosstalk and the manufacturer’s cover-window guidance.
  • Avoid glossy internal surfaces near the sensor; test the assembled enclosure against the bare-board readings.
  • Position the measure button so it can be pressed without shifting the aim.

For enclosed designs, consult ST’s ToF documentation on cover-window exclusion zones and optical crosstalk. ST Time-of-Flight sensor documentation

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot by symptom

Sensor not found

  • Check SDA/SCL assignments, common ground, supply voltage, and breakout wiring.
  • Run an I²C scanner and check for an address conflict.
  • Check whether XSHUT is holding the sensor in reset, and verify pull-ups are present at a compatible logic voltage.
  • Test the sensor without the display attached, then try a known-good example from the selected library.

Display stays blank

  • Run the display vendor’s hardware example to confirm controller, pins, rotation, color order, and backlight.
  • Test LVGL with a static screen before introducing the sensor.
  • Check the LVGL configuration, display resolution, driver initialization order, and regular timer-handler calls.
  • Add serial logging around display setup; some boards require their own display library.

Reading is zero, fixed, or intermittent

  • Show timeout and invalid states rather than treating zero as a valid distance.
  • Try a large matte target, improve aim, and check for optical obstruction or movement.
  • Shorten I²C wiring, slow the measurement cadence, and verify sensor timing-budget settings.
  • Use modest filtering only after confirming communication and range behavior.

Touch control is unreliable

Check whether the touch controller shares I²C with the sensor, confirm its address, and verify that screen rotation and touch coordinates match. Ensure the LVGL input callback is registered correctly. A physical button provides a dependable fallback.

When to choose a different design

Choose a different sensor if the required distance, target types, or multi-target behavior exceed what a short-range VL53L0X prototype can demonstrate. Consider a VL53L1X only after checking the exact module and software support; consider the VL53L3CX when its multi-target capability is specifically useful and the controller/software path is suitable. For the complete color GUI, retain an ESP32-class controller rather than downgrading to an Uno or Nano. A more integrated display board can simplify wiring, but only when its exact board has a workable LVGL/display-driver path.

Quick Recap

Bestseller No. 2
HiLetgo VL53L0X Time-of-Flight Flight Distance Measurement Sensor Breakout VL53L0X ToF Laser Range Finder for Arduino
HiLetgo VL53L0X Time-of-Flight Flight Distance Measurement Sensor Breakout VL53L0X ToF Laser Range Finder for Arduino
Advantage: A time-of-flight ranging system integrated into a compact module; Strong point: A carrier for the VL53L0X
$6.79
Bestseller No. 3
Bestseller No. 5
AITIAO 3Pcs GY-530 VL53L0X Laser Ranging Sensor Module GY-530 VL53L0X Time-of-Flight (ToF) Laser Distance Sensor 2.8-5V I2C IIC Interface Communication
AITIAO 3Pcs GY-530 VL53L0X Laser Ranging Sensor Module GY-530 VL53L0X Time-of-Flight (ToF) Laser Distance Sensor 2.8-5V I2C IIC Interface Communication
Using the chip: VL53L0X; Power supply: 2.8 to 5V; Ranging time:less than 30ms; Operating mode: Power consumption 20mW;Standby power consumption: 5μA
$8.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.