Using the VL53L4CD with Arduino involves wiring up the sensor to your Arduino-compatible microcontroller, installing the STM32duino VL53L4CD library and running the provided example code.

Wiring

Wire as shown for a 5V board like an Uno. If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the VL53L4CD VIN.

Here is an Adafruit Metro wired up to the VL53L4CD using the STEMMA QT connector:

  • 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)

Here is an Adafruit Metro wired up using a solderless breadboard:

  • 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)

Library Installation

You can install the VL53L4CD library for Arduino using the Library Manager in the Arduino IDE.

Click the Manage Libraries ... menu item, search for VL53L4CD, and select the STM32duino VL53L4CD library:

Load Example

Open up File -> Examples -> STM32duino VL53L4CD -> VL53L4CD_Sat_HelloWorld and upload to your Arduino wired to the sensor.

Note: this is only the loop in the screenshot.

Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You should see the values from the sensor being printed out.

This guide was first published on Mar 23, 2022. It was last updated on Mar 23, 2022.

This page (Arduino) was last updated on Mar 15, 2022.

Text editor powered by tinymce.