Skip to main content
Associate II
December 23, 2024
Solved

How do you turn the VL53L4CX extended mode on in python3 ??

  • December 23, 2024
  • 1 reply
  • 1943 views

How do you turn the VL53L4CX extended mode on in python3 ??

Best answer by John E KVAM

Short, Med, and Long define the 'pulse repetition rate'. It's how long the sensor waits before the next pulse. 

If one waits long enough for the light to go out to 4M, you don't get as many pulses in say 30ms then you would have if you only waited for the light to go out to 2M. 

More pulses means you get more photon detects. So, you get more accuracy, and you oddly, you can see faint targets more clearly. 

I believe what you are seeing is the combination of both your distance mode and the reflectivity of your target.

When in long mode you are sending fewer pulses and thus getting fewer photons returning. 

In medium mode, you get more pulses, and thus more photons. 

If you increased your timing budget in 'long' mode so you got the same number of pulses, you should get the same distances.

 

So next let's talk about the different ways one can use the sensor.

The VL53L1X and the VL53L4CD use standard ranging. 

The VL53L1CB and the VL53L4CX were intended to use Histogram ranging. 

(Histogram ranging involves sending the raw data to your MCU and it is the power of your MCU that digs out the distance. It does a better job, but it takes more resources.)

If you use the Python L1X code, you are running your VL53L4CX in standard ranging mode, not histograms. 

(And yes, it does work. The L4 and the L1 only differ in the VCSEL (laser). Otherwise, they are the same part.)

 

I see no reason that one angle is better than the other. I can only guess that you might have a window (and thus ambient light) affecting your measurements. 

 

1 reply

Andrew Neil
Super User
December 23, 2024

It's not part of the standard language.

Do you mean, "what Python3 libraries are available for the VL53L4CX which support extended mode?"

Or do you already have a library? If so, say which one.

 

How to write your question to maximize your chances to find a solution

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
December 23, 2024

I've install the PYPI version of VL53L1X, which appears to control the VL53L4CX perfectly. However, I have experimented with the ROI at full extent i.e. 0, 15, 15, 0, and with the range varying from 1 to 3 i.e. short, medium and long. Sometimes I get "wrap around", and sometimes I don't, depending on range of object and range setting. But, I've now set the ROI to as small as it can go i.e. 4, 8, 8, 4, and using ranges 2 and 3 I get some good clear results, with no wrap around. But, where I expected the range to plateau out at distances over 4m, it actually just records around 2.5m when in Long (3) mode. So if extended mode was turned on, would the distances recorded be more accurate and longer ?

As you can see from the 2 attached scans, both have the same parameters i.e. timing budget and ROI, but one is long and the other medium, range seeting 3 and 2 respectively. They look roughly the same until the distances between 135 and 180 degrees, where they differ dramatically. Also, in  that area (135 to 180 degrees) the distance should go further than 250cm - they should in theory go off the scale.

Andrew Neil
Super User
December 24, 2024

@peterhczaja wrote:

I've install the PYPI version of VL53L1X.


This: https://pypi.org/project/VL53L1X/ ?

There are contact links for the maintainers on that page

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.