Twitchy servos (on a separate power supply)

Hi,

I've been pulling my remaining hairs out for a while now, and I can't figure this out.

Here is a video of the issue (at the very end): https://drive.google.com/file/d/0B0LPDy0y3KwZTUpoSkpDNjdydFk/view?usp=sharing

I'm pulling data (pitch and roll) via serial out of a Razor IMU, feeding that into a mega2560 in order to control 2 servos that will compensate for the pitch/roll of the IMU that would be attached to the chassis. My circuit currently looks like this:

1k uF cap on the source (5.25v @ 300 mA) 10k resisters on the control lines for each servo which helped the twitching a little, but its still quite bad.

Looks like what you would expect.

I think it is "twitchy" because the data driving the servos is "twitchy". Have you tried a serial print to see how steady it is? You might want to average it before sending it to the servos.

I have tried that. The data is solid. When the IMU is lying down on the table, the numbers are being sent out of it are not changing, yet there is twitching in the servos.

I tried powering the servos from the arduino directly (with a separate cap before each servo), and the behavior is the same. If it stops moving in a "good position", the twitching goes away, but as soon as disturb it a little by moving the IMU, and then leave it alone again, it will start twitching again. :~

What's even more bizarre, is if I power the Arduino with a PSU, 80% of the time, the servos twitch so bad, that they do not even accept the commands to move at all and just have a seizure until I reconnect power a few times, after which point it will resume normal/twitchy operation when it does respond to control commands.

the source (5.25v @ 300 mA)

That is probably an inadequate power supply for servos unless they are very small.

Says 4.8-6v on them (https://www.sparkfun.com/products/11884).

I tried a 5.5v @ 1A psu, and I got more odd behavior. They just went to the maximum angle, and locked up immediately after power was supplied, and didn't react to any controls after that.

yegor: Says 4.8-6v on them (https://www.sparkfun.com/products/11884).

I tried a 5.5v @ 1A psu, and I got more odd behavior. They just went to the maximum angle, and locked up immediately after power was supplied, and didn't react to any controls after that.

Then you did something wrong like forgetting to connect the ground of the power supply to the ground of the Arduino. Changing the power supply alone will not make it behave like you saw.

Straining servos usually require 1 ampere or more each, so your servo power supply should be rated for at least 2 amperes. Even if the servos are not straining, the motors will briefly draw the stall current each time they start up. Do not forget to connect the grounds together!

Grumpy_Mike:

yegor: Says 4.8-6v on them (https://www.sparkfun.com/products/11884).

I tried a 5.5v @ 1A psu, and I got more odd behavior. They just went to the maximum angle, and locked up immediately after power was supplied, and didn't react to any controls after that.

Then you did something wrong like forgetting to connect the ground of the power supply to the ground of the Arduino. Changing the power supply alone will not make it behave like you saw.

All I did was swap the leads on the vcc and ground rails on the breadboard (bottom left of the picture). They are on a separate circuit from the arduino board. This is a separate issue however.

jremington: Straining servos usually require 1 ampere or more each, so your servo power supply should be rated for at least 2 amperes. Even if the servos are not straining, the motors will briefly draw the stall current each time they start up. Do not forget to connect the grounds together!

I will try that, but the previous behavior is just strange. 300 mA supply works, but twitches hard. 1A simply locks up the servos at max angle and is essentially useless. :~

What do you mean by connecting the grounds together? The ground of the arduino and ground of the psu that is only feeding the servos? Why would that be necessary?

What do you mean by connecting the grounds together? The ground of the arduino and ground of the psu that is only feeding the servos? Why would that be necessary?

Without the grounds not connected, the current flow from the arduino control signal has no appropriate flow path back to the arduino.

This is a separate issue however.

No it is not. I told you about connecting the grounds as well, it looks like you have not done this.

What do you mean by connecting the grounds together? The ground of the arduino and ground of the psu that is only feeding the servos? Why would that be necessary?

Here is why:- http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

The basic servo power setup.

servo-wire.jpg