cancel
Showing results for 
Search instead for 
Did you mean: 

Range data getting saturated after 50mm in VL6180X proximity sensor

Suthar.Narendra
Associate II

Hello,

We have integrated VL6180X proximity sensor with our Nordic chip. With help of ST application note we have prepared library for VL6180X sensor. We have consider all necessary setting mentioned in application note.

We are facing one strange issue. We are successfully getting range uptill 50mm but once object crosses 50mm it always show 255mm.

We tried many things like putting delay, changing I2C clock, switching to continuous mode but no luck till now.

I am attaching my VL6180X library and header file. Can anyone go through it and point out mistake if any.

Quick response will be highly appreciated.

Below is my Main.c file routine.

int main()

{

int range;

// load settings onto VL6180X

Init_Range_sensor();

Set_Default_Sensor_Data();

while (1)

{

twi_enable();

// start single range measurement

Start_Range_Sensor_Data();

// poll the VL6180X till new sample ready

Poll_Range_Sensor();

// read range result

range_mm = Read_Range();

printf("Range in mm = d\r\n",range_mm);

// clear the interrupt on VL6180X

Clear_VL6180_Sensor_Interrupt();

wait(0.1);

twi_disable();

}

}

4 REPLIES 4
IMarj
Associate II

Hi,

I have a similar issue. Did you manage to get it working?

Thanks.

IMarj
Associate II

I checked your code because I had a similar issue.

For me looking at the error code from register {0x04D} was helpful to see that every time the value jumped to 255, the error code was 0110: Early Convergence Estimate. When that happened measurement took only 6ms to make, whereas the valid measurement was always more than 10 ms.

You can tune the E2C but in my case I am not worried to power consumption, so I just disabled it - meaning it will try to get a valid measurement up to the max convergence time and not break after 5 ms if there is not enough signal by then. After I disabled the E2E I got valid measurements.

You are enabling it in your code by:

Write_Byte_VL6180(VL6180X_SYSRANGE_RANGE_CHECK_ENABLES, 0x10 | 0x01);

to disable it bit0 of this register should be zero and the hence:

Write_Byte_VL6180(VL6180X_SYSRANGE_RANGE_CHECK_ENABLES, 0x10);

This is the document which helped me understand E2E:

https://www.st.com/content/ccc/resource/technical/document/design_tip/bf/bc/1e/c2/19/32/43/47/DM00122212.pdf/files/DM00122212.pdf/jcr:content/translations/en.DM00122212.pdf

Thanks,

Igor

John E KVAM
ST Employee

Exactly correct.

Any error status not equal to 0, will set the range to 255 (the largest number we can return).

So check the error code register to see why the sensor returned a 'fail'.

Keep in mind that there is a 'multiplier' to get distances above 255.

A multiplier of 2 will enable distances up to 510 mm, which is the practical upper limit.


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.

For ranges 350mm+ I'd suggest using multiplier of 3, then you can measure even longer distances. Our tests show that we can measure up 580mm, even with a cover glass.