You see, hobby servos are extremely easy to use but they are also pretty dumb, you would say them something like go to position “75 degrees” and then you will have faith that it reaches that point; but you really don’t get any confirmation from the servo. So if you are having a situation that can induce some bias on the position, like a lot of torque applied against the rotor, you don’t get any clue to where it actually is (besides visual feedback when you see the robot arm smashing somewhere it shouldn’t smash).
I decided I want to know where the servo rotor and horn actually are located at any time. For this endeavor I used the potentiometer that is already built in the servo.
First I opened the servo. Then I desoldered the connections from the servo PCB to the motor, so I could remove the PCB and gain access to the potentiometer. Once I was able to see the potentiometer I soldered a wire to the connection point in the middle (there are 3 connection points). I made a small notch into the servo case to put the new wire and later I soldered again the PCB to the motor. Finally I closed the servo.
|Opening servo case|
|Servo PCB just desoldered from motor connections. |
Note the potentiometer on the right, I soldered a line to the yellow wire.
|Servo closed again with the position feedback line coming from the case.|
With this method I measured the voltage from the moving part of the potentiometer (that’s the middle connection point) to ground. I used the analog input in the Arduino, therefore I had to convert the analog value (a number from 0 to 1024) to a voltage value (a number from 0 to 5V).
Also to characterize which voltage value corresponds to each position, I took apart each servo from the arm and swept across all positions without any load. While I was doing this, Arduino was also sending position and measured voltage values to my PC by serial communication. With all that information, I graphed Voltage vs Position, and fitted a linear tendency line to the graph, the resulting equation from the best fit tendency line will be my model of servo position.
|Shoulder servo graph with best fit line and equation.|
Next step will be to use this position model into my arm code and develop some closed loop control logic to correct position based on the position feedback.