Showing results for 
Search instead for 
Did you mean: 

Has any Arduino code been written for the VL53L1X?

Andy Saul
Associate II
Posted on March 22, 2018 at 11:52

I recently purchased the VL53L1X P-Nucleo kit with extra expansion boards for evaluation of the VL53L1X and suitability of integration into one of our upcoming products. We are exceptionally happy with the performance and capability of the L1X over L0X! In particular the ability to create a distance detection band (our case 300mm to 600mm) which is absolutely fantastic for our product.

My questions are as follows:

We will be using an Arduino beetle in the product for control of the VL53L1X, when will any Arduino code become available? I'm guessing it's similar to the code for the VL53L0X but with additional code for control of the extra parameters? Apologies but I'm not a software bod or I would have had a crack at it myself!

The expansion board kit (VL53L1A1) that comes with 2 breakout boards, has an IR cover window supplied (Oval one) are these available to buy separately? Ideally we would like to be able to source thousands as well as thousands of the VL53L1X breakout boards (A modified version of the current small version of the VL53L0X board would be ideal (the one with single mounting hole in the corner))

In regard to the black oval IR cover window, are these available to buy in an altered version to compensate for being placed on an angled facing. our product wall will be 25 degrees from vertical and it would be nice to have a compensation for this to make the beam horizontal (due to tooling we can't alter the wall) We would like to use the sticky back on the cover window to mount the board, but this will cause the beam angle to point toward the floor 25 degrees)

please help! As we would like to go into production ASAP!

#arduino #vl53l1x
Legacy member
Not applicable
Posted on March 23, 2018 at 09:35


Although the form factor of the expansion board is compatible with Arduino, I don't think ST provides Arduino code. These modules are for evaluation (it is also printed on them and/or the packaging), not recommended to be used as a final product. (You are able to design about 10 times smaller footprint anyway.)

Here are APIs and documentation for this sensor:


Code is written in C and also Arduino uses C. Maybe it doesn't need much adaptation (or any at all - I haven't looked into it).


Posted on March 31, 2018 at 00:56


you mention STSW-IMG007, but I it does not seem to be available for download. Only the specification and license agreement. Any ETA for the API itself?

Thank you.

Legacy member
Not applicable
Posted on April 02, 2018 at 10:05

Good point, only an ST employee can answer this question.


Associate II
Posted on April 06, 2018 at 23:51

You can find it here. Click on the 'get software' box and fill in the license agreement. I think the javascript might be dodgy - I'm sure I looked at that page several times without seeing the box. Perhaps it takes a while to appear.


The software will run on an Arduino, but it's a pretty tight fit. You can't use the built-in trace facilities unless you use a  bigger arduino. It will fit on a Due, fits with warnings on a Mega, and overfills 328 and 32u4-based devices.

Without the trace, it will fit on smaller devices, but there are problems. The Arduino 'Wire' library is limited to 32-byte I2C transfers, though it's possible to do larger ones (the API does one of 135 bytes) in sections.  I've ended up using the SoftI2CMaster library though - it saves a lot of ram over the Wire library and that's a big win. You don't need much extra data to overflow the stack.

Just spent all day finding a 16/32 bit bug. It's pretty much working but still doesn't act exactly the same as when I build it for the 32-bit Arduino Due so there's probably at least one more similar bug.

ST people - is there an errata sheet or an update for the code ? It's possible you've found the bugs already. Or if not, I have a support ticket for you ..

One other thing : the Nucleo expansion is designed to work with a 3v3 device. It has level shifters for the 2v8 v53l1x but they're powered off the Arduino's 3v3 supply and 5V I2C signals are out of spec. The plug-in modules are 2v8 only. So beware - the easiest workaround is probably to use the nucleo expansion board with only the central sensor fitted on a 3v3 arduino. Otherwise you'll need suitable voltage shifters, or maybe modify the expansion board.

Posted on April 14, 2018 at 16:47

Sparkfun has

for this.
Posted on April 15, 2018 at 21:51

I've seen it. Like the Pololu for the VL53L0X driver, it generates a heap of values to send, then transmits them to the sensor. It doesn't allow for any modification of those and there's no guide as what the different values do. This is fine if you want the bare minimum from the sensor but it doesn't allow for calibration or tuning. So I think it's useful for very straightforward uses - and should still get the benefit of the increased range - if you need to use a small microcontroller.

ST have, somewhat oddly, restricted the redistribution of their driver. I'm not sure why : maybe they don't want to sell many yet ? I'd encourage them to be a bit more aggressive about selling them, it seems a  very useful device.

It may be best to rewrite the more complete driver for easier use. While it's often easy to use a 32 bit micro these days, there's the usual problem - people like to stick with what they're used to, and what their existing code runs on. I think 8 and 16 bit micros will be around for a long time yet.

Posted on April 15, 2018 at 21:57

Thanks for pointing that out. But their library has a long way to go. They just write bunch of data captured from Nucleo board to their board. In case you use 1V8 IO mode (I do), you cannot use the code the directly and have to (easily) modify it, based on Nucleo example code. But as it lacks all the calibration support, I prefer to stick to the API from ST -


 that was mentioned here earlier and is already available.
Roman K_2
Posted on April 30, 2018 at 23:40

Hi Andy,

Can you please point me to 'distance detection band' functionality? I missed that. THanks!


I've filled out the necessary form and got the email to download the VL53L0X driver from the ST site, but the page that the email redirects to only provides a 403 error code. The online support link also 403s ( I've attempted this logged in and logged out and get the same result. ST simply doesn't want anyone to use their products I guess. I understand that the chip can be complex and an api can be very helpful, but only if you can download the api implementation.