Using 8 servo ctlr for pan and tilt

Hello,

I’m using the Pololu mode and absolute for controlling two servos for pan and tilt. For simplicity, I will describe my problem using just one axis.

When I move my joystick left, the servo turns left. When I let go the stick, the servo stays at its position. To make smooth rotations, I set the position to 5500 and when the stick is let go, I turn off the servo using cmd 0. When I move the stick to the left again to turn the servo a bit more, I first turn on the servo using cmd 0, set the speed using cmd 1, and then set the position to 5500 again. However, the servo move left at a much faster speed than my set speed, which is 0x10. Any suggestions? Thanks.

I’m a little confused by your description (specifically if the servo is already at 5500, the maximum position setting, how can it turn more left?) but I think I understand your problem.

In general, a servomotor has no real speed control. It only knows it’s current position and the position command it is getting from the servo controller. Even when you are not moving the servo, each servo is getting a position command from the servo controller 20 times each second.

If the servo is at the commanded position it holds itself there. If the servo is not at the commanded position, or gets a new position command, it always moves to the new position as fast as it can. If the servo gets no signal, it does not power the motor, and you can move it by hand.

The Pololu servo controller reduces the servo speed by sending several position commands. For example, if the servo is in position 500, and you send it to position 5500, but you have a slow speed set, the Pololu controller will actually send out several position commands over time (1000, 1500, 2000, 2500, 3000…) The servo is still moving as fast as it can between these positions, but the overall speed appears slow and smooth.

When you turn off the servo using CMD 0, you are only turning off the command signal to that servo. When you turn the servo on again, the Pololu controller has no way of knowing if the servo has been moved, and will send the same position signal. Since the servo has no real speed control, if it has moved while it was not getting a signal, it will move as fast as it can back to the commanded position.

Could this be your problem?

If you want to let the joystick go without moving the servo you will need to handle it in your program, and keep sending the servo a position.

I hope this helps.

-Adam

P.S. I assume you are using analog servo motors, which you can move by hand when they are not receiving a signal. Most (all?) digital servo motors will hold a position after they stop receiving a signal. If you use Hitec brand digital servo motors and a Hitec Digital Servo Programmer:

http://www.shopatron.com/product/product_id=RCD44410/110

you can program the servos themselves to turn more slowly. This is a much more expensive solution to your problem though (the programmer alone is $180).

nexisnet,

The information you provided regarding how servo works is excellent. My program is working like a charm now;) Thank you very much.

I do have a follow up question. How does the servo controller rotate the servo so smoothly at different speed while mine is choppy?

For instance, if I want to move from 500 to 5500 at slow speed in absolute, I would move at an increment of 50. If I want to rotate faster, then I would move at an increment of 300 or so, but it would still look choppy.

My reason for wanting to know is that if I tip my joystick slightly, I want to rotate slowly. If I tip further, the servo would rotate faster. Once I let go the joystick, the servo would stay at that position. However, if my increment gets too high, then when I let go of the joystick, the servo would stop a little bit afterwards.

Any suggestions? Thanks in advance.

Short Answer:
The smaller your increments, the smoother the servo motion will be, and the more accurate the end position, so the best way to move faster (but still more slowly than the servo’s top speed) is to send smaller increments more often. This may not be possible with your current hardware. You could make a more involved program that would change the increment size and servo-controller speed setting based on the rate of joystick motion.

Long Answer:
Hobby servos take position commands 20 times each second, so there is no point in sending position commands faster than that, but anything you can do to increase the frequency of your position commands would help. If your code has delays between the position commands you might try reducing those. To accommodate more frequent commands you may want to increase your serial baud-rate. If you are using a microcontroller you may be able to increase its operational speed in software, or by attaching a faster external clock.

In the most extreme case, you could program your own servo-controller using a microcontroller, preferably one with high-speed external resonator or oscillator (like the Pololu baby Orangutan) and use it to read the position of a joystick (you would probably want to hook up the potentiometers inside the joystick directly to the microcontroller). This would require tonnes of development on your part, and is probably not worth it.

-Adam

Hello.

Adam’s answers are all good except for one detail: the servo control pulses are generated at 50 Hz (20 ms period). When using speed control, the servo position is internally updated every 20 ms, which gives you smooth operation.

- Jan

Jan’s right. It’s been a while since I tried to do any direct servo control, and at some point I swapped the frequency and period of the control signal in my mind.

I blame the recent surge of inexpensive and straightforward serial servo controllers.

-Adam