cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L4CX_RANGESTATUS_OUTOFBOUNDS_FAIL at 1.8m?

cyclops
Associate III

Hi,

It seems that some of my measurements (in a green jojo tank) are resulting in a `VL53L4CX_RANGESTATUS_OUTOFBOUNDS_FAIL` error.
The measurement itself seems to still be correct as the tank is empty, and the result is around 1800mm.

I check the documentation and i don't really see an explanation for this error. It says things are 'out of bounds' but does that simply mean there's not enough reflection?

I've taken this sensor because it would do up to 4m, so i'm wondering what i'm doing wrong :)

 

1 ACCEPTED SOLUTION

Accepted Solutions

should only have to set the mode once per boot. 

So here is how it works. 

There was a SHORT mode. Didn't range as far, but because it didn't have to wait as long before each pulse, there were more pulses per millisecond, and with more pulses, more return signal. 

But if you wanted more distance, you could go with MEDIUM which is limited to 1.8 or so. Have to wait for the light to go out 1.8 meters and return before you could ping again. 

And then there was LONG. But it takes light a bit of time to go out 4 meters, and return. So, with fewer pings one needed more milliseconds of ranging before you get enough signal.

And everyone wants faster ranging, so giving that choice makes sense.

But if you have the time, feel free to just leave the distance mode to LONG and add a few milliseconds to the timing budget. 

Now lets talk about aliasing. This is where you set you max to say 1.8meters and you adjust all you timing for that. 

But some customer puts a target at 2 meters. Basically the sensor gets confused and thinks the photons from pulse N go with pulse N+1 and returns a distance of 0.2 meters. (2 meters actual minus the 1.8 max.)

To detect aliasing the sensor uses a pulse repetition interval consistent with 1.8 Meters and another one at 2M. If these two distances do not match, then we have aliasing and a distance longer than 1.8 meters.

Now some clever software guy realized one could use the distance returned by the one pulse repetition interval AND the distance from the other one, basically unwinding the deltas, to get a max distance of 6 meters out of a sensor only designed for 4 meters. 

And this 'unwinding' of the aliasing seems to work best when you leave the distance mode at MEDIUM. 

But your issue is that you are getting a warning saying your target is beyond 1.8.

Could it be that you have disabled extended range mode? (That's the alias unwinding.) With that disabled one is limited to 1.8, but the software knows the distance might be farther. 

See if the user manual says anything about extended range mode.

- john

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.

View solution in original post

8 REPLIES 8
John_Kvam
Senior II

Section 5.2 of the user manual talks about medium and long distances.

Distance mode
A function has been added to optimize the internal settings depending on the ranging distance requested by user.
The benefit of changing the distance mode is detailed in the following table.
Table 2. Distance modes
Ranging mode
Medium (Default)
Benefit / comments
Maximum distance
Long
Lower power consumption
The function to use is called VL53LX_SetDistanceMode().
The driver can help the host to select the optimum distance mode. A specific value is returned at each ranging to
indicate the best choice, depending on the ambient conditions.
Possible values are:
• VL53LX_DISTANCE_MEDIUM
• VL53LX_DISTANCE_LONG

----

Try calling VL53LX_SetDistanceMode(). Explicitly set it to either MEDIUM or LONG.

I fear you are in SHORT mode, which was something in the earlier code, but didn't prove all that useful and caused people to get an 'out of bounds error'.

Might try updating to the latest driver. At least figure out if you are using something recent. 

That's all I can think of. 

The error is telling you that you are ranging beyond the mode you are using. And that can lead to errors.

 

- john

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.
cyclops
Associate III

Thanks John!

 

I'm already doing a SetDistanceMode(medium) at the moment. 

 

Do i understand correctly that you'd do a measurement, then look at the value from the ranging and then set the mode and do another measurement?
If so, do i have to stop and start the measurement when i change mode?
Also - can i just always set long mode? Or would that have downsides for other things?

should only have to set the mode once per boot. 

So here is how it works. 

There was a SHORT mode. Didn't range as far, but because it didn't have to wait as long before each pulse, there were more pulses per millisecond, and with more pulses, more return signal. 

But if you wanted more distance, you could go with MEDIUM which is limited to 1.8 or so. Have to wait for the light to go out 1.8 meters and return before you could ping again. 

And then there was LONG. But it takes light a bit of time to go out 4 meters, and return. So, with fewer pings one needed more milliseconds of ranging before you get enough signal.

And everyone wants faster ranging, so giving that choice makes sense.

But if you have the time, feel free to just leave the distance mode to LONG and add a few milliseconds to the timing budget. 

Now lets talk about aliasing. This is where you set you max to say 1.8meters and you adjust all you timing for that. 

But some customer puts a target at 2 meters. Basically the sensor gets confused and thinks the photons from pulse N go with pulse N+1 and returns a distance of 0.2 meters. (2 meters actual minus the 1.8 max.)

To detect aliasing the sensor uses a pulse repetition interval consistent with 1.8 Meters and another one at 2M. If these two distances do not match, then we have aliasing and a distance longer than 1.8 meters.

Now some clever software guy realized one could use the distance returned by the one pulse repetition interval AND the distance from the other one, basically unwinding the deltas, to get a max distance of 6 meters out of a sensor only designed for 4 meters. 

And this 'unwinding' of the aliasing seems to work best when you leave the distance mode at MEDIUM. 

But your issue is that you are getting a warning saying your target is beyond 1.8.

Could it be that you have disabled extended range mode? (That's the alias unwinding.) With that disabled one is limited to 1.8, but the software knows the distance might be farther. 

See if the user manual says anything about extended range mode.

- john

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.

Thanks again John!

So, i have loads of time to measure, and i did already increase the timing budget because the docs say it would increase accuracy.

The code i run for each measurement is below. There's of course error handling and so on, but i left that out.

 
 
sensor_vl53l4cx_sat.begin();
sensor_vl53l4cx_sat.InitSensor(0x12);
sensor_vl53l4cx_sat.VL53L4CX_SetCalibrationData(&calData);
sensor_vl53l4cx_sat.VL53L4CX_SetXTalkCompensationEnable(1);
sensor_vl53l4cx_sat.VL53L4CX_SetMeasurementTimingBudgetMicroSeconds(200000); // should be max timing budget
sensor_vl53l4cx_sat.VL53L4CX_SetDistanceMode(VL53L4CX_DISTANCEMODE_MEDIUM); // should be changed to LONG
sensor_vl53l4cx_sat.VL53L4CX_SetOffsetCorrectionMode(VL53L4CX_OFFSETCORRECTIONMODE_PERVCSEL);
sensor_vl53l4cx_sat.VL53L4CX_SmudgeCorrectionEnable(VL53L4CX_SMUDGE_CORRECTION_SINGLE);
sensor_vl53l4cx_sat.VL53L4CX_StartMeasurement();
 

 

After this i do a loop with some VL53L4CX_GetMeasurementDataReady() and VL53L4CX_GetMultiRangingData() to get the measurements. I use VL53L4CX_ClearInterruptAndStartMeasurement() in the loop to get multiple measurements. I check the status and of the valid once i take the average.

I think the best thing to do is move to LONG mode and then see what happens.....

John_Kvam
Senior II

If you want up to 4M - switch to LONG mode. Add maybe 20% to your timingbudget to account for the fewer pulses.

Should work out to the same signal rate - more or less. 

Too little signal is a different error. 

And I don't know what OUTOFBOUNDS is either. 

I'll ask someone who still works there. (I've retired.)

- john

 

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.

Thanks John

 

It's nice that you still provide advice while not working there anymore!

I'll try the LONG option and see how that goes - it will take some time because the device is used and firmware upload would need to be coordinated.

I increased the timing budget to max already - was that not needed? Or could that have adverse effects?

John_Kvam
Senior II

If you are willing to set the timing budget up that high, then set the mode to LONG. You will have MORE then enough signal. Take a look at the Signal Strength. Generally the sensor tries to get to 20Million photons per second. Above that and the sensor will turn off SPADs. So if you are above 20, with only a few SPADS you can safely reduce the timing budget with no ill effects. The sensor will give a result as long as you have 0.5M photons per second. But at 20 you get better accuracy. 

And I've been working on these sensors for so long, I claim they are mine. :) Besides retirement can be boring - so this is a hobby now.

 

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.

Thanks John, you've helped me so much and it's been great.

Now, i'm not retired, but i do have this as hobby project with a purpose. It's great to get the support you're providing. They are great sensors and you should be proud :)