cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a ToF sensor with a Nucleo board in Arduino IDE

LauraCx
ST Employee

How to run a ToF sensor with a Nucleo board in Arduino IDE

This article is for people who are used to develop their applications using the Arduino IDE but who are not familiar yet with how to use ST products in the Arduino world. This concept combines the best performance hardware with an easy Arduino IDE for fast prototyping.
The goal of this article is to show how to get started using the Arduino IDE and ST’s most popular STM32 board with ST’s most popular Time-of-Flight sensor.
1554.png
 
In this article the X-NUCLEO-53L1A1 and a NUCLEO-F401RE will be used as an example. Please check out the article
here to see all other ST Time-of-Flight sensor libraries available.
 
  1. Install Arduino IDE

First, one needs to install the Arduino IDE if it is not done, there are many videos on the subject. A good example is here.
 
  1. Install STM32 board libraries in IDE

Once the Arduino IDE is installed, please watch a STM32duino video, by Carlo PARATA, to learn how to install the STM32 board libraries in the IDE.
 
  1. Install VL53L1X Arduino libraries

Now install the VL53L1X Arduino libraries.


3.1 Github files download

Start by downloading two zip files from Github .

Figure 1
1555.png
The STM32duino/VL53L1X contains only the VL53L1X device Arduino Library. This library is required to be installed to allow to use the examples included in the next library.
The STM32duino/X-NUCLEO-53L1A1 contains the library supporting the expansion board (X-NUCLEO-53L1A1) and the examples.
 

3.2 Add library

Once the two zip files are downloaded, click on Sketch/Include Library/Add ZIP Library and browse to the directory where the two ZIP files have been downloaded to install the two libraries.
Figure 2
1556.png
 

3.3 Load example sketch

Once both libraries are installed, click on File/Examples/STM32duino X-NUCLEO-53L1A1/STM32duino/X-NUCLEO-53L1A1_HelloWord_Interrupt to load the example sketch into the IDE (fig 3)
Figure 3
1557.png
 

3.4 Select the Nucleo board

Select the right Nucleo board F401RE target (fig 4)
Figure 4
1558.png
 

3.5 Select the right COM port (fig 5)


Figure 5
1559.png
 

3.6 Compile and flash the Arduino board (fig 6)

Figure 6
1560.png
 

3.7 Open the serial monitor (fig 7)

Figure 7
1561.png
 

3.8 Result

The ranging result should be displayed on a serial terminal as shown in figure 8
Figure 8
1562.png
 
Version history
Last update:
‎2021-11-24 05:32 AM
Updated by: