I made a fixture so that the sensor stayed a fixed distance from a target (approx 60mm) and collected data over hours (attached).  This resulted in a long term data trend of 56000 samples, taken roughly 1 per second over the course of roughly 15 hours.  The data reflects some basic smoothing of the measurement in the Arduino code.

Notice that it took about 45 minutes for the sensor to stabilize, and then there appears to be a 20 minute cyclical trend in the data.  My guess that this is temperature dependent, and this 20 min cycle is related to my furnace cycling.

Here are some details of the 20 minute cycle.

It looks like it may be possible to get accuracy of +/- .2 mm if the 20 minute cyclical variation could be reduced.  The next step would be to hold the sensor at a constant temperature and see if this eliminates this variation.

Arduino Code:

#include <Wire.h>
#include <VL6180X.h>

VL6180X sensor;

float dist, sens;

int count;

void setup()


  // Reduce range max convergence time and ALS integration
  // time to 30 ms and 50 ms, respectively, to allow 10 Hz
  // operation (as suggested by Table 6 ("Interleaved mode
  // limits (10 Hz operation)") in the datasheet).
  sensor.writeReg(VL6180X::SYSRANGE__MAX_CONVERGENCE_TIME, 05);
  //sensor.writeReg16Bit(VL6180X::SYSALS__INTEGRATION_PERIOD, 10);


   // stop continuous mode if already active
  // in case stopContinuous() triggered a single-shot
  // measurement, wait for it to complete

  sensor.writeReg(0x10A, 0x08);
  // start interleaved continuous mode with period of 100 ms

// Look at docs to see how to improve accuracy
// only use samples that converged
// look into whether samples are used twice or other issues with the uncoltrolled loop
// allow more variability in the output of the sensor and average in the mcu
// measure drift by connecting to the CNC machine to get precise moves



void loop()
  //Serial.print("Ambient: ");
  //if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

 if( abs(sens-dist)>10.0) {dist=sens;}

 dist = .995* dist + .005 * sens;

 if (count ==0)
  //Serial.print("\t Range: ");
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }