VL53L0X (proximity sensor, up to 2m) and STM32F042K6

If you like it, share it

For this project we use the Satellite boards based on VL53L0X the VL53L0X light library and NUCLEO-F042K6.

The connections are shown below.

We use only GND, 3.3Vcc and I2C.

Actually the API of the VL53L0X are configured to work at 2.8V and therefore the NUCLEO-F042K6 should be modified to work at 2.8V.
The change is in the file: VL53L0X_LITE_API.C
and must be comment the lines: 91 and 93, see below.

If you use KEIL compiler don’t comment the line 91 and 93 but insert a define in the KEIL compiler, see below.
Insert: USE_I2C_2V8

We use the CUBE-MX configured as shown below.

At the end of the configuration click on the: GENERATE CODE

Now is necessary configure the KEIL project.

In the directory where you has generated the project, you must see something like below.

Enter in DRIVERS directory and insert the BSP directory.
Copy the BSP directory from the VL53L0X light library.
At the end you must see something like below in the DRIVERS directory.

Now enter in the MDK-ARM directory and double click on the project file, in our case is: EF_F042_VL53L0.uvprojx

After do this, you must configure the KEIL as shown below.

Now you are ready to compile the program.
Program Size: Code=9918 RO-data=250 RW-data=28 ZI-data=1356

Below the results that you see using the TeraTerm on your PC
115200, 8, None, 1, None

The SW ready to use for KEIL is here but is password protected.
The password is at the moment available only for STM & SILICA
internal use.
Please send us an email and ask us the password for:
Please specify also your country and your city, this are only for our personal statistics.

If you are not STM or SILICA people but need test the VL53L0X use this example:
How to detect an object using the VL53L0X & X-NUCLEO-53L0A1 (eval board)


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