VL53L5CX sensor

I have been trying to use some evaluation boards purchased from ST that use the ToF VL53L5CX sensor.

I tried porting a library from ST’s VL53L5CX driver and parts of Simon Levy’s VL53L5CX Arduino library available at https://github.com/simondlevy/VL53L5/tree/main/src/stand then noticed that there was one that @rickkas7 had ported. However, I noticed in the Sparkfun documentation that this is noted:

The VL53L5CX is unique in that it requires its firmware to be loaded at power-on over the I2C bus. Because this firmware is ~90k bytes, we recommend a microcontroller with enough flash to store VL53L5CX’s firmware as well as your program code.

I guess that this means that any Particle device except a P2/Photon2 is out? Incidentally, the Sparkfun Library would not compile for the Photon using Device OS 2.2.0.

Why you are pulling a tree in to the forest :thinking:

everything is ready for you in Particle community library
I have 2 of them (chained) works like charm on Photon OS 2.3.0 and 3.2.0

[Maybe just give it a try]
(GitHub - sparkfun/SparkFun_VL53L5CX_Arduino_Library)

By the way your link to the library is not working

@dreamER Thanks, the build in Workbench worked when I created a new project - must have been something not cleaned correctly from my first attempt with the ST library, by Simon Levy.

I am having a struggle with the ST Electronics evaluation board connections:
INT - 10K pullup to 3V3
I2C_RST - NC (Simon’s library uses this to select I2C address)
SDA - D0 with 2K2 pullup
SCL - D1 with 2K2 pullup
LPN - 10K pullup to 3V3 (Simon’s library uses this to select I2C address)
PWR_EN - NC (High when using AVDD instead of IOVDD)
AVDD - NC (can supply 5V instead of using IOVDD)

I have tried various combinations but so far have ended with Sensor not found - check your wiring. Freezing

Not sure why is not working :thinking:
I have a sparkfun 1X1 version not ST but may be try to follow datasheet,
tie-up I2C_RST to GND via 47K
tie-up LPN to VDD via 47k

Not sure where is this pin ?


Also not sure if you are safe here with this 5V, absolute max ratings is 3V6 and I’ll
tie-up AVDD and IOVDD together.

Thanks for digging into this. I have not been able to find the schematic for VL53L5CX-SATEL board. The only diagram I can find is this -

You can see that AVDD goes to the voltage regulator. There are a lot of components on the underside of U2 break-off. I am thinking of trying splitting the board and soldering flyers onto the pads and seeing how that works.

Just using the board worked better - so suggests that the components shown on the schematic you found are on the underside of the break off part. Now finds the device but then stuck on initialising sensor board!

SparkFun VL53L5CX Imager Example
I2C device found at address 29
Done - device found
Initializing sensor board. This can take up to 10s. Please wait.

With a bit more debug I get to the device ranging but not returning any data (test in the loop()). With the advanced settings the setup appears to be working fine and the board responds yet never outputs any data.

Initializing sensor board. This can take up to 10s. Please wait.
Set Resolution
Image Resolution: 64
Image size: 8 x 8
Ranging frequency set to 15 Hz.
Sensor is connected.
Ranging mode set to autonomous.
Set device to sleep mode.
Shhhh... device is sleeping!
Waking up device in 5... 4... 3... 2... 1...
Set device to wakeup mode.
Device is awake.
Current integration time: 10ms
Current integration time: 8ms
Current sharpener value: 14%
Current sharpener value: 18%
Current target order is strongest.
Target order set to closest.
Ranging has started.

This is the loop() code.

  //Poll sensor for new data
  if (myImager.isDataReady())
    Serial.println("Data Ready");
    if (myImager.getRangingData(&measurementData)) //Read distance data into array
      //The ST library returns the data transposed from zone mapping shown in datasheet
      //Pretty-print data with increasing y, decreasing x to reflect reality
      for (int y = 0 ; y <= imageWidth * (imageWidth - 1) ; y += imageWidth)
        for (int x = imageWidth - 1 ; x >= 0 ; x--)
          Serial.print(measurementData.distance_mm[x + y]);
      Serial.println("No Ranging Data");

  delay(50); //Small delay between polling

Am I missing something?

Got it working with another ST VL53L5CX-SATEL board after watching a youtube video where someone struggled for 2 hours to understand how to hook-up the ST board. For anyone who searches and reads this.

There are 9 pins on the breakout board starting furthest from the sensor connection to Photon>
o INT n/c
o I2C_RST n/c
o SDA D0 (no pull-up)
o SCL D1 (no pull-up)
o LPN n/c

Time to move on to some data processing pipeline design - probably upscale to 64 x 64 matrix to enable some better object analysis, shapes, edges and movement.

1 Like