cancel
Showing results for 
Search instead for 
Did you mean: 

Example 10: Motion indicator example.

BBald.1
Associate II

In the example file there is this comment.

   /* (Optional) Change the min and max distance used to detect motions. The

   * distance between min and max must never be >1500mm, otherwise the function below returns error 127

       min value is 400 max value 4000 */

In the vl53l5cx_plugin_motion_indicator.h file it indicates that the default are 400mm and 1500mm.

If I comment out the call to vl53l5cx_motion_indicator_set_distance_motion then I only get results of value zero. If I use vl53l5cx_motion_indicator_set_distance_motion() with values of 1000 and 2000 then I get results returned no matter where I wave my hand in front of the sensor. Any where between 10mm to 2500mm I see results. I was expecting to only see results when I wave my hand in the 1000-2000mm range.

Am I misunderstanding how this works?

1 REPLY 1
John E KVAM
ST Employee

This question has stuck me for a long time. Sorry about that.

I don't think those numbers are in mm - exactly.

The 400 represents time 0. And the upper number might be an approximation as well.

We wrote that code for one particular application, and then decided it might be useful to others.

We might have done a better job of documentation however.

In order to search for motion one must keep the histogram of one range and compare it to the histogram of the next.

So there is a memory limitation - which corresponds to 1500mm.

(Each bin of the histogram contains the number of photons collected during that clock cycle.

The speed of the clock means that each bin is a bit less that 4cm.)

So to use it, some experimentation is required.

In the target application the starting point was always 400, so we have not fully tested the lower limit.

The laser does not turn off abruptly. This leaves some number of photons being collected at a distance past the actual object.

It could well be that moving that starting point out may not work as well as it should.

But moving the end point in, means the algorithm will not store or compare those bins. So that should work fine.

Give it a try.

Let me know what you come up with.

  • 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.