Let's Make Robots!

Free Servo force sensor

Uses the servos potentiometer to detect resitance on a gripper.
AttachmentSize
Gripper on my robot.2.24 MB
My robot.1.97 MB

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);

}

My robot!

 

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.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Your title is inaccurate as this method is used to monitor the servo position and cannot measure force. You need to measure current drawn by the servo to get an indication of force applied. I have already written this tip a few weeks ago.

Awe, be nice. 

Yes, you did just post this tip recently. I feel like his tip adds some value as he provides some code for checking for the condition when on object is preventing the gripper from closing any more. 

I agree his title is a bit misleading, but it is a good tip overall.

Sorry, not trying to be mean.

I hate inaccurate titles. It's not helpful when people use the search engine and can be misleading to students who might use the tip in a school project.

If we write tips to help others we should try to provide accurate information.

I agree with you about the titles, and I was just poking fun at you. You've been a huge friend to this site and helped tons of people with your tips, robots, comments, etc. 

Thanks for sharing your method. Another way to determine the force is employing a current sensor, with a series resistor in the ground terminal (0.33ohm for example). With an apropiated low pass filter (to supress noise and some high frequency signals), the voltage in this resistor will be proportional to the force applied. 

Be careful with the current spikes when the servo begins a rapid movment, this can produce a "false force" that must be filtered by software.

Cool. Collected.

It would be easy to add it to Grab-E for his gripper. All you need is to solder a wire to the potentiometer and connect it to an analog pin.

You have read my tiny, transparent mind.