
jstarne1
USA
Asked
— Edited
I thought this.is.useful for grabbing a beer but it didn't say how it worked or what sensors used. Could You direct me to what sensors to buy to utilize this feature?
For that video (it was only a test) I had attached a sharp IR distance sensor to the top of the claw. A script watched for the distance to be low, then it would close the claw and move the object.
Does the sensor you used have a specific specification, or do you need to use trial and error or an ADC graph or meter to see what the voltage units are when set to 1 and then calculate up or down from there?
Thanks,
Alan
The ones I use are 4 to 30cm (GP2Y3A001K0F), so I know 255 is 4cm or 40mm and 0 is 30cm or 300mm.
The range being 30-4 = 26cm.
Which means a change of 1 in the ADC is around 0.1cm or 1mm if calculating it roughly. To calculate it more accurately...
Range/255 =
(30-4)/255
26/255 =
0.102cm per ADC
Bearing in mine IR sensors work backwards to Ping sensors, the closer the object the higher the value. So it's easy to get distance from them.
Distance = Minimum distance + (ADC x Multiplier)
In my case;
Distance = 4 + (ADC x 0.102)
Ex.
ADC = 172
Distance = 4 + (172 x 0.102)
Distance = 4 + 17.544
Distance = 21.544cm
Alan