2020-12-18 04:14 PM
Greetings.
If I point the sensor at a wall and then slowly move my hand into the sensor's viewing area, the sensor gradually changes its reported range from the distance to the wall to the distance to my hand as shown in this graph.
Is it possible to set up the sensor to immediately report my hand's true distance as soon as it is detected instead of reporting a false distance until it has been fully moved in front of the sensor?
Here is my API setup code:
VL53L1X_SensorInit( 0 );
VL53L1X_SetTimingBudgetInMs( 0, 20 ); // 20ms sample time
VL53L1X_SetInterMeasurementInMs( 0, 20 ); // Sample every 20ms
VL53L1X_StartRanging( 0 );
Thank you
Scott Wild
Solved! Go to Solution.
2020-12-18 05:43 PM
Scott -
The VL53L1X is going to do exactly as you say. However we have a part that does what you want.
The VL53L1CB is what you want.
The chips are almost identical. But the CB version runs different code.
So identical in fact that there is a really, really good chance your X will run the CB code - but it's not guarenteed. (So if you go into production do buy the CB version. It's only a few cents more.)
Download the
STSW-IMG020 GUI for X-NUCLEO-53L1A2
if you have the EVAL kit. It will most likely will run on the -53L1A1 kit.
Download the STSW-IMG019 API for VL53L1CB
The IMG019 is pretty large. But it does a lot more.
Play with it. Make sure it does what you want.
You will get two targets in the case you suggest. You will see your wall AND your hand.
Good luck
2020-12-18 05:43 PM
Scott -
The VL53L1X is going to do exactly as you say. However we have a part that does what you want.
The VL53L1CB is what you want.
The chips are almost identical. But the CB version runs different code.
So identical in fact that there is a really, really good chance your X will run the CB code - but it's not guarenteed. (So if you go into production do buy the CB version. It's only a few cents more.)
Download the
STSW-IMG020 GUI for X-NUCLEO-53L1A2
if you have the EVAL kit. It will most likely will run on the -53L1A1 kit.
Download the STSW-IMG019 API for VL53L1CB
The IMG019 is pretty large. But it does a lot more.
Play with it. Make sure it does what you want.
You will get two targets in the case you suggest. You will see your wall AND your hand.
Good luck
2020-12-21 09:21 AM
Thank you for the info!
2020-12-21 11:10 AM
And if the VL53L1CB works for you, but you don't need the adjustable Field of View or the extra distance, consider the VL53L3CX. This chip uses the exact same software as the VL53L1CB, but does not have the lens over the receive side. This would save you some money.
2021-01-11 09:23 AM
John. Can you elaborate on the procedure for using the VL53L1CB API? I have the Sparkfun VL53L1X board. Do I need to use the GUI?
2021-01-21 02:24 PM
It's pretty straightforward. Just download the source and build it into your project. You will need to modify platform/src/vl53l1_platform.c to support your hardware's I2C and timing routines.
For simple autonomous mode, do the following in your setup routine:
VL53L1_DataInit( &vl53l1Dev );
VL53L1_StaticInit( &vl53l1Dev );
VL53L1_SetPresetMode( &vl53l1Dev, VL53L1_PRESETMODE_AUTONOMOUS );
VL53L1_SetInterMeasurementPeriodMilliSeconds( &vl53l1Dev, 50 );
VL53L1_SetMeasurementTimingBudgetMicroSeconds( &vl53l1Dev, 40000 );
VL53L1_SetDistanceMode( &vl53l1Dev, VL53L1_DISTANCEMODE_SHORT );
VL53L1_StartMeasurement( &vl53l1Dev );
Then in your main loop, do this to read the range data:
VL53L1_RangingMeasurementData_t rangeData;
VL53L1_GetRangingMeasurementData( &vl53l1Dev, &rangeData );
// If a ranging error was found, return 0
range = rangeData.RangeStatus ? 0 : rangeData.RangeMilliMeter;
Be forewarned, the library is a hog. It takes around 44k of code space and 12k of SRAM.
Good luck!
Scott