standard servos hacked to provide feedback

Hi folks

found these instructions to add feedback from a standard servo.

wanted to know whether anybody has already given it a try and wouldn't it be nice to actually get a feedback where the servo is and not simply have to assume that the servo moved as requested?

would need extension of the servo service to allow for specifying feedback and do the math?

and the greatest thing is that it only requires a bit of hacking with zero costs?


juerg's picture

feedback servo

gave it a try with a TowerPro MG995.

simply used analog pin 2 on my arduino and connected the point on the servo board that showed different voltages at different angles (middle pin below the outgoing cables).

needed some analog reads (100) in the setup to show  valid start values. In a 100 ms loop I incremented the servo position by 1 from 0 to 180 and used the average of 10 times analogRead for each cycle.

I did not expect such a perfect fit of position and analog read result. Will play around now with preventing moves and servo detach if position can't be reached.


juerg's picture

kind of hitting a wall

My trials with the (very cheap) MG995 copy was not very successful

a) huge initial deadband (it needs more than 10 1 degree increments to start moving)
b) whatever I tried I could not get a smooth slow rotation of the servo with decent stepping (tied to play around with servo.writeMicroseconds() but none of the increments (1..15 resulted in a proper stepping

Modified also a sitting around BlueBird L530 and saw some improvement:

a) no initial deadband
b) smooth positioning with 6us steps

Problems with this guy: frequently does not show a proper analog reading value fitting for the position (I assume because the servoBoard has an impact of what I see) or needs a lot of time and repeated readings to show a reasonable value. Therefore sensing resistance or even blocking is not easy to detect. Also saw that my analog read value goes through the ceiling when blocking the rotation physically - I would rather see the read value stay the same :-(

It also looks like we would need quite a number of parameters to treat all the different servos correctly. I am in the process of writing a testing app to get the corner numbers.

In total it is my opinion the I would be much better off with a separate potentiometer for the position reading. I am thinking of a double layer potentiometer and an additional cable for reading that out to replace the built-in poti.

Unfortunately I wasn't able to find such devices that could replace the existing potis in the servos? The double layer potis I found (and which I will try to test out with e.g. the externally mounted sholder potis) won't fit into the servo caseings and a countact I found at towerPro stopped discussions with me :-(

Maybe one of you readers can point me to a possible source (double layer poti to replace built-in servo poti?


juerg's picture

standard servos with feedback

Has anybody experience with the parallax feedback servo?

This might be a better and more general approach for small size and feedback without having to hack the servos. Unfortunately it looks like a rather week servo (2 kg)

juerg's picture

I feel so alone

Looks like I am a lonely rider on this subject - not a single feedback - but it's about feedback! And it could save your robot from burning or hurting/demolishing things!

OK, I slow down, an update

Parallax feedback servo

I have purchased the parallax highspeed 360 deg feedback servo and struggeled a bit to make it perform with the Arduino. Examples are a bit rare and I first had to get used to have to read a pwm signal to get the current location of the servo. Landed in the trap of "pulseIn" which is supposed to be precise with interrupts turned of. Turned out this is a big problem for the servo library and caused my servo to stutter to its target. To the help came "pulseInLong" that uses interrupts itself so no need to turn them off.

But now suddenly I am fully resposible for the servo, meaning watch your target position and stop when you get there. Take care of position holding yourself. This is kind of a big change and my controlling SW needs for sure some polishing. Despite the 2 kg limit for pull I somewhat like the servo and I am sure to find a use for it.

Hacked servo with double layer

I decided to use a modified finger tester. Unfortunately the current files on the InMoov site contain pulleys I do not understand how they have to be assembled. A jell for help on the InMoov site is unanswered so far.

But why not reconsider and create my own version of the pulleys. My measurement resulted in a 21 mm pull for closing the finger and a 16 mm pull for opening it, making it a 1.3 factor between the two movements. My currently used pulleys differ however much more (Mats?). Assuming my servos can cover 180 degrees (MG995 is rather 240 degrees) I ended up with pulley diameter for closing of 2*21/phi = 14 mm, for opening it is 2*16/phi = 10 mm. I would like to get some feedback for my numbers - any of you having other insights? Anyway - just a side track.

So after modifying the finger tester I used a double layer poti to monitor the servo movement. Hacked my MG995 replica and removed the poti. Fed out the poti connectors to the first level of my 2-layer poti and connected the middle connector of the second layer to an analog input (If you have read my previous posts, tapping into the built-in poti on the servo board, analog reads did not really match current positions).

The green item in front is the double layer poti, connected to the servo horn. Poty in the servo is removed and is using the first layer of the double poti. From the second layer I use a analog read to get the position.

Thought my double layer poti would show a breakthrough :-?

Now have a look at my first results:


You can see that I have a huge deadband - maybe its the chinese delivery delay built into devices :-) - and as you can see a tendency of increasing analog values (y-axis) with requested positions (x-axis) the number of outliers make it practically useless for measuring progress. I would like to use progress versus requested position to either stop or slow down the servo (I would like to use a sensitivity level - high: stop movement, slow: slow down movement).

Look at a recording where I manually put a strain on closing the finger:

You can say in theory it will work - but look at the quality of the measures :-(

I do not know where the outliers are coming from but they constantly are on the upper side. So I could probably still make us of measured values below the expected value and either stop the servo or request less increment in positions per cycle.

Anyway - I haven't given up yet and will try to investigate further. Stay tuned.

Hope you made it to the end of this update and enjoyed.

Juerg + Marvin

P.S. you could make me so happy with a short comment