VL53L1X laser distance sensor

The ST VL53L1X times a laser pulse to the target and back, and reports millimeters up to 4 m over I2C at 0x29.

Aliases: VL53L1X time of flight sensor, ToF sensor, Pololu VL53L1X, Qwiic distance sensor. It is the long-range sibling of the VL53L0X: the same tiny module and two lenses, three times the reach, with a short mode for a bright room.

Pins

Pin What it does
VIN Supply, 2.6 to 5.5 V.
GND Ground.
SCL, 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.

Properties

distance is the target, 0 to 4000 mm; the slider moves it while the circuit runs.

Reading it on an Arduino

With Pololu's library, which Mokxi ships as VL53L1X.h:

#include <Wire.h>
#include <VL53L1X.h>
VL53L1X sensor;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  sensor.setTimeout(500);
  if (!sensor.init()) Serial.println("No sensor");
  sensor.setDistanceMode(VL53L1X::Long);
  sensor.setMeasurementTimingBudget(50000);
  sensor.startContinuous(50);
}

void loop() {
  Serial.println(sensor.read());
}

Adafruit's Adafruit_VL53L1X.h does the same with startRanging(), dataReady() and distance().

How it talks

Register addresses are sixteen bits, high byte first.

  • For 1.2 ms after power or XSHUT comes up the sensor boots and does not answer; FIRMWARE__SYSTEM_STATUS (0x00E5) then reads 1. The model ID at 0x010F reads 0xEACC.
  • SYSTEM__MODE_START (0x0087) 0x40 ranges on the intermeasurement period (0x006C), 0x10 takes one reading, 0x80 stops.
  • A result sets the interrupt: bit 0 of 0x0031 reads it, active low by default, and writing 1 to 0x0086 clears it. The range status is at 0x0089 (9 for a good range, 4 for no target) and the range in millimeters at 0x0096.
  • RANGE_CONFIG__VCSEL_PERIOD_A (0x0060) sets the distance mode: short reaches 1.3 m, medium 3 m and long 4 m.

What it does not model

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

Common mistakes

A target past the mode's reach reads no target, not the far wall: use long mode for anything past 1.3 m. Two on one bus need XSHUT to bring them up one at a time and give each a new address.