How to detect an object using the VL53L0X & X-NUCLEO-53L0A1 (evaboard)

If you like it, share it

The VL53L0X is a new generation Time-of-Flight (ToF) laser-ranging module housed in the smallest package on the market today, providing accurate distance measurement whatever the target reflectances unlike conventional technologies. It can measure absolute distances up to 2m, setting a new benchmark in ranging performance levels, opening the door to various new applications.

The X-NUCLEO-53L0A1 is an evaluation board that provides an introduction to the ranging and gesture detection capabilities of the VL53L0X module.
The X-NUCLEO-53L0A1 expansion board is delivered with a cover glass holder in which 3 different spacers of 0.25, 0.5 and 1mm height can be fitted below the cover glass in order to simulate various air gaps.
Two VL53L0X satellites can be connected using the two 10 pin connectors.
The expansion board is compatible with the STM32 Nucleo board family, and with the Arduino UNO R3 connector layout.

The 53L0-SATEL-I1 are satellite boards can be used for easy integration into customer devices and basic gesture detection applications.
Thanks to its 2.8V regulator and level shifters, the VL53L0X satellite board can be used in any application with a 2.8 to 5V supply.
The PCB section supporting the VL53L0X module is perforated so that developers can break off the mini PCB for use in a 2.8V supply application using flying leads.

In this tutorial we will explain you how to use the X-NUCLEO-53L0A1 in conjunction of the NUCLEO-F401RE.

First go in the page of the: X-NUCLEO-53L0A1
and dovnload the X-CUBE-53L0A1

Unzip the X-CUBE-53L0A1 and go in the directory:

Here you have the possibility to choose the IDE/Compiler that you prefer, IAR, KEIL or AC6.
If you need to use ATOLLIC look my tutorials:

The project are ready to use for NUCLEO-F401RE and NUCLEO-L476RG.

In this tutorial we use KEIL compiler and NUCLEO-F401RE.

Now go in the directory:
and double click on the file:

We use the STM example for detect if an object enter in the range of 1,8 meter (1800 mm) from the sensor.
In case of detect, we use the PA5 for drive the Green Led, presente on the NUCLEO-F401RE board.
Also we connect a buzzer on PA5 for highlight the detections.

For do this open main.c and find the function:
int RangeDemo(int UseSensorsMask, RangingConfig_e rangingConfig)
and insert, after the line:

 trace_printf("%d,%u,%d,%d,%d\n", VL53L0XDevs[SingleSensorNo].Id, TimeStamp_Get(), RangingMeasurementData.RangeStatus, RangingMeasurementData.RangeMilliMeter, RangingMeasurementData.SignalRateRtnMegaCps);

the lines below.

// Test the distance for generate the alarm (PA5 togled - Green Led on Nucleo Board)
if (ValMis<1800) // mm

That is all, have a good work.



Where to buy…

If you need a low price VL53L0X eva board see here or here.


  • Use FIREFOX or CHROME for a clear view of the images present in this web site
  • For enlarge the image press: CTRL +
    For reduce the image press: CTRL –