I have this latest version VL53L1X time of flight laser distance sensor: http://www.st.com/en/imaging-and-photonics-solutions/vl53l1x.html

I study about this sensor, It says that sensor only Access with API(Application program Interface) how do I Integrate that API code in arduino or how do I use Wire library to Integrate this sensor.

  • I can see how to communicate with the device in the datasheet, but they don't seem to tell you what to communicate. Very helpful. And software for their boards is registration-walled. So stuff that. I'd pick an easier to use sensor.
    – Majenko
    Apr 10, 2018 at 13:02
  • Also asked at: forum.arduino.cc/index.php?topic=539443 If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information.
    – per1234
    Apr 12, 2018 at 7:34

1 Answer 1


There's actually a library created by Pololu that is quite straightforward to use so you don't need to worry about any of that. I think it covers all available functionality. https://github.com/pololu/vl53l0x-arduino

I was also a bit confused by the API comment and the datasheet.

I misread the device name so the above is not relevant.

In theory I think to use the API you can just #include the C code they provide into your sketch like a normal library. You can download the API code from the manufacturer ST here. You'll need to give your name and email but it's free. It's in C but you can probably understand it if you're familiar with Arduino/C++.

Before compiling you would also need to implement some I2C functions for which they provide prototypes (in the vl53l1_platform.c file). However, I think there are some additional steps when using C files that you will need to take to get this to compile, unfortunately I am not familiar with this so can't help - if anyone does then they can probably write a more complete answer.

The alternative is to write your own functions that replicate the functionality that is described in the API. I would do this by looking at the basic process flow in the API User Manual, taking each function and working through the API files to see what it does. The main thing you're looking for is the registers that you need to write (via I2C) in order to trigger a range measurement starting, and then the registers that you need to read to find out the result. I would note that there are multiple levels of #defines for some of the register values and there is a lot of code that deals with managing the status of the device, so this might take a while.

  • Good find there. That should make life easier for them. I could find nothing to detail the registers on the ST site...
    – Majenko
    Apr 10, 2018 at 13:56
  • I try this VL53L0X library and change few functions but this library doesn't support in latest VL53L1X.
    – Autobot
    Apr 11, 2018 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.