Servo twitches heavily while DC motor is running

Thanks for the fast reply, Mark!

MarkT:
Firstly you need proper power supply for motors and servos. a 9V battery (PP3 size)
is inadequate for any motor or servo, just give up using them. Something like 4 or 5
AA rechargables with decent multi-amp output current is where to start.

Can you elaborate on this some more? From where I'm standing, the servo and motors are running just fine with a 9V battery power supply.

The jitter in the servo may be due to power rail noise, in which case a proper supply
will cure it.

If I understand you correctly, the twitching could occur from a noisy power supply; however, if this were the case, the servo would always be twitching. It's only doing so when a DC motor is running though, and the servo and motor have a different power supply, so this can't be it.

Or it could be RFI, interference from the high currents in the motor leads inducing
signals in the servo wiring.

This seems possible, but the servo signal wire is only close to the motor PWM wire going into the H-Bridge, so there are no "high" currents in there, right? Or am I wrong in assuming that the RFI can't carry over several cm?

Ensure you have a star-ground configuration and that high-current ground paths are outside the
Arduino board itself.

Isn't that a little overkill for 3 tiny motors?

Small motors can have a small ceramic capacitor soldered
direct to the terminals to quench brush-arc noise, something like 0.1uF, which can
reduce RFI (especially true on small cheap motors with metal brushes).

I don't have any capacitors, so I can't try this. :frowning: