VL53l0x Example

Hi All.

Just wondering if there is or if anyone has a “Bare bones” version of the VL53L0X program
(vl53l0x-arduino-master) from Github. This one works great on my Arduino Leonardo but I
would like to implement it on a PIC. I looked at the I2C lines on a logic analyzer to copy over the
READS & WRITES but found it to be over whelming. Over 300 individual READS & WRITES.
I used this procedure on a smaller Arduino program but it is not quite as stable like the “l(vl53l0x-arduino-master)” program. Does the program have to be this long for just a simple
continuous distance measurement?

I’m just using the below 3 lines of I2C for PIC Basic and it works but I get the odd flaky measurement.

I2CWrite PORTC.1,PORTC.0,$52,[$00,$01]
PAUSE 5
I2CWrite PORTC.1,PORTC.0,$52,[$14]
PAUSE 5
I2Cread PORTC.1,PORTC.0,$53,[A,B,C,D,E,F,G,H,I,J,PS_DATA.BYTE1,PS_DATA.BYTE0]

Hopefully I am just missing some settings. I just don’t thing I need all 300 I2C statements to
get it to work. I may try but a lot of work and memory usage.

Please let me know what you think.
Thanks,
Dennis

Hi, Dennis.

I agree that the initialization and configuration procedure of the VL53L0X is pretty overwhelming. In my experience, it is possible to get readings from the sensor without as much setup, but the results tend not to be as reliable as when the sensor is properly configured.

ST provides an API for the VL53L0X, which is their recommended method for interfacing with the sensor, and you might consider using that directly instead of trying to port our Arduino library. Basically, you can use the API by implementing some low-level I²C functions and compiling the API source files (which handle higher-level interfacing) as part of your program.

Our VL53L0X library is intended to be a more lightweight reimplementation of the API for the Arduino platform, but as a result, it is less platform-independent and would probably be much more work for you to port compared to using the API directly (although using the API will generally take more storage and memory). There is a little more explanation in our library readme on GitHub.

Kevin