cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement the VL53L3CX on a Raspberry PI3

AGree.4
Associate

My goal is to implement the VL53L3CX TOF sensor on a Quanser Qdrone as a sensor for height control.

As an inbetween I am trying to get the VL53L3CX working with my Raspberry PI3 first to better understand how the sensor and API work. So far I have not been able to find any premade PI3 libraries for communicating with the VL53L3CX. I believe this means that I have to use either the en.VL53L3CX_LinuxDriver_v1.0.5 or the EN.EN.bare_driver_VL53L3CX_v1.2.4.

I have the sensor wired to the raspberry pi and using i2cdetect -y 1 I can see the sensor at address 0x29. From what I have read on other threads, the sensor does not send a stream of distance but instead sends a histogram of distance that needs to be decoded by the API/driver. This means that I will have to implement one of the drivers, right?

What is the difference between the two drivers? Is there an advantage to one over the other or are they roughly equivalent?

I am very new to Linux and am not sure how to install the drivers. Could you help me or provide me with documentation on how to install and use either of the drivers?

Thanks,

Anthony

1 REPLY 1
John E KVAM
ST Employee

The linux driver - dispite it's name - is NOT a very good way for you to implement the sensor. That is a kernel driver and unless you have a lot of experience I'd stay away from it. It's main use is if you don't want to give access to the I2C bus to user-level code. (This makes sense in a cell phone, but not for a normal developer.)

In your RPi, you can feel free to write directly to the I2C bus - it works fine.

Take the STSW-IMG015

VL53L3CX API (Application Programming Interface)

This is almost everything you need. It even has example code.

But what it does NOT have is an interface between the sensor's code and the I2C.

This code was not written for any particular processor, so they left this interface empty.

There is a platform.c file that contains the functions you need - but it's empty.

You have to populate it.

Couple of ways to do this.

You can take the file I wrote for the VL53L1 and modifiy it. (It's included below.)

Or you can search GitHub for RPi and VL53L3 - I'll bet someone else has done it for you.

You might actually start with GitHub and see if there is already an example.

I'm betting there is one. If there is, it would be a good place to start.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.