cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1X for people counting algorithm

LNGUY.1
Associate

I'm trying to use VL53L1X for counting algorithm in the link: https://www.youtube.com/watch?v=c91Ve-g0J2U but I'm having a problem with accuracy.

Thanks to SparkFun_VL53L1X, I can set ROI centers to separate front/back zones. By measuring and analyzing the distances of targets within field of views of these zones, the main idea for counting algorithm is described in this link: https://www.st.com/resource/en/user_manual/dm00626942-counting-people-with-the-vl53l1x-longdistance-ranging-timeofflight-sensor-stmicroelectronics.pdf 

However, I am facing to a big problem according to the accuracy of distances. Even when I fixed the distances from sensor to ground, the received distances is fluctuating. Currently, I set sensor's position 2.3 m from the ground as well as ROI centers in (159, 231), 50ms for each loop but the result obtained while having someone cross the door isn't as expected(should be like the image below).

0693W000001sizFQAQ.pngThe normal case: obtained the same distances to front/back zones even when having someone in front zone or back zone. 

Have you ever faced this problem and can you please suggest a way to improve this case?

I'm also planning to test with 1 more sensor, it should be better but I'm not sure that it can work well. 

Thank you and best regards,

L-T-P NGUYEN

22 REPLIES 22
John E KVAM
ST Employee

50ms is too long of a period. In 50ms you will only get maybe one sample of someone in each zone. But probably you will see the person show up in both zones.

Try setting your timing budget to 15ms.

If you can see the floor at this Timing budget you will do better.

  • john

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. It helps the next guy.

Thank you for your reply,

I understand your idea, may be it take up to 100ms to have each results. If the duration for each person passing to the door is around 500ms, I could only obtain around 5 samples, not enough for this algorithm. But I saw in ST's manual for this sensor, the timing budget should be set from 20ms up to 1000ms( recommendation is 33ms for all distance). It's not too much improvement. But I still don't know how ST can obtain too many samples (the image below)as in their paper. I try to reduce timing budget but can't be obtained lots of sample like them.

John E KVAM
ST Employee

In the UltraLite Driver - which I believe you are using there is a setting for 15ms.

that's what we used in the demo software.

It should work for you too.

  • john

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. It helps the next guy.
HMull.1
Associate II

Correct me if I'm wrong, but the 15ms timing budget will only work in short distance mode? OP stated that the required height is set at 2.3m which means the sensor should be set in long distance mode. I think timing budget should then be set to 20ms.

John E KVAM
ST Employee

On ST.com search for “people counting�?

You will get:

STSW-IMG010

ACTIVE

Embedded Software

Proximity Sensors Software

PEOPLE COUNTING SW code example for VL53L1X

It should have everything figured out for you. It's our example code.

And you are right, I remembered 15ms but not the Short mode only requirement.


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. It helps the next guy.
Yle.1
Associate II

try set roi center (167,231)

Hi Yle.1,

You are on the right path ! Actually, we are working to improve the people counting example code we provided. I observed that shifting lightly the "theoretical" center I got better signal rate => better detection reliability. The code should be released as soon as we finished to update the user manual.

(175,231) is the best centers couple which give the best detection rate.

#define FRONT_ZONE_CENTER              175 // was 167, see UM2555 on st.com, center = 175 has better return signal rate for the ROI #1

#define BACK_ZONE_CENTER               231 

Concerning the ranging speed, there is no need to go fast for people counting use case. Knowing that the average walking speed is 4~6 KM/ hour. To cross the two areas of the sensor you may need 500 ms or 300 ms depending on the distance between the sensor and the walking people, so setting the timing budget = inter-measurement period = 33 ms you can get up to 15 samples or 10 samples. It is enough, increasing a little bit the timing budget from 20 ms to 33 ms allows the sensor to range with better accuracy avoiding wrong interpretation.

Julien


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.

Yes, I've tested setting up a lot of different ROI centers. The result is that the center of ROI has a great impact on the accuracy of the data. I just looked at um2555, but I didn't see a description of the signal rate and ROI. The ROI area I'm currently using is 5x5, with 167 and 275 centers. If according to your setting, should the area size be set to 8x8?

Julien NGUYEN
ST Employee

​Hi Yle,

You can use this function      status = VL53L1X_GetSignalRate(dev, &SignalRate) to get the signal rate. The signal rate tells you the quantity of photons coming back from a target. The more the signal rate is, the more the accuracy is. We use two ROIs 8x16 (large x height). For me, you shouldn't  decrease more the ROI size, because you will lose in sensitivity, in fact the receiver area is smaller in 5x5 than 8x16. The reason why you set smaller ROIs is two separate the two detection zones? What is your application, people counting or other ?

Julien  


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.