Potentiometer + Servo = Problems

I'm trying to use a potentiometer (10K) to control 4 simple servos (Tower Pro SG90), using a battery pack (4 AA Batteries) to power the servos and the potentiometer, everything connected to the same GND.

I'm using an Arduino UNO, as show as the first picture:

(I don't know how to use fritzing, hehe)

My problem is that this circuit is not working at all. The potentiometer alone works fine, the servos without the potentiometer also work, but when I mix all together, nothing moves.

Any help ? I think the potentiometer is what is causing the problem.

Here is the code I'm using:

#include <Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

int pot1 = A0;

int valPot0;

void setup() {
servo1.attach(3);
servo1.attach(5);
servo1.attach(6);
servo1.attach(9);

}

void loop() {
valPot0 = analogRead(pot1);
valPot0 = map(valPot0, 0, 1023, 0, 180);
servo1.write(valPot0);
servo2.write(valPot0);
servo3.write(valPot0);
servo4.write(valPot0);
delay(15);

}

If the pot is turned all the way in one direction you will put 6V into the analog input, possibly damaging the analog input. Wire the pot across the Arduino 5V. Check that the A0 pin still works.

groundFungus:
If the pot is turned all the way in one direction you will put 6V into the analog input, possibly damaging the analog input. Wire the pot across the Arduino 5V. Check that the A0 pin still works.

Oops! I disconnected everything, checked the A0 pin and is still working (luckily).

I guess my real problem is that I don't know how to wire a potentiometer to an external power source. Any advice would be appreciated.

4xAA batteries can't provide enough power for 4 servos. One, for sure.

Forget Fritzing. Hand drawn diagrams are much better.

Hi,

I guess my real problem is that I don't know how to wire a potentiometer to an external power source. Any advice would be appreciated.

You don't have to, if your pot has three terminals.
One outside terminal goes to the UNO gnd, the other outside terminal goes to the UNO 5V pin.
The middle terminal goes to, in your case A0.
This will ensure you only get 5V max on the input.
Try your circuit with ONE servo only.

Tom.... :slight_smile: