High precision servo control.

Hi,

I’ve got a servo/robotics project that currently suffers from a lack of repeatability and precision. At the moment the project uses a 555 timer circuit and a potentiometer to move the servos. I think the lack of accuracy comes from a lack of precision in the potentiometer (despite what it may say in the catalogue)

What I want to achieve is to be able to reliably move my input device (rotary pot, linear pot or anything else) to a pre-determined position and be confident that the servo itself will move to exactly the same position that it moved to before.

I’m planning to use an arduino to generate the PWM (pulse width modulated) signal that controls the servo. Assuming that the arduino can accurately control the servo, I still need to accurately control the arduino itself. If I try to use a pot, then I’m still likely to have similar problems with a lack of accuracy. I’ve looked at various rotary encoders, but from what I can tell they generate pulses when the knob gets turned, so you can’t actually get an accurate position when it’s not moving, also, I understand that if the encoder gets turned too quickly then pulses can get missed.

In an ideal world I’d like to be able control the servos with a mini-joystick like this one Thumb Joystick - COM-09032 - SparkFun Electronics? but having played with this on other projects I know that it also suffers a lack of precision.

To summarize my question, what’s the best (smallest and lightest) way to accurately control a couple of servos using an arduino?

Thanks

Well there are two issues you are dealing with, resolution and repeatablity of the servo output command from the arduino and resolution and repeatablity of the arduino analog input ADC converter and any kind of pot you might be using to generate the analog voltage.

As far as the first part I would state that using the arduino standard servo library functions and using the servo.writeMicroseconds() command gives you a more resolution then most servos are capable of, but check your servo datasheet if you are in doubt. Servo - Arduino Reference

The Arduino analog input pin is a 10 bit ADC conversion, so that gives one 1024 steps of resolution, so that is a close match to the output resolution of the servo library. So that leaves us with the pot to deal with. That SparkFun 'joy stick' pot is pretty much garbage as far as resolution and repeatability goes, it just is not a precision device, the one I played with had really poor 'return to center' properties so it would be the limiting device in your servo control loop. There are 20 turn precision pots that would work well if that would work as a user input device.

http://www.google.com/search?q=20+turn+potentiometer&hl=en&tbo=d&source=lnms&tbm=isch&sa=X&ei=DWCBUNz8CpLa8AS-t4DADA&ved=0CAQQ_AUoAA&biw=1024&bih=804

Lefty

1 Like

BigusDickus:
Hi,

I’ve got a servo/robotics project that currently suffers from a lack of repeatability and precision. At the moment the project uses a 555 timer circuit and a potentiometer to move the servos. I think the lack of accuracy comes from a lack of precision in the potentiometer (despite what it may say in the catalogue)

What I want to achieve is to be able to reliably move my input device (rotary pot, linear pot or anything else) to a pre-determined position and be confident that the servo itself will move to exactly the same position that it moved to before.

How many positions do you need to support? Will they be fixed for all time, or do you need some way to adjust them?

I don't know what you're trying to do with the original solution, but I suspect you may not have been setting the pot to the same physical position every time - that would cause the servo position to be off by a corresponding amount. If you're trying to set the servo to specific fixed position, you may find it's more repeatable if you replace the pot with something like a rotary switch, and use preset resistors to define the servo position corresponding to each switch position.

You don't really mention the end result of what you want to do, so suggestions are limited. You might want to look into using a simple servo tester like below (note that some servo testers only move the servo +-45 deg). Also standard servos have an ~5us deadband built in to reduce hunting and when straining under load the servo may be at a position slightly different than what is commanded. I tested a standard servo and was able to get ~425 discrete movements in its ~190 deg rotation range. Also, there is usually a bit of mechanical slop and flex in the inexpensive servo when operated under load.

http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=14774

What about a hall sensor pot? I don't know where to find them but I'm sure they're on ebay. They use a hall sensor and magnets and are more accurate than standard pots.

Thanks for the responses....

You don't really mention the end result of what you want to do, so suggestions are limited

The end result is to provide smooth control for a HPA (human powered aircraft)....

I'd like to achieve a resolution/repeatability of about 90 discrete positions in a 180 degree sweep of a servo arm (i.e. a repeatable accuracy of about 2 degrees). My experiments so far indicate that an arduino can easily control a servo to this level, the problem is finding a human input device that allows me to control the arduino equally accurately.

At the moment I recon I'm lucky if I can manage an accuracy of 10 degrees.

There are 20 turn precision pots

Yes, I've actually played with some of these in my earlier experiments and they do produce the desired results, but a 20 turn pot can't easily be incorporated into a aircraft style control column (not that you knew what I wanted to do with it on my first post)!

I believe the problem stems from the fact that most joysticks use a carbon track pot that only sweeps through only a few degrees, making repeat-ability very hard to achieve.

That SparkFun 'joy stick' pot is pretty much garbage as far as resolution and repeatability goes

I know, at least I they're cheap and I didn't waste too much money finding out how bad they are!

Ideally I'd like a lightweight, high accuracy joystick. unfortunately many of the easily obtainable joysticks just use on/off microswitches to crudely detect position, the high accuracy joysticks (from electric wheelchairs and industrial diggers) cost a fortune, so I'm really just left with making something - hence the reason for this post.

Thanks

Silly suggestion maybe, but what about PC flight simulator joysticks ?

Duane B

rcarduino.blogspot.com

Aurora 9 joysticks are available and quite reasonably priced. The usual difficulty with joysticks like these is they only swing about 1/5 of the total pot travel. To get a full ADC count, you may need to use an external analog reference.

Jon

what about PC flight simulator joysticks ?

I have tried these, but the performance you get from them isn't always good enough.

Another issue here is weight, the target weight for a HPA is normally less than 35kg, so a 250gram (or more) joystick is significant.

What I'll probably end up doing is using an old joystick and stripping all the redundant switches and plastic housing off it to reduce the weight.

Thanks

The problem seems to be finding a type of control that a human can position accurately to one of ninety discrete settings. I suppose you could use a rotary pot with detents (notches) so that it clicked into each discrete position, that would rely on the pilot counting the notches or having a dial to indicate the current position. If you can provide any sort of feedback (digital display of the actuator position?) then you could just use a rotary encoder to move the actuator in steps and not have to worry about the absolute position of the control.

I agree that the human part will be a limiting precision positioning issue. Back in the day the aircraft trim tabs were tweeked using a round device (like the edge of a jar lid) that was rotated to adjust the trim trim tabs. I had an issue of being able to finely adjust the pot in a continous rotation servo using a small screwdriver. To do the job better I made a screwdriver from a round tooth pick and a wide plastic jar lid (below). You might consider using a multi turn pot with a large wide jar lid type of knob so that the hand can more easily make very small changes in pot position.

What about using push button switches, one for up and one for down? I'm sure you could easily come up with an algorithm that scrolls up quickly if you hold the button, debounce it all and use seven segment displays (two) to show the position between 0 and 90.
You could also just use a pot and seven segment displays so that it can be adjusted and you can see where it is within 90.

What about using push button switches, one for up and one for down?

I had thought of that, but on a aircraft control system you normally want something that will return to the neutral position if you let you go. Also, a pilot wants a control system that provided a visual indication of where the controls are, if you pull back on a joystick you can see (and feel) the position you are in, if you have a push button system you can't!

Look around for a second hand model aircraft transmitter, something from Futaba, JR, Hi-Tec etc. will have fairly good gimbal joysticks you can remove.
Also with the servo, the cheapy ones are ropey at best, a servo from Savox, or other quality brand will be far more accurate.

The typical servos we have are highly imprecise mechanically.

If you have to have precision control, mount an encoder on them and use that as feedback to your servo controller. A 1000-line optical encoder can be had fairly inexpensively.

I actually have a pair of (cheap chinese) two way gimbals lying around, for 4 total channels, one of the channels has a ratchet on it, they are from a cheap chinese (computer) radio.
Pay for the shipping and they're yours.

Thanks for everyones suggestions, I've actually found myself a workable solution.

I've taken a cheap joystick, and load the input values from it into an array from which I take an average value which can be used to drive the servos,

Secondly I limit the values the servos can be set to 3 degree intervals, these two techniques combined seem to produce a acceptable (but not ideal) solution.

Cheers