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

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.
 

2. 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.
 

3. Install VL53L1X Arduino libraries

Now install the VL53L1X Arduino libraries.

3.1. GitHub files download

Start by downloading two zip files from GitHub.

Figure 1Figure 1
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 2Figure 2
 

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.
Figure 3Figure 3
 

3.4. Select the Nucleo board

Select the right Nucleo board F401RE target.
Figure 4Figure 4
 

3.5. Select the right COM port

Figure 5Figure 5
 

3.6. Compile and flash the Arduino board

Figure 6Figure 6
 

3.7. Open the serial monitor (fig 7)

Figure 7Figure 7
 

3.8. Result

The ranging result should be displayed on a serial terminal as shown in figure 8
Figure 8Figure 8

Disclaimer: STMicroelectronics does not provide support to these libraries.

For any support on these libraries, refer to the STM32duino forum and STM32duino GitHub.


 

Version history
Last update:
‎2024-09-04 07:51 AM
Updated by:
Contributors