Servo moving accidentally


I am trying to setup a pan/tilt servo motor setup; controlled by a mock model consisting of potentiometers.

Everything is good except one problem; when I move the base potentiometer both servos move; instead of the base only.

Here is my code:

#include <Servo.h>

#define BASE_SERVO_PIN 2
#define BASE_POT_PIN A6

Servo base_servo;
Servo shoulder_servo;

void setup() {



void loop() {
  base_servo.write(map(analogRead(BASE_POT_PIN), 0 , 1023, 180, 0));
  shoulder_servo.write(map(analogRead(SHOULDER_POT_PIN), 0, 1023, 0, 180));

It could be the usual thing. Most (all?) Arduinos have a single ADC. It's common for a reading from one pin to be impacted by the previous one.

The simple remedy is to read twice and throw the first one away.

I tried using various pins; including different ports yet the issue persists.

Plus if I connect another potentiometer to to control the shoulder servo the shoulder servo just freezes and jitters.

Listen to @ wildbill.
This is a frequent issue/question.

And the other common cause of unwanted movements is insufficient trying to power servos from the Arduino instead of giving them separate power.


Servos require a separate power supply. Budget 1 Ampere per servo for small servos, 3 A/servo for large ones. Don't forget to connect the grounds.

After reading twice and throwing away the first one; the base servo moves independently but the shoulder servo only jitters and freezes when I move it's corresponding potentiometer.

What Arduino? What type of servos? What power supplies?

Please provide a schematic showing all connections including how everything is powered and your latest code which must have quite a few changes.


On the ATmega processors this is never an issue if the pots are 20k or less in value.

Sometimes there are issues with poor layout of the wiring to the pots - the 5V and GND
connections to the pots should not share any wiring with high current paths, this will put
unwanted signals onto the pots. Basically run the pot wiring as a separate harness from any
power or motor/servo wiring.