VL53L0X comparison - update to 2000mm

For general Flowcode discussion that does not belong in the other sections.
chipfryer27
Valued Contributor
Posts: 1110
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

VL53L0X comparison - update to 2000mm

Post by chipfryer27 »

Hi

This is a follow up to a previous bug report regarding the VL53L0x Time of Flight sensor.

In the post I mentioned that the accuracy was a bit "suspect" which may have been due to it being a cheap module available from a well known marketplace. I decided to obtain a better module that used genuine components and compare the two.

My set up was that the module would be fixed to a length of "Makerbeam" and a target would slide along the beam. A steel rule would be used to measure distance between. The same code which averaged 100 readings was used to interrogate both modules in turn. All measurements are in mm with the delta in brackets.

100_0022.JPG
100_0022.JPG (128.8 KiB) Viewed 4839 times
100_0028.JPG
100_0028.JPG (155.28 KiB) Viewed 4839 times
Capture.JPG
Capture.JPG (26 KiB) Viewed 4839 times
The above surprised me. At 50mm and above (with the exception of 150mm) the cheapo module appears to have a reasonably consistent error of 15mm which could possibly be factored in. However the cheapo did fluctuate if left alone whereas the genuine was consistent. If I moved the target 1mm then the genuine reading would change accordingly, the cheapo sometimes didn't register.

Both of these modules are OK for me as I only need to know if there is an object in my path, not accurately measure distance to it and both of these will do that. I might get a longer beam and test out to 2000mm or to a wall or something.

Hope this is of some small interest.

Regards

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: VL53L0X comparison

Post by BenR »

Hi ChipFryer,

That's brilliant, some proper scientific vigour there. I really appreciate you taking the time to craft a proper rig and sharing your results. It is as you say producing very interesting results.

The code behind this component is immense and uses a lot of manufacturers recommended magic numbers which makes me hopeful that in future with more work someone will either break the back and make the code much simpler or the manufacturer will take some steps to bring some of the complex software and translate it into the hardware of the sensor itself. Even some tweaked magic numbers may proove to provide much better accuracy.

What do the graphs look like for the readings, are they straight lines? If so with a bit of a calibrated scaling factor stored into EE memory could be made to give very accurate readings.

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: VL53L0X comparison

Post by chipfryer27 »

Hi Ben

I was pushed for time as I was setting up for something else and took the opportunity to do a very basic test. I was considering using one of these to establish if there were any obstacles in my way over a given distance, and as they are compact and accurate enough for me to establish if anything is in my path I'll probably experiment a bit more.

My code was simplistic in the extreme. Test to see if the sensor is connected then Loop one hundred times whilst averaging the readings. I didn't even use any of your great averaging techniques that help smooth out randoms. Maybe with more diligence, results could be tightened.

I initially used a relatively small target and with that results were appalling. That piece of PCB in the picture made a huge difference to the accuracy. Discrepancies in delta of a mm or so between distances could easily have been down to me. At the weekend I'll probably set it up on a two metre rail facing a wall and do some further testing.

So far it looks to be OK as a proximity detector.

Regards

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: VL53L0X comparison

Post by chipfryer27 »

Hi

Did the experiment out to two metres. Despite documentation suggesting it could reach that far neither were of any use above ~1100mm and that is stretching it. Clearly they like big targets so detection of a human or such like is well within capability.

100_0037.JPG
100_0037.JPG (120.1 KiB) Viewed 4765 times
100_0038.JPG
100_0038.JPG (175.86 KiB) Viewed 4765 times
2000mm.JPG
2000mm.JPG (65.71 KiB) Viewed 4765 times
Above 600mm I would get random readings of approximately 100mm above what was the normal. Beneath 600 this didn't occur.

Size of target is clearly making a difference. With a wall to bounce off of the genuine chip beats the clone hands down which wasn't the case with the smaller target (although that could have been due to slight misalignment).

Code as before, the most basic grab and average you could come up with.

For my needs both of these will do the job nicely as I just need to know if anything is there out to around 750mm. Obviously I'll use the genuine chip first but when I blow it up I'll fall back on the clone (maybe I should do that the other way round.......<s>)

Regards

stefan.erni
Valued Contributor
Posts: 738
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 170 times

Re: VL53L0X comparison - update to 2000mm

Post by stefan.erni »

Hi chipfryer27

Very nice, I like what and how you do it.


You can still look at the FOV (Field of View) from the sensor. You can put the sensor 50cm higher with an aluminum profile and maybe you will have different (better) values.

regards

Stefan

The following Part may also be of interest to you

https://www.st.com/resource/en/datasheet/vl53l5cx.pdf

https://www.st.com/resource/en/data_bri ... -satel.pdf

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: VL53L0X comparison - update to 2000mm

Post by chipfryer27 »

Hi Stefan

Thanks for the links and also about increasing the height. Great suggestion and when I get a bit of free time I'll try that.

The multi-zone certainly has some possibilities.

Best regards

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: VL53L0X comparison - update to detect zombie

Post by chipfryer27 »

Hi

I recently had a bit of time so incorporated Stefan's suggestion above into a test. Unfortunately the "cheapo" sensor has given up the ghost despite not being used since the previous test, so I only had the "genuine" module to play with.

The aim was to detect a zombie before it gets close enough to attack me. I figured as zombies would most likely be at the background temperature PIR based sensing would be ineffective and the cat gets really annoyed when I play with ultrasonics (you should see it move when my Tesla coils discharge).

As per attached pictures, I connected a sensor to a combo-board and mounted this on a two metre rail to move freely away from a relatively tame zombie.
RIMG2270.jpg
RIMG2270.jpg (39.67 KiB) Viewed 3292 times
RIMG2274.jpg
RIMG2274.jpg (40.16 KiB) Viewed 3292 times
RIMG2277.JPG
RIMG2277.JPG (196.13 KiB) Viewed 3292 times
As per previous tests, I used the most simple of loops to average 100 measurements and display the reading. I then documented five consecutive readings. The distance from sensor to zombie was measured using a tape measure so the actual distance was no more than a few millimetres out.
Readings.JPG
Readings.JPG (46.87 KiB) Viewed 3292 times
Up to 200mm we can see that it's quite accurate as the discrepancy could easily be down to me. At 300 and 400mm there was no way I was ~10mm out but the readings were consistent and within 3% of actual. I would say the same for 500mm as I could easily be a few mm out in my measurements.

At 600 and 700 the readings, although quite consistent, are quite a bit out. At 800 the readings started to be less stable and by the time we reach 1000mm there isn't any real accuracy. At this range random readings started to appear up to 1411mm.

Not much above 1000mm it became too unstable and gave wildly inaccurate results between 3000 and 7000mm (incidentally when simulating the maximum distance reached is 1200mm).

Despite documentation stating that the reflectance of the target doesn't factor I have to disagree as without the t-shirt I could not get stable readings much further than 300mm and would frequently receive readings in the thousands.

So, based on my tests it would be ill advised to rely on one of these modules to alert you in time to prevent certain death...

Regards

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

Re: VL53L0X comparison - update to 2000mm

Post by mnfisher »

Cool zombie. Great project - you never know when they might attack!

Martin

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

Re: VL53L0X comparison - update to 2000mm

Post by mnfisher »

Just reading the datasheet - and it looks as though the accuracy you are getting is pretty good.
Certainly - accuracy in the dark is much better than in the light - so might just be the limits of the device..

This from datasheet (for the '1' variant - which I think has a longer range
v53l1x.png
v53l1x.png (198.86 KiB) Viewed 3246 times
Not a problem - I think zombies usually move at night. They are certainly harder to spot then?

Martin

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: VL53L0X comparison - update to 2000mm

Post by chipfryer27 »

Hi

Interesting reading, I'll grab a lux reading next time I'm in.

As Ben mentions in another post, there is a lot of work to get these modules to play at all so I'm just happy we have any component :D Perhaps with some setting tweaks accuracy could be improved (as per earlier post, I just needed to know if anything was present up to 750mm).

Depending on the folds of the t-shirt I would get different results so had to ensure the target area at the height of the sensor was pretty flat.
I think zombies usually move at night
That might be vampires and I think this sensor could have trouble as they don't show up in mirrors..... Ultrasonics could be a better solution as it would not only detect them but perhaps scare them off too or at least interfere with their navigation... Maybe time to resurrect some of those sensors Matrix used to do and perhaps adapt.... I think they had a blood measuring sensor of sorts :lol:

Regards

Post Reply