Hello,
I'm trying to implement a system that measures objects from different size and material. The minum object' size is 20x6 (wxh) mm. I though that the VL53L0x sensor was a good option. The idea was to measure first a known distance from the sensor to a plane, then measure the distance from the sensor to the top of the object and finally calculate the object height by subtracting both the measurements.
I created a small setup as in the attached immage with the sensor positionated 50 mm above the plane. Using Adafruit library, arduino uno and the Adafruit's example code, I'm getting a measure of 74/75 mm instead of the 50mm, but it's a stable value so I assume I can correct the offset via software.
The problem I encountered is that depending of the color and the material of the object the measure changes a lot, so for example is the object is white and same material as the sensor's support (3D printed PLA by the way) the measure is very good. If a use a black component, for example a cellphone, (10mm thin) the measure is not even similar to the real dimension, I get about 34 mm.
If a put a black piece of paper on the plane, the default measure changes from 74/75mm to 33/36mm.
Am I doing something wrong or cannot this sensor be used to do this kind of application?
I know that an ultrasonic sensor, like the HC SR04, would be better but the problem is that it's difficult to measure small objects with it.
This is the code that I used to get the distance:
#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);
}
I've also putted the sensor 70mm far from the plate but the behaviour is still the same. Do you think that the VL6180x sensor measures better different material and colors in comparison with VL53L0X?
I had a similar problems with VL6180 too, but I don't think the problem is the color but "the shines" of the surface. That is the limitation of both ST TOF sensors I tried.
The object covers the entire FOV. +-2.5mm would be acceptable but the problem is that I'm getting arbitrary measurements depending of the object wich makes the sensor impossible to use. I've read in another topics that people are getting good measurements so how can they get that results?
I wrote about that in post #7. So as you see this type of sensors cant be used for your application, if the accuracy is important. I still wonder what kind of objects you want to measure and why..
Do you know what sensors can be used for my application?
I need to measure the cap's height to check if it is face up or down with respect to the empty side, but i don't want to physically touch the cap because it can create a lot of other problems.
Yes, I need a go- no go signal depending is the cap is face up or down.
Caps go from 20 to 75 mm diameter and 5 to 35 height.
How does a background suppression sensor work?
From what I've understood this is a prensence sensor, so it only checks if there's or not a cap. I do not need to do that but verify the cap's orientation