P1070026.JPG (2148364Bytes)
P1070028.JPG (1987164Bytes)
I soldered a wire to the middle pin of the potentiometer inside the servo that operates my gripper. Using an analog pin, I can tell when the Servo isn't moving. I use a subroutine to slowly close the gripper and check if the potentiometer value has changed since the last time I incremented the servo value. If the value has changed much over the increment, is detects something is inside the gripper and is tightly gripped. this is the arduino code that I used:
void Grip() {
GripperVal = 80;
Gripper.write(GripperVal);
delay(100);
do {
lastPos = currPos;
GripperVal = GripperVal + 5;
Gripper.write(GripperVal);
delay(200);
currPos = analogRead(4);
delay(5);
if(Serial.read() == 'b') {
GripperVal = 80;
Gripper.write(GripperVal);
delay(100);
break;
}
}
while(abs(lastPos - currPos) > 5 && GripperVal < 140);
GripperVal = GripperVal - 5;
Gripper.write(GripperVal);
Serial.print("done - lastPos - ");
Serial.print(lastPos);
Serial.print(" currPos - ");
Serial.print(currPos);
Serial.print(" Gripper Val - ");
Serial.println(GripperVal);
}
This eliminates the need of a seperate force sensor to be installed into a robots gripper. Some of the values may need to changed for different servos. I ended up spending an hour and a half tuning it to my gripper.