Servos are incredibly useful in making "things" move. But in order to make that thing move you need to control it somehow. Luckily, arduino makes this incredibly easy to do and can be done with something as a potentiometer. The potentiometer turns and the servo can follow this rotation to it maximim bounds. I made this at TechShop and you can too.
Step 1: Materials
Servo (5volt, really any small size will work)
10k ohm potentiometer
Step 2: Circuit
This circuit is just about as easy as easy gets with an arduino powering it.
The servo has three wires, Vcc, ground, and data. Connect Vcc to power, ground to ground, and data to pin 3. The data pin is important because it needs to be a pin with PWM or pulse with modulation control. Not all arduino pins have this capability. On the uno they are marked by a " ~ ".
Connect the potentiometer to power and ground. Connect the third leg to analog pin 5. This creates a variable voltage divider for the arduino to read.
Step 3: Code
This is the code for the servo to follow the potentiometer
#define POT_PIN 5
#define SERVO_PIN 3
Servo myservo; // create servo object to control a servo
myservo.attach(SERVO_PIN); // attaches the servo on pin 9 to the servo object
val = analogRead(POT_PIN); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
Run that and Viola! You can now control a servo with a potentiometer.