MappyDot Calibration

The VL53L0X has 4 different calibration modes which implement the standard VL53L0X API calibration routines:

  • Reference SPADs calibration - Calibrates the SPAD arrays. This is performed at startup.
  • Temperature calibration - Temperature calibration adjusts the device sensitivity when the temperature changes. This is performed at startup and should be performed again when the temperature varies by more than 8 degrees Celcius.
  • Offset calibration - Calibrates the offset of the sensor. This is performed during assembly, but should be performed again if using a cover on the sensor.
  • Cross-talk calibration - Calibrations the "cross-talk" that is received from a close reflected surface such as a glass cover on the sensor. This must be performed if using a clear cover on the sensor or an aperture that restricts the viewing angle of the sensor.

The MappyDot will automatically switch to single ranging mode to perform these calibration routines. The targets discussed here are standard Munsell neutral chart values (Grey 17% N4.74, White 88% N9.5):

MunsellApproximated Colour
N9.5
 
N4.74
 


Calibration Routine

Reference SPADs Calibration

There are no specific environmental conditions required for calibrating the reference SPADs. If a highly reflective target is covering the VL53L0X module during reference SPAD calibration, the calibration may fail. In this case, user has to remove the target away from device.

Temperature Calibration

You will first need to perform the Reference SPAD calibration routine before calibrating temperature. There is no specific environmental conditions required for calibrating the temperature.

Offset Calibration

It is recommended to use a white (88% reflectance) target at 100mm, in a dark environment when performing this procedure. Target distance can be changed depending on constraints. You will first need to perform the Reference SPAD and temperature calibration routines before calling the offset calibration routine.

Once offset calibration has been completed, be sure to write the current settings as the default startup settings.

Cross-talk Calibration

You will first need to perform the Reference SPAD, temperature calibration and offset calibration routines before calling the cross-talk calibration routine. This requires changing the targets for the offset calibration and cross-talk calibration.

It is recommended to use a grey (17% reflectance) target in a dark environment when performing this procedure. Next choose the distance required for this target depending on the type of cover:

Crosstalk
Taken from page 9 of VL53L0X Datasheet. More information is located in the datasheet.


Low cross-talk covers will generally be clear glass and medium cross-talk will generally be a light coloured aperture around the sensor.

Once cross-talk calibration has been completed, be sure to write the current settings as the default startup settings.

Registers

The MappyDot can perform the VL53L0X the above calibration routines using the following configuration registers:

If these routines fail, the LED will blink a calibration fail code.

Code Example

Here's an Arduino code sample for performing the offset calibration routine:

#define CALIBRATE_DISTANCE_OFFSET                   (0x61)
#define CALIBRATE_SPAD                              (0x75)
#define TEMPERATURE_CALIBRATION                     (0x55)

void mm_to_bytes(uint8_t *bytes, uint16_t mm)
{
    bytes[0] = (mm >> 8 & 0xFF);
    bytes[1] = (mm & 0xFF);
}

void offset_calibration_routine()
{
  set_led_mode_off();
  
  /* Calibrate SPADs */
  Wire.beginTransmission(address);
  Wire.write(CALIBRATE_SPAD);
  Wire.endTransmission();

  delay(1000); //Delay to wait for error code

  /* Calibrate Temperature */

  Wire.beginTransmission(address);
  Wire.write(TEMPERATURE_CALIBRATION);
  Wire.endTransmission();

  delay(1000); //Delay to wait for error code

  /* Calibrate Offset */

  uint8_t calib_dist = 100; //In millimeters
  uint8_t dist_bytes[2];
  mm_to_bytes(dist_bytes, calib_dist);
  Wire.beginTransmission(address);
  Wire.write(CALIBRATE_DISTANCE_OFFSET);
  Wire.write(dist_bytes[0]);
  Wire.write(dist_bytes[1]);
  Wire.endTransmission();

  set_led_mode_pwm();

  Serial.println("Calibration Complete");
}