Problem with servo jittering when more than one servo is connected

Hi all,

I'm working with an Arduino Mega ADK (ATmega2560) in my robotics project.

The setup is as follows:
There is a single 11.1V (3S1P LIPO) power source. The Arduino Mega is directly connected to the power source through its Vin/Ground connectors. There is also an ESC connected to this power source which provides power to an RC model receiver. There are two servos connected to this RC model receiver. The control cable of each servo is split and also connected to a PWM port of the Arduino Mega. Once the Arduino Mega is activated it attaches the servos through the Arduino Servo library and takes control of them. Once it is turned off again, the servos are controlled through the RC radio, as normal.

This works fine as long as there is only a single servo control cable physically attached to the Arduino Mega. I can steer this servo perfectly through the Arduino Mega, without any problems, no jittering at all. However, as soon as I connect the control cable of the second (!) servo to the Arduino Mega (and "attach" it through the servo library) both servos start jittering. During the jittering they are still perfectly controllable by the Arduino Mega, they just constantly jitter a bit.

Is this a common problem? Do I need to change anything in my wiring? There is a common ground in the whole platform, so that should be ok, or? Is this a problem of me simply splitting the servo control cable?

Many thanks for any hints.

All the best,
Michael

If the signal line of the servo is connected to both the Arduino and the Radio, how do you keep the Radio from trying to control the servo while the Arduino is controlling it?

Hi John,

this appears to be a non-problem. As soon as I attach the servo to the arduino (by calling the attach command of the Servo library), all signals from the radio are ignored. As soon as I detach it again, I can again steer it through the radio. Attaching the servo to the arduino seems to automatically override the radio signal.

As I said, this works perfectly for one servo without any jitter. Only when I connect a second servo the jitter appears. Do you think that the reason for the jitter might be connected to this?

Many thanks and all the best,
Michael

Hi,
Its basically a bad idea to have two signals competing to control each servo - if thats what your doing ?

Why not just have a mode switch on the Arduino, so that its either acting as a straight pass through or its operating in another mode ?

I do this all the time, perhaps the simplest example being ‘child mode’

Duane B

rcarduino.blogspot.com

Hi Duane,

this is exactly what I am doing. Do you think that this could be the reason for the jitter if I have more than one servo connected in this way?

I will check out your link right now. Many thanks.

Many thanks and all the best,
Michael

daneelgiskard:
this is exactly what I am doing.

It may be what you're doing, but your description gives the impression that you're doing something completely different.

If you have the receiver and Arduino both trying to drive the same servo then the output circuits will be fighting against each other. Maybe the Arduino wins consistently, but that doesn't mean it's a sensible thing to do.

Better to have the receiver signal fed into one pin of the Arduino, processed as necessary by your sketch and then a (possibly modified) control signal output on a different pin to control the servo.

Hi Peter,

thanks for the reply.

I thought that by writing "The control cable of each servo is split and also connected to a PWM port of the Arduino Mega." I made clear what my setup looks like. Seems that I did not. Sorry for that, English is not my mother tongue.

I will try the other approach as described by you and Duane in order to see if that resolves the problem.

Many thanks and all the best,
Michael

As soon as I attach the servo to the arduino (by calling the attach command of the Servo library), all signals from the radio are ignored. As soon as I detach it again, I can again steer it through the radio. Attaching the servo to the arduino seems to automatically override the radio signal.
......
I thought that by writing "The control cable of each servo is split and also connected to a PWM port of the Arduino Mega." I made clear what my setup looks like. Seems that I did not.

As the other guys say, that really doesn't make it clear as to "exactly" how you have it
connected. From your words, I assume the control signals from rcvr and Arduino are
bucking each other, and which would certainly explain jitter.

In the first comment, "all signals from the radio are ignored", there is nothing in your
comments to explain why this should be so.

I think there might be an easy solution. You can have both rcvr and Arduino control signals
going to the servo, but wire a 1K or 2.2K resistor in series in the signal from the rcvr.
When the Arduino servo object is disabled, make sure the pin is set = input, and the rcvr
signal is unimpeded. When the servo object is enabled, the low-impedance output of the
Arduino pin will take precedence over the rcvr signal.

Hi all,

many thanks for your replies. Sorry for not being perfectly clear, but I try my best.

I do not know why the RC receiver signal is ignored. Both the RC receiver and the Arduino share a connection with the servo - I have simply split the servo control cable (the orange, sometimes white, one). I do not know how the arduino overrides the signal from the RC receiver. I can only observe that once I connect the servo to the arduino (through the "attach" function of the library), the arduino has full control.

I think both suggested improvements, i.e.,

  1. Always routing the receiver signals through the arduino, simply duplicating them when no control is neccessary and
  2. Your idea with the resistors
    are a much more clean approach and I hope that this will help me to remove the servo jittering.

Many thanks and all the best,
Michael