cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1X Distance Sensor 50% failure rate (erratic measurements).

Aurelius
Associate II

Hi,

We have an issue with a production build of a VL53L1X based design. The VL53L1X is interfaced to a PIC18F micro, I have inherited the codebase and hardware. The initial production run was for 500 units, of these approx 260 passed our production tests and some have been working well in the field for some time.

The remaining 240 all exhibit an almost identical failure mode. Basically the readings will only 

 


1 - Uart Output (Legacy Code - Good Sensor)

 

VTOF=345mm  (5989) (0)
VTOF=346mm  (5978) (0)
VTOF=346mm  (6020) (0)
VTOF=344mm  (5949) (0)
VTOF=345mm  (6153) (0)
VTOF=346mm  (5979) (0)
VTOF=347mm  (6098) (0)
VTOF=345mm  (6147) (0)
VTOF=347mm  (6176) (0)
VTOF=346mm  (6166) (0)
Min: 344, Max: 347, Avg: 345.70, Std Dev: 0.95

 

 

 2 - Uart Output (Legacy Code - Bad Sensor)

 

VTOF=652mm  (33) (1)
VTOF=524mm  (48) (0)
VTOF=571mm  (38) (7)
VTOF=496mm  (25) (1)
VTOF=734mm  (23) (1)
VTOF=570mm  (14) (1)
VTOF=604mm  (30) (1)
VTOF=515mm  (19) (1)
VTOF=550mm  (3) (2)
VTOF=587mm  (11) (2)
Min: 496, Max: 734, Avg: 580.30, Std Dev: 70.73

 

 

*Numbers in brackets are "signal_rate" and "range_Status"

Above tests were run with a 300*200 grey target at 350mm, indoor lighting.

The inherited codebase was written some time ago by an outside contractor. I decided to implement the Ultra Lite Driver to see if the issue was to do with the firmware (the old code just puts a "known good" calibration table into the VL53L1X and begins reading).

After porting the library and writing some debug code, the bad sensors are still reading incorrectly. Although they are now much worse than when using the legacy code. I assume I will have to perform some calibration to get the offsets correct, but the repeatability issue remains on the bad sensor, which offest won't fix anyway.

 

3 - Ultra Lite Driver Register Printout (Good Sensor)

 

Timing Budget in ms           : 100
Distance Mode                 : 2
Intermeasurement Period in ms : null
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 673 mm
Signal Per SPAD               : 24 kcps
Ambient Per SPAD              : null
Signal Rate                   : 440 kcps
Number of SPADs               : 1
Ambient Rate                  : null
Range Status                  : 2
Result - Distance             : null
Offset                        : null
Crosstalk (Xtalk)             : null
Distance Threshold Window     : 0
Distance Threshold Low        : null
Distance Threshold High       : null
ROI Width                     : 63815, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

 

 

4 - Ultra Lite Driver (Bad Sensor)

 

Timing Budget in ms           : 100
Distance Mode                 : 2
Intermeasurement Period in ms : null
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 629 mm
Signal Per SPAD               : 25 kcps
Ambient Per SPAD              : null
Signal Rate                   : 464 kcps
Number of SPADs               : 1
Ambient Rate                  : null
Range Status                  : 2
Result - Distance             : null
Offset                        : null
Crosstalk (Xtalk)             : null
Distance Threshold Window     : 0
Distance Threshold Low        : null
Distance Threshold High       : null
ROI Width                     : 63815, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

 

 

 

On production units the sensor is protected by glass, with a 3d printed baffle to minimize cross-talk. I've validated that there's no effect from the hardware. The good/bad divide remains the same regardless of whether the glass or baffle is present. I've also validated supply rails are noise free and stable under operation. The "bad" sensors do not look dirty or damaged under the microscope.

 

I'll be implementing xtalk and offset calibration but I'd like to know if there are any other registers that I should be setting or adjusting? Or could it be that we have a bad batch of VL53L1X  sensors?

I'm also not sure why many of the registers are returning errors? (My debug function marks any that do not return "VL53L1X_ERROR = 0" as "null")

 

Thanks in advance for your help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Aurelius
Associate II

Thanks John,

That's not good news for us, but at least we know where we are.

 

I appreciate all the help.

View solution in original post

14 REPLIES 14
Zhiyuan.Han
ST Employee

Hi

To debug the issue, I suggest you do some test without loading calibration data first. I suspect the calibration data caused something wrong. 

With the ULD, both of the "GOOD" and "BAD" is reporting range status 2, this is caused by too low return signal rate come back, seems sensor is not working properly.

"When the range status is 2, there is a signal failure. This means that the return signal is too week to return a good
answer. The reason is because the target is too far, or the target is not reflective enough, or the target is too
small. Increasing the timing buget might help, but there may simply be no target available."

 

And seeing you got so many null readings, I suspect there is something wrong on the I2C bus communication. I attach a I2C test code to let you verify the I2C link is correct or not.

 

Br

Zhiyuan.Han 


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.
Aurelius
Associate II

Thanks for the fast reply. I've made a couple of the checks you suggested:

 

(1) I2C Test Code:

Aurelius_0-1706189103685.png

Looks good to me.

Though I did find that the reason for the "null" was that the low level PIC18F driver returned an error instead of 0, this wasn't an issue until I used the value with the Ultra Lite Driver. I've solved this bug but I don't believe it has any bearing on the original issue.

 

(2) Read Variables before and after init 

"Init" is simply calling the  VL53L1X_ERROR VL53L1X_SensorInit(uint16_t dev) as provided in the ULD using the VL51L1X_DEFAULT_CONFIGURATION table.

 

Good Sensor:

Before Init:

********************
Start Sensor Printout

Timing Budget in ms           : 0
Distance Mode                 : 0
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 0 mm
Signal Per SPAD               : 0 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 0 kcps
Number of SPADs               : 0
Ambient Rate                  : 63488 kcps
Range Status                  : 255
Result - Distance             : 6 mm, Status: 255
Offset                        : 0 mm
Crosstalk (Xtalk)             : 0 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 256 kcps
Sigma Threshold               : 115 mm

End Sensor Printout
********************

Init OK
After Init:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 2
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 414 mm
Signal Per SPAD               : 51 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 928 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 2
Result - Distance             : 6 mm, Status: 2
Offset                        : 0 mm
Crosstalk (Xtalk)             : 0 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout

 

Bad Sensor

Before Init:

********************
Start Sensor Printout

Timing Budget in ms           : 0
Distance Mode                 : 0
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 0 mm
Signal Per SPAD               : 0 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 0 kcps
Number of SPADs               : 0
Ambient Rate                  : 63488 kcps
Range Status                  : 255
Result - Distance             : 255 mm, Status: 255
Offset                        : 0 mm
Crosstalk (Xtalk)             : 0 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 256 kcps
Sigma Threshold               : 115 mm

End Sensor Printout
********************

Init OK
After Init:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 2
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 2412 mm
Signal Per SPAD               : 0 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 16 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 2
Result - Distance             : 0 mm, Status: 2
Offset                        : 0 mm
Crosstalk (Xtalk)             : 0 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

 

I'm hoping that it's a matter of applying bespoke calibrations. If you see anything in particular with these results please let me know.

Aurelius
Associate II

I applied the xtalk calibration to both the good and bad sensor. I used a grey target at 150mm.

What can we ascertain from the results below?

Changing  Distance Mode and Timing budget made no difference. Are there any other adjustments I can try?

Could this be a faulty batch of sensors?

 

Good Sensor is still giving repeatable values, excellent consistent operation:

Data Ready:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 1
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 155 mm
Signal Per SPAD               : 300 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 5392 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 0
Result - Distance             : 0 mm, Status: 0
Offset                        : 0 mm
Crosstalk (Xtalk)             : 3 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

Data Ready:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 1
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 156 mm
Signal Per SPAD               : 304 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 5448 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 0
Result - Distance             : 0 mm, Status: 0
Offset                        : 0 mm
Crosstalk (Xtalk)             : 3 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

Data Ready:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 1
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 154 mm
Signal Per SPAD               : 296 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 5312 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 0
Result - Distance             : 0 mm, Status: 0
Offset                        : 0 mm
Crosstalk (Xtalk)             : 3 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

 

 

The "Bad Sensor" is still giving erratic results: 

 

Data Ready:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 1
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 706 mm
Signal Per SPAD               : 1 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 24 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 2
Result - Distance             : 0 mm, Status: 2
Offset                        : 0 mm
Crosstalk (Xtalk)             : 9 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

Data Ready:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 1
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 581 mm
Signal Per SPAD               : 0 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 16 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 2
Result - Distance             : 0 mm, Status: 2
Offset                        : 0 mm
Crosstalk (Xtalk)             : 9 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

Data Ready:

********************
Start Sensor Printout

Timing Budget in ms           : 100
Distance Mode                 : 1
Intermeasurement Period in ms : 0
Boot State                    : 3
Sensor ID                     : 60108
Measured Distance             : 535 mm
Signal Per SPAD               : 0 kcps
Ambient Per SPAD              : 0 kcps
Signal Rate                   : 8 kcps
Number of SPADs               : 1
Ambient Rate                  : 0 kcps
Range Status                  : 2
Result - Distance             : 0 mm, Status: 2
Offset                        : 0 mm
Crosstalk (Xtalk)             : 9 cps
Distance Threshold Window     : 0
Distance Threshold Low        : 0 mm
Distance Threshold High       : 0 mm
ROI Width                     : 64663, 4096
ROI Center                    : 199
Signal Threshold              : 1024 kcps
Sigma Threshold               : 90 mm

End Sensor Printout
********************

 

 

 

John E KVAM
ST Employee

I'm going to guess that the 'bad sensor' has a bad coverglass. You have no signal. Assuming you have a good sized relatively close target you should have signal. So, the light is either not hitting your target or it's not coming back. 

Use a camera to verify (but NOT an Iphone - the IR filter is too good.) Check the relative brightness of the laser flash. 

I've seen this once before - someone cleaned the coverglass with an abrasive cleaner and destroyed the coverglass.

Then try removing the coverglass. My bet is that the sensor will work.

then look at the coverglass through a microscope. It should be clean and flat.

The odds of getting a bad sensor are really small. We have to test and calibrate each one in the factory. The are individually tested. If you don't have some sort of production issue, they still work.

- john


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
John E KVAM
ST Employee

There is an article on coverglass - 

https://community.st.com/t5/mems-and-sensors/time-of-flight-cover-glass/ta-p/49259

It explains what is important about coverglass.

Besides the 'glass' itself is the air-gap. It's the distance between the sensor and the glass.

That gap is every bit as important as the glass itself.

I one sensor you had crosstalk of 3 and the bad one had crosstalk of 9. 

That is a wild swing - assuming you took any care at all, it should be closer.

If your crosstalk number is lower than your actual crosstalk, you UNDER-range. 

If your crosstalk number is too high - you will OVER-range.

In your 'bad' sensor you show HIGH crosstalk, and OVER-ranging. 

You have massively different signal rates and massively different crosstalk numbers. 

Either your calibration technique is incorrect, or the glass/air-gap is different between the two samples.


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

Hi John,Unfortunately I don’t think it’s related to cover glass. The good / bad divide remains the same regardless of whether we have the cover glass fitted or not. 

All the tests above were actually completed with no cover glass, just a small baffle. I did also test without the baffle, with the same results. Our baffle and glass solution I think is quite good, we didn’t do any calibration at all on the production units that have shipped, no issues with those. 

I guess the xtalk calibration should have been done with a coverglass, I’ll redo that. 

I’ll have a look at the laser through a phone tomorrow, I’ll have to borrow a non-iPhone. 

Zhiyuan.Han
ST Employee

Hi

Good to here have identified the Null issue. agree with John, for the "bad" sensor, the return signal is quite low. please check if the VCSEL is really work or not.

The other thing I am thinking, you may apply a big xtalk value.  for the log I see you applied 9 for "NG" and 3 for "OK"

Can you try to do range measurement without cover glass, and without calibration, and without loading calibration data?

 

Br

Zhiuan.Han


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.
Aurelius
Associate II

Hi Guys,

Thanks for the fast responses.

I really don't think this is a cover glass issue, I have already tried 2 samples from the "good" and "bad" batch with each of the following tests, with and without calibration.

- No baffle or glass.

- Baffle without glass

- Baffle with glass.

I also experimented with the distance mode and timing budget.

 

No matter what I do the result is the same, the "good" sensors remain working perfectly, the "bad" sensors remain erratic. 

To show exactly what I mean by erratic, here are typical results.

Bad Sensor

Test_Sensor
VTOF=403mm  (32) (7)
VTOF=423mm  (29) (1)
VTOF=526mm  (41) (7)
VTOF=510mm  (34) (7)
VTOF=546mm  (19) (1)
VTOF=491mm  (29) (7)
VTOF=491mm  (29) (1)
VTOF=509mm  (49) (7)
VTOF=435mm  (41) (7)
VTOF=551mm  (40) (7)
Min: 403, Max: 551, Avg: 488.50, Std Dev: 51.61

 

Good Sensor

Test_Sensor
VTOF=312mm  (330) (0)
VTOF=313mm  (330) (0)
VTOF=311mm  (331) (0)
VTOF=314mm  (341) (0)
VTOF=316mm  (327) (0)
VTOF=311mm  (331) (0)
VTOF=310mm  (310) (0)
VTOF=313mm  (337) (0)
VTOF=312mm  (319) (0)
VTOF=309mm  (342) (0)
Min: 309, Max: 316, Avg: 312.10, Std Dev: 2.02

 

As I've already said, the baffle and glass cover make no difference, though the above tests have the lens and glass fitted. The target is same static grey body. 

Aurelius
Associate II
Use a camera to verify (but NOT an Iphone - the IR filter is too good.) Check the relative brightness of the laser flash. 

I found something interesting here, on the good sensors I can clearly see the laser flash when using an Android camera (you are correct about the iPhone filter). However on the bad sensors I can't see anything at all on the camera.

 

Under the digital microscope it's even easier to see the difference.  

What does this tell us?

Faulty sensor hardware? (I've triple checked my supply rails and connections)

Any firmware settings I can modify?

 

Good Sensor

Aurelius_1-1706277196961.jpeg

 

Bad Sensor

 

Aurelius_2-1706277233834.jpeg

 

 

 

(Tip for anyone making the same investigation, you may need to reduce ambient light so that your camera/microscope increases exposure time. But be sure to keep the ambient light level and distance the same between sensor samples).