View Full Version : [Question(s)] Servo Accuracy issues

07-13-2011, 07:35 AM
I'm new to this forum and to robotics .. so firstly .. hello.

I'm working on a plotter style project, which uses a pan and tilt arrangement rather than a traditional x-y mechanism. Everything is working well although I'm battling some servo accuracy issues and would like to seek the advice of those more experienced than me before I spend any more money.

I'm using Hitec 422 servos and the Phidgets 1061 board. The Phidgets spec say that the servo board has an accuracy of something like 0.007 of a degree .. which seems perfect. I'm running the servo's at about 5% of their max speed which seems to be a good compromise between speed and smooth movements. I'm commanding angles to a precision of 2 decimal points and in general the servos are finding the positions accurately.

My issue is that they're not traveling to these positions smoothly. I've done a lot of trouble shooting and got things as tight as I feel I can with my code, and I suspect that I'm going to need to gear everything down, but this means a redesign and buying more mechanical parts .. before I do this I'd like to know that this would be the correct route to take.

Here is a log of the servo movements :


this data is gathered on each Phidgets Advanced Servo Position Change event. I'm logging and plotting against absolute times to ensure that I'm not getting wonky lines due to uneven sampling. (As a side note this logging illuminated something I hadn't realised, that the Phidgets board was automatically flipping my velocity values based on the direction required.)

I would welcome any advice on whether I should bite the bullet and rebuild with gearing (and I'm assuming a restricted degree of movement due to gearing down 180deg servos). Or whether I should investigate another model of servo with much more accuracy.

Many thanks

07-15-2011, 06:02 AM

Sorry I guess I didn't make myself clear. In short is there a servo out there that has a higher resolution than the Hitec 422 .. and how is servo resolution generally measured and referred to ?

thanks !

07-15-2011, 10:18 AM
This post is increasingly unhelpful methinks...
...sorry about that...

From the Phidgets 1061 manual (http://www.phidgets.com/documentation/Phidgets/1061.pdf):

The PhidgetAdvancedServo does not know the current position of the motor on its own. If your motor is free to move, and is not being driven beyond the physical limitations of the motor, the position returned to your application will be very close to the position of the motor.This means the value returned by the board is where it THINKS the servo is located, and although it may be fairly accurate without any loading, it is not necessarily anywhere near its actual position. I also seriously doubt the potentiometer and assorted analog electronics on board the HS-422 (or just about any other hobby servo) could achieve anything near the 15-bit resolution of the PWM signal from the control board. Potentiometers with low tolerances in small packages are quite expensive (if even available), and relying on mechanical contact between the wiper and fixed contacts means that all potentiometers are subject to decreasing accuracy over their lives due to wear.

Even with the ability to directly poll the servos for their position and estimated speed, most dynamixel servos still rely on mechanical potentiometers and a 10-bit ADC. The only real exception is the new (and currently unavailable unless you are a beta tester or DARwIn-OP owner) MX-28 which uses a magnetic sensor to give a 12-bit position over 360 degrees of rotation (accuracy of ~0.09 degrees at best). It also has a user tunable PID controller, which may help improve movement/positioning accuracy compared to the P-controller of all other dynamixels and probably most hobby servos. But again, they are not currently available for sale and they would require you to buy a completely new control system (CM-5/510/700, ArbotiX, USB2Dynamixel, or anything else that has a 1Mbps half-duplex UART).

Another option is to use a stepper motor (especially with microstepping), but they still do not internally provide their location to the external controller (you would have to add a rotary encoder to the shaft). Of course, even without position sensing, they are still the most common actuator used in the RepRap community and many inkjet printers. However, as the angular resolution requirement for an arm is dependent upon the length of the arm segment (and is almost certainly greater than for the xyz axes of a cartesian plotter (RepRap, MakerBot, etc.)), gearing would likely be necessary.

Yet another option is to use a linear actuator, but position sensing can be difficult depending on the type.

A question about the plotter itself, is the arm a pan-tilt-tilt-tilt (http://youtu.be/qzoeuDoLrWg), a pan-tilt-tilt with parallel linkages (http://youtu.be/vGbqDfr4C6E), a pan-tilt with parallel linkages* (one linear actuator less than this (http://forums.trossenrobotics.com/gallery/showimage.php?i=389&c=7)), or a SCARA (http://en.wikipedia.org/wiki/SCARA_robot) (a pan-pan-Z?)?

*Something still seems very wrong about this setup. 2D positioning within a circle using only one rotary motor for pan and two sets of four parallel linkages attached to a scissor jack/linear actuator with its center rigidly mounted to the bracket connecting the two sets of linkages (see horrible ASCII art below). You could add a second linear actuator or continuous service solenoid to move the end effector up and down from the plotting surface.

/ |#| \
/ / ! \ \
/ /-<->-\ \
|/ / \ |
| / \|
|/ |
| *

The '|' on the left is the pan axis
The '-<->-' is the scissor jack/linear actuator
The '|' and '*' on the right is the plotter's end effector
The '|#|' is a bracket that maintains the parallelograms of the arms/linkages ('\' and '/')
The '!' is the horizontally rigid connection (can translate freely in vertical) between the scissor jack/linear actuator and the central linkage bracket.

07-15-2011, 10:43 AM
Hi Tician,

Many thanks for your response, this sheds a lot of light on the issues I'm facing.

My plotter I'm building uses a laser pointer mounted on a pan and tilt style setup to project up onto any surface, so I'm currently only plotting in 2D. As you can imagine this means that the increments in angles I'm dealing with are very small. I'm investigating various options, either gearing everything down, new motors or both. One possible issue I can see with gearing a servo down is that the plotting will become incredibly slow .. and any attempt to speed it up would negate the benefit of gearing (at higher speeds the servos become less accurate).

Thanks very much for your guidence, I'm new to this world and as everything costs money I want to ensure I fully understand each option before committing to gearing systems or micro steppers, rotary encoders and control boards.


07-15-2011, 07:36 PM
Each PWM of a RC servo is ~.007 in degrees.
180 total range/.07 per PWM ~= around 2600 PWM
The max possible PWM a servo can have. This varies and can be less or more from servo to servo.
If you tell the board move the servo to 1200. The servo will move to 1200 since it will fight to stay at the value. The cheaper the servo the glitchier they are. It trys to lock in on 1200PWM and will bounce back and forth.

With out knowing your code. When you command a 1500 on all your servos they should be dead center. This is where you find how if any offset need to be added.

To make your movement smoother use a simple form of interpolation.
EX: Servo one moves from 500 to 800. Total movement is 300 PWM.
Servo two moves from 1000 to 2000. Total movement is 1000 PWM.

Run a loop of 100 steps(this can be 10 - 1000) the higher the values the slower it will move. Exuction time of the board is your speed control/ramping.
Servo 1: Divide 300/100 each loop does 30 pwm(~2.1 degrees) and keep adding the values on to each other till dest reached
Servo 2: Divide 1000/100 each loop does 100 pwm(~7 degrees) and keep adding the values on to each other till dest reached

How the interpolation would work. Even though both servos have a different distance to travel they get there at the same time.

I wouldn't change the 422's there like the 645's and we use them in Hex's that have some really smooth IK programs.

Even thou you think its a 2d application. Its really a 3d. If you move your setup closer or farther away from the wall you values would always change.

07-16-2011, 05:11 AM
Hi Quantum,

Thanks for the tips, with the Phidgets board I command and angle rather than a PWM, but I'm assuming this amounts to the same thing .. the Phidget is just doing the conversion for me.

When I planned the project I did consider breaking each move down into samples .. but I'd assumed this would cause more 'steppyness' rather than reduce it. It's certainly an idea though .. I'll adapt my code to break a move into a number of steps rather than simply travel from point A to B and see what the effect is. The logical extension of this I guess is to code the rotations as a PID style function that follows the line, metering out servo power as and when required.

I'll try the interpolation idea and report back.