Incorrect sensor readings from VL53L0x

Hi all,

I've been testing the VL53L0X on a test bench that I 3D printed.

I'm getting these readings when the sensor is situated approximately 5 centimeters away from the target:

Reading a measurement... Distance (mm): 85

Reading a measurement... Distance (mm): 85

Reading a measurement... Distance (mm): 84

Reading a measurement... Distance (mm): 86

Reading a measurement... Distance (mm): 83

I'm just using the example code from Adafruit:

#include "Adafruit_VL53L0X.h"

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);

  // wait until serial port opens for native USB devices
  while (! Serial) {
    delay(1);
  }
  
  Serial.println("Adafruit VL53L0X test");
  if (!lox.begin()) {
    Serial.println(F("Failed to boot VL53L0X"));
    while(1);
  }
  // power 
  Serial.println(F("VL53L0X API Simple Ranging example\n\n")); 
}


void loop() {
  VL53L0X_RangingMeasurementData_t measure;
    
  Serial.print("Reading a measurement... ");
  lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!

  if (measure.RangeStatus != 4) {  // phase failures have incorrect data
    Serial.print("Distance (mm): "); Serial.println(measure.RangeMilliMeter);
  } else {
    Serial.println(" out of range ");
  }
    
  delay(100);
}

Are the readings that I am getting normal for the sensor? If so, what are some other ranging sensors with better accuracy? If not, what can I do to make the sensor more accurate?

How "approximately 5 centimeters"?

Per Adafruit VL53L0X Time of Flight Distance Sensor - ~30 to 1000mm : ID 3317 : Adafruit Industries, Unique & fun DIY electronics and kits it says 5cm is at the lower limit:

This is the 'big sister' of the VL6180X ToF sensor, and can handle about 50mm to 1200mm of range distance. If you need a smaller/closer range, check out the VL6180X which can measure 5mm to 200mm and also contains a light sensor.

I'd measure and plot a few points within the range and see how the calibration curve looks.

According to the CAD, it is 5 centimeters. When I measured it with the measuring tape, it said it was 5.1 centimeters. Thanks for the suggestion. I'll test it again at 10 centimeters and 15 centimeters.

Here are the readings from 10 centimeters:

Reading a measurement... Distance (mm): 136

Reading a measurement... Distance (mm): 140

Reading a measurement... Distance (mm): 139

Reading a measurement... Distance (mm): 137

Reading a measurement... Distance (mm): 138

Reading a measurement... Distance (mm): 141

Here are the readings from 15 centimeters:

Reading a measurement... Distance (mm): 182

Reading a measurement... Distance (mm): 186

Reading a measurement... Distance (mm): 181

Reading a measurement... Distance (mm): 185

Reading a measurement... Distance (mm): 185

So it's about 30-40 mm off. Could the sensor be faulty? Would it be a better option to buy a new sensor than to account for the offset?

It will likely be amenable to: