VL53L0X readings are wrong

After purchasing some VL53L0X sensors, I have been testing them out for accuracy. While the sensors are quite consistent with regards to the values returned for any given distance, there is a problem in that the values are wrong. This is not simply a problem with a constant offset. If I calculate the ratio of mm/inches based off of my data, I get approximately 27.3 mm/in… This is somewhat problematic, as the ratio should be 25.4.

I have tested two chips, with equivalent results.
I have performed the tests using “high accuracy”. (The example code does not show this)

Since things are very consistent we could determine a reference point and adjustment ratio, and then apply a conversion after each reading to give us valid data, but that seems rather cumbersome, and I doubt that this is what the chip manufacturer had in mind; I have to think that I’ve misunderstood or missed something?

// This is the pertinent code

VL53L0X long_ranged_sensor;

// Yes, we are using multiple sensors
// SENSOR_TIMEOUT is 50
void initialize_sensors() {
	for (int i = 0; i < NUMBER_OF_SENSORS; i++) {
		muxSelect(i);
		delay(5);
		sensor.init();
		sensor.setTimeout(SENSOR_TIMEOUT);
	}
}

// NUMBER_OF_READINGS is 5
// We take the average of several readings to smooth the data out a bit
uint16_t take_sensor_reading(int index) {

	muxSelect(index);
	delay(5);
	int sum = 0, count = 0, value;
	while (count < NUMBER_OF_READINGS) {
		value = 1 * sensor.readRangeSingleMillimeters();
		if (sensor.timeoutOccurred()) {
			if (count == 0) {
				return 0;
			} else {
				return sum / count;
			}
		}
		sum += value;
		count++;
	}
	return sum / count;
}

Raw data: (S1 = "sensor1"; S2 = "sensor2")
S1        S2        inches
141       131       4
169       163       5
222       214       7
271       271       9
332       325       11
342       342       11.5
360       354       12
442       431       15

Hello.

I am sorry the accuracy you are getting with your VL53L0X is not what you expect. Just to be sure: is the “inches” column in your raw data the actual distance to your object, and is it something that you are directly setting? Also, what kind of surface are you sensing and within what field of view? How much ambient IR is there in your system? It might help if you send pictures of what you are sensing, as well as your setup.

-Jon

  • The inches column is the actual “measured with a tape” distance to the object.

  • Right now we are “looking” at semi-reflective plastic. I would expect a change of reflectance to impact all measurements equally, and to produce a constant shift rather than a change to the conversion ratio(?)

  • There is a floor/wall surface that runs parallel to the sensor’s LOS, which may intersect the FOV at some point, and which I assumed might have been responsible for the interference. (See picture) Performing measurements in an alternative “empty space” setup having no such “floor”-surface yielded equivalent results.

  • Not sure about ambient IR. I kind of assumed that the chip used some type of signaling to differentiate between ambient IR and the emitted signal… Was I incorrect in that assumption? (Not to be too snarky, but I must say that I have serious doubts about the broad utility of a sensor that only gives accurate results under tightly controlled light conditions…)

Thank you for your timely response! I really appreciate it!

Thanks for the pictures and extra information; it generally sounds like the inaccuracy you are getting is about what we would expect from the VL53L0X sensor. By asking about infrared lighting, I was mostly checking to see if your application was outdoors. The sensor has some immunity to infrared ambient light conditions, however, performance is worse in direct sunlight.

-Jon