Skip to main content
JDunn.1
Associate
July 8, 2021
Solved

Is there a Linux / Python Library for the VL53L5? I'm trying to get a simple range measurement out of the device using a Raspberry Pi 4. Is a VL53L3 or VL53L0X library close enough to get a basic distance measurement out of the device?

  • July 8, 2021
  • 6 replies
  • 3478 views

..

This topic has been closed for replies.
Best answer by John E KVAM

Soon - very soon. The data sheet came out on July 7, and the Graphical User Interface will be out by the 15th.

There is some X-cube code up on the web site, but it's incorrect.

Only solution I have for you is to wait a couple more days.

Everything should be there by July 15.

I've been promised.

And this sensor is completely different from the prior VL53 sensors, so none of that code will work.

  • john

6 replies

John E KVAM
John E KVAMBest answer
ST Employee
July 9, 2021

Soon - very soon. The data sheet came out on July 7, and the Graphical User Interface will be out by the 15th.

There is some X-cube code up on the web site, but it's incorrect.

Only solution I have for you is to wait a couple more days.

Everything should be there by July 15.

I've been promised.

And this sensor is completely different from the prior VL53 sensors, so none of that code will work.

  • john
JDunn.1
JDunn.1Author
Associate
September 8, 2021

John,

I'm checking back in on this topic. Any luck getting a Arduino /Linux / Python Library for the VL53L5 yet?

I haven't seen any of the updates that were coming on July 15th.

thanks,

-Joe

GSUN.1
Visitor II
August 20, 2021

@John E KVAM​ When you say "There is some X-cube code up on the web site, but it's incorrect.", which version you mean to say, because I'm using the "X-Cube-TOF 1.2.0.0", no error reported, but I can't get any data from the sensor, because the L5 never rise any interrupt to the HOST, could you please help check, that would be very helpful for us, thanks.

John E KVAM
ST Employee
September 9, 2021

All the code is up there - finally.

Go to ST.com and search for VL53L5 - it will bring you to the product page.

Then click on 'tools and software"

One of the options is the Linux Driver -

STSW_IMG025

That should set you up.

  • john
JDunn.1
JDunn.1Author
Associate
September 9, 2021
Thank you for following up! I will check it out!
John E KVAM
ST Employee
September 10, 2021

I fear I have steered you in the wrong direction.

There is a linux driver and it does work - but it's too hard. Unless you are serious about putting stuff in the kernel I have a better way.

The Linux driver is fine for systems that don't want to give I2C access to user level code.

But in your RPi, you have the freedom to write to the I2C form user code.

And user code is easier to debug.

The easy way to use the VL53L5 on the RaspberryPi is to start with:

STSW-IMG023

Ultra Lite Driver (ULD) for VL53L5CX multi-zone sensor

It is pretty simple.

But there is a trick - This code does NOT know which CPU/MCU you are using. YOu must edit the platform.c file (which is generally empty) and fill it with the code needed to access your I2C. (There are lots of references on how to open an I2C device - you can google it.)

When done you can run any of the examples.

And one of them is a basic ranging program that takes the data and prints it out. Modify this program to your liking.

I then 'pipe' the output of this program into my Python programs to make using the data easier.

  • john

KWine
Senior
September 27, 2021

Arduino driver for the VL53L5CX here.

Julien NGUYEN
ST Employee
May 30, 2022

Python code is here:

https://pypi.org/project/VL53L5CX/#files

https://github.com/mp-extras/vl53l5cx

Please let's us know if it works.