Part

Laser distance, VL53L1X

Laser time of flight to 4 m over I2C at 0x29, sixteen-bit register addresses.

See every part
  • 6 pins
  • 1 setting
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
Laser distance, VL53L1X as drawn in the Mokxi simulator
At a glance

The Laser distance, VL53L1X in brief

What it is, and every setting the properties panel gives it.

The VL53L1X is ST’s laser time-of-flight distance sensor: it fires a pulse of infrared light, times the reflection and reports millimeters, up to 4 m. It is the long-range relative of the VL53L0X, with the same tiny two-lens module and about three times the reach, and three distance modes that trade range for resistance to bright ambient light. It talks I2C at 0x29 with sixteen-bit register addresses, and an XSHUT pin, pulled up on the board, switches it off when held low. In Mokxi a slider places the target from 0 to 4000 mm. The model boots for 1.2 ms before it answers, ranges continuously or once, flags each result on its interrupt, reports a good range or no target, and caps each distance mode at its reach: 1.3 m short, 3 m medium, 4 m long. The timing budget, the region of interest and the target’s color do not change the result here.

Family
Sensors
Pins
6
distance
500
Pins

6 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
VIN
Supply, 2.6 to 5.5 V.
GND
Ground.
SCL
I2C. The board carries the pull-ups.
SDA
I2C. The board carries the pull-ups.
GPIO1
The interrupt: changes level when a result is ready.
XSHUT
Pulled up on the board; held low the sensor is off.
How to use it

How to use the VL53L1X distance sensor with an Arduino

VIN to 5 V, GND to ground, SDA and SCL to the Uno’s I2C pins. The height meter project puts a DPS310 barometer on the same bus: the laser gives the height above the floor to a few millimeters, the barometer the height climbed, the two halves of a drone’s altimeter.

With Pololu’s VL53L1X library, call setTimeout() so a missing sensor cannot hang the sketch, init() to boot it, setDistanceMode(VL53L1X::Long) for the full 4 m, a timing budget in microseconds and startContinuous() with the period between readings in milliseconds. Each read() returns millimeters; check ranging_data.range_status for VL53L1X::RangeValid before trusting it. Drag the distance slider and the floor reading follows; push it past the mode’s reach and the sketch prints out of range.

Part pin
Board pin
VIN
5 V
GND
GND
SDA
SDA (A4)
SCL
SCL (A5)
XSHUT
Not wired (pulled up on the board)
GPIO1
Not wired

The sensor runs from 2.6 to 5.5 V, so it wires straight to an ESP32 or a Pico at 3.3 V. Adafruit’s and SparkFun’s VL53L1X libraries compile here too if your code uses theirs.

Arduino Uno: height meter with a VL53L1X and a DPS310live0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Ranging in long mode, from the height meter sketch
#include <Wire.h>
#include <VL53L1X.h>

VL53L1X ranger;

void setup() {
  Wire.begin();
  ranger.setTimeout(500);
  ranger.init();
  ranger.setDistanceMode(VL53L1X::Long);
  ranger.setMeasurementTimingBudget(50000);
  ranger.startContinuous(100);
}

void loop() {
  uint16_t mm = ranger.read();
  if (ranger.ranging_data.range_status == VL53L1X::RangeValid) {
    // mm is a good distance
  }
}
Common errors

Common Laser distance, VL53L1X errors and fixes

What goes wrong
The fix
A target 2 m away reads as no target.
Short mode reaches only 1.3 m and medium 3 m. Call setDistanceMode(VL53L1X::Long) for anything up to 4 m.
Two sensors on one bus answer as one.
Both start at 0x29. Hold one in reset with its XSHUT low, give the other a new address, then release the first.
init() fails right after power-up.
The sensor boots for about 1.2 ms before it answers. Call Wire.begin() and init() once the board is up, and set a timeout so a real failure is reported instead of hanging.
Readings print but some are nonsense.
read() returns a number even when the range is not valid. Check ranging_data.range_status and ignore anything that is not RangeValid.
Questions

Questions and answers

How far can the VL53L1X measure?

Up to 4 m in long mode, 3 m in medium and 1.3 m in short mode, which copes better with bright surroundings.

What is the difference between the VL53L1X and the VL53L0X?

The VL53L1X reaches about three times as far and has selectable distance modes; the two share the module shape and the 0x29 address. The VL53L0X has its own page here.

What does the XSHUT pin do?

Held low it switches the sensor off. It is how several sensors are brought up one at a time to give each a different address.

Does the color of the target matter?

On a real sensor a dark target returns less light and shortens the range. The simulation does not model the target’s color, so test with real surfaces before relying on the far end of a mode.

How it is modeled

What is true about the Laser distance, VL53L1X, here

In its help article’s own words: what the simulation gets right, and where it stops.

Not modeled

The timing budget's effect on the measurement time, the region of interest, the calibrations, noise, and the target's color.

From VL53L1X laser distance sensor, in full.

Projects

See the Laser distance, VL53L1X in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Laser distance, VL53L1X in it.

Libraries

Arduino libraries for the Laser distance, VL53L1X

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the Laser distance, VL53L1X

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.