Skip to main content

VL53L4CD Time of Flight Distance Sensor

The Adafruit VL53L4CD Time-of-Flight Distance Sensor is ideal for accurate distance measurements. The sensor delivers stable results from approximately 1.0 mm to 1300.0 mm with high repeatability. Thanks to its narrow measuring beam, it is ideal for robotics, obstacle detection, automatic measurements or interactive installations.

It has a STEMMA QT / Qwiic connector for easy plug-and-play connections without soldering.

  • Measuring range from approximately 1.0 mm to 1300.0 mm
  • Compatible with 3.3V and 5V
  • Narrow beam (FoV approx. 18 degrees) for precise detection
  • STEMMA QT / Qwiic connector for easy connection
  • Fast measurements up to about 100 Hz

 

1 Material:

2 Assembly

Screenshot 2026-03-09 at 13.58.23.png

Wire  using the STEMMA QT connector.
If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the VL53L4CD VIN.

  • Board 5V to sensor VIN (red wire)
  • Board GND to sensor GND (black wire)
  • Board SCL to sensor SCL (yellow wire)
  • Board SDA to sensor SDA (blue wire)


3 Software & code

In the Arduino software Click the Manage Libraries ... menu item (under Tools), search for VL53L4CD, and select the STM32duino VL53L4CD library. Install it.

The library comes with some example sketches, I used one of them and adjusted the code so the useless information like status, signal, tekst is removed. It now only outputs a stream of values.

Open a new arduino file ande replace the code with this:

#include <Arduino.h>
#include <Wire.h>
#include <vl53l4cd_class.h>

#define DEV_I2C Wire

VL53L4CD sensor(&DEV_I2C, A1);

void setup() {
Serial.begin(115200);
Wire.begin();

sensor.begin();
sensor.VL53L4CD_Off();
sensor.InitSensor();

// Hoge nauwkeurigheid
sensor.VL53L4CD_SetRangeTiming(200, 0);

// Start met meten
sensor.VL53L4CD_StartRanging();
}

void loop() {
uint8_t dataReady = 0;
VL53L4CD_Result_t results;

// Wacht tot er nieuwe data is
do {
sensor.VL53L4CD_CheckForDataReady(&dataReady);
} while (!dataReady);

// reset interrupt
sensor.VL53L4CD_ClearInterrupt();

// meetresultaat ophalen
sensor.VL53L4CD_GetResult(&results);

// alleen afstand printen
Serial.println(results.distance_mm);
}

 

5 Connect the arduino to your computer. 

Connect Arduino to your computer & Upload the code.
If you do not know how to upload a Arduino sketch, please visit https://www.arduino.cc/en/Guide/Windows for Windows user or https://www.arduino.cc/en/Guide/MacOSX for Mac user.

Open the serial monitor by clicking the Magnifying glass in the top right corner of the window.
You might need to change the Baud rate to: 115200 before you get good results. Do this in the top right of the serial monitor field.
You should now see a stream of data measuring the distance to the object in front of the sensor. Hold your hand in front of the sensor and move it.

For connecting with Isadora read this

You can borrow this sensor for testing at the Blackbox location IBB. Contact: blackbox.ibb-pastoe@hku.nl