VL53L0X component modification URGENT

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Xbiotec
Posts: 222
http://meble-kuchenne.info.pl
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 37 times
Been thanked: 27 times

Flowcode v9 VL53L0X component modification URGENT

Post 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 6769 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
Seb

Xbiotec
Posts: 222
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 37 times
Been thanked: 27 times

Re: VL53L0X component modification URGENT

Post by Xbiotec »

hi,
still no reply !
Seb

mnfisher
Valued Contributor
Posts: 2179
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1021 times

Re: VL53L0X component modification URGENT

Post 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

BenR
Matrix Staff
Posts: 2305
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 637 times
Been thanked: 847 times

Re: VL53L0X component modification URGENT

Post 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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

Xbiotec
Posts: 222
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 37 times
Been thanked: 27 times

Re: VL53L0X component modification URGENT

Post 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 6677 times
Seb

Xbiotec
Posts: 222
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 37 times
Been thanked: 27 times

Re: VL53L0X component modification URGENT

Post 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 ;)
Seb

mnfisher
Valued Contributor
Posts: 2179
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1021 times

Re: VL53L0X component modification URGENT

Post 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

mnfisher
Valued Contributor
Posts: 2179
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1021 times

Re: VL53L0X component modification URGENT

Post by mnfisher »

Try saving the source file with a .fcfx extension
vl53l0x component.fcfx
(125.37 KiB) Downloaded 507 times
(view online)

Martin

Xbiotec
Posts: 222
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 37 times
Been thanked: 27 times

Re: VL53L0X component modification URGENT

Post 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 !!!! :)
Seb

mnfisher
Valued Contributor
Posts: 2179
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1021 times

Re: VL53L0X component modification URGENT

Post 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

Post Reply