External depth sensor

Surface scan with external sensor

Description of the sensor:

Modified Arduino code from https://learn.adafruit.com/adafruit-vl6180x-time-of-flight-micro-lidar-distance-sensor-breakout/wiring-and-test

#include 
#include "Adafruit_VL6180X.h"

// Modified example code from:
// https://learn.adafruit.com/adafruit-vl6180x-time-of-flight-micro-lidar-distance-sensor-breakout/wiring-and-test
// 
// 2021-07-23 add filter

Adafruit_VL6180X vl = Adafruit_VL6180X();
uint8_t status;
float range;
float smoothed;
int filterStrength;

void setup() 
{
	filterStrength = 3;			// average of 4 values
	Serial.begin(115200);
	while (!Serial) {
		delay(1); 
	} 
	Serial.println("Adafruit VL6180x test!");
	if (! vl.begin()) {
		Serial.println("Failed to find sensor");
		while (1);
	}
	Serial.println("Sensor found!");
}

void loop() 
{
	range = vl.readRange(); 	// using single shot ranging
	Filter(smoothed, range, filterStrength);
	status = vl.readRangeStatus(); 
	if (status == VL6180X_ERROR_NONE) { 
		Serial.print("(PRB:Z-"); Serial.print(smoothed, 2); Serial.println(")");  
	}
	delay(50); 					// range execution time up to 10 ms at 100 mm
}

void Filter(float &OrigVal, int NewVal, int Strength){
	OrigVal= ((OrigVal * Strength) + NewVal) / (Strength + 1);  
}

 

Function:

  • The sensor will be read every 50 ms (= 20 Hz)
  • The average of 4 samples will be calculated
  • The value will then be send as a grbl-like probing answer: "(PRB:Z-12.34)" - continuously

  • The DIY-control interface receives and stores the data
  • The Serial Com interface takes and uses the last stored data, if an external probing command needs to be processed

 

 

 

Arduino code: vl6180.ino
Map data of the plaster face: face_1mm.map
OBJ data of the plaster face: face_1mm.obj
OBJ data material: face_1mm.mtl

 

 

 

Getting the height map of a plaster face, using an external depth sensor

We use our own or third party cookies to improve your web browsing experience. If you continue to browse we consider that you accept their use.  Accept  More information