Page 1 of 1

VL53L0X component modification URGENT

Posted: Wed Mar 22, 2023 10:12 am
by Xbiotec
hello,
After checking the VL53L0X component and C code, it seams that RangeStatus and others below not used too
RangeMilliMeter
RangeDMaxMilliMeter
SignalRateRtnMegaCps
AmbientRateRtnMegaCps
EffectiveSpadRtnCount

Rangestatus is used to check if the measurement is valid or not .
it's a very important to know if value can be used or not and also because there is "radar aliasing".
Basically the light from flash N comes back after flash N+1, and an object at a far distance, looks near. So if rangeStatus is equal to 4 mean that measure is wrong.

1 - Could you add a component Macro to be able to read the range status register after a read distance and add it in a variable
like this, programmer could be able to use it or not
RangeStatus is from VL53L0X_GetRangingMeasurementData() . (may be register 0x0014 but not sure for RangeSatus )
get measurement.jpg
get measurement.jpg (97.07 KiB) Viewed 4662 times
https://www.st.com/resource/en/user_man ... ronics.pdf

2- please also add component macro to be able to get the data below at each reading if programmer want to use it
they are all from VL53L0X_GetRangingMeasurementData()
RangeMilliMeter
RangeDMaxMilliMeter
SignalRateRtnMegaCps
AmbientRateRtnMegaCps
EffectiveSpadRtnCount

3- add on component the ways to choose default mode or Single Ranging high Accuracy or Single Ranging High speed or Single Ranging Long range

If I can get Rangestatus function first, it will be very good to be able to use the TOF and be sure of the measure
Currently I saw that there is aliasing (and an object at a far distance, looks near)

Thx

Re: VL53L0X component modification URGENT

Posted: Wed Apr 12, 2023 8:38 am
by Xbiotec
hi,
still no reply !

Re: VL53L0X component modification URGENT

Posted: Wed Apr 12, 2023 10:21 am
by mnfisher
The component source is available - I have some of these, I'll have a look this evening and see if it's 'easy' to add any/all of these...

Martin

Re: VL53L0X component modification URGENT

Posted: Wed Apr 12, 2023 11:42 am
by BenR
Hello,

I've exposed the Read and Write register functions for you in v9 so hopefully that will allow you to read the required register when you need. Just use the Help -> Library updates to get the latest version of the component.

Martin may still want to do more withthe v10 code but hopefully this helps to get you started.

Re: VL53L0X component modification URGENT

Posted: Thu Apr 13, 2023 6:54 am
by Xbiotec
hello,
thx
on help, component source project can not be downloaded.
comp download result.jpg
comp download result.jpg (121.35 KiB) Viewed 4570 times

Re: VL53L0X component modification URGENT

Posted: Thu Apr 13, 2023 6:55 am
by Xbiotec
mnfisher wrote:
Wed Apr 12, 2023 10:21 am
The component source is available - I have some of these, I'll have a look this evening and see if it's 'easy' to add any/all of these...

Martin
thx for your help Martin, waiting for your news ;)

Re: VL53L0X component modification URGENT

Posted: Thu Apr 13, 2023 6:59 am
by mnfisher
I didn't have much success - reading the register at 0x14 seemed to consistently return the same value (91) - even with something placed on the sensor?

The documentation for the chip isn't great - but I had a quick look at the API code. Some more digging needed.

Martin

Re: VL53L0X component modification URGENT

Posted: Thu Apr 13, 2023 7:01 am
by mnfisher
Try saving the source file with a .fcfx extension
vl53l0x component.fcfx
(125.37 KiB) Downloaded 412 times

Martin

Re: VL53L0X component modification URGENT

Posted: Thu Apr 13, 2023 10:03 am
by Xbiotec
mnfisher wrote:
Thu Apr 13, 2023 6:59 am
I didn't have much success - reading the register at 0x14 seemed to consistently return the same value (91) - even with something placed on the sensor?

The documentation for the chip isn't great - but I had a quick look at the API code. Some more digging needed.

Martin
Hi Martin,
I did some test and read register from 0x14 to 0x1F, just after a measure
0x14 return 91,33,49,65, 79, 95, etc... this depend of the status result.
Then need to make the calculation:
RangeStatus = RangeStatus >> 6 //RangeStatus is the return value when read register 0x14 just after a measure
-when 0x14 returne value is 91 , after calculation the result is 11 --> Range complete (measure is ok)
-when 0x14 returne value is 33 , after calculation the result is 4 --> No Target
etc...
Do you know what are register 0x15 who return always 6, 0x18 and 0x19 ?

see excel file on PM.
do not ask me how I found these registers and how to calculate, It take so long search and time !!!! :)

Re: VL53L0X component modification URGENT

Posted: Thu Apr 13, 2023 9:43 pm
by mnfisher
Well - finally got the range status to display some meaningful values (okay 91 was meaningful - reading okay!)

So - embarrassingly - the sensor was picking up on the wires I'd used - the field of view and path of the jumpers just gave a enough of reflection... It first 'dawned' on me when I noticed that the values didn't change much when I moved the sensor to point at different locations (and it was giving the same readings in the FC component, my own code and the Adafruit component....).

So - one lesson learnt (maybe) and the sensor returning meaningful values (in my defence it was good at short ranges !)

So - I modified the component to read rangeStatus - and this worked well :-) (Reading it from 0x14)

VL53L0X_GetRangingMeasurementData - is a complex function (and it uses a fair few 'support' functions too...) - but it is doable.

The first step is to read all the registers into a 'temporary' data structure (an array would do here) - and then work out from there.

Martin