iImage Information

In this instructable, I am going to show you what a servo motor is, how to use it, and ideas for starting projects using it. I used arduino to control my servo, I added how to use a 555 in some of the later steps.
Step 1What is a Servo motor
If you are like me, then you knew very little about servo motors, and how to use them, so we should start from the beginning. A Servo motor uses pulse width modulation (pwm) from a microcontroller or a 555 timing IC (or something different I haven't heard about) to know what position to move its horn to. They can move both clockwise or counterclockwise thanks to an H bridge which is hardwired into them. Most Servos, unlike conventional electric motors do not move in continuous rotations. the standard servo moves anywhere between 0 and 180 degrees, which make them useful for animatronics and robotics. The servo has three wires coming out of it which usually ends in a female jack. the wire colors are black, which gets connected to ground, red which gets connected to the positive power supply, and white or yellow which gets connected to the output of the microcontroller or 555 IC, and receives the pwm. Okay now that you know the basics, lets get started
RATAN BANGLADESH.....
Servo myservo1;
Servo myservo2;
Servo myservo3;
you would also need more potentiometers, so youd need to add more potpins, and have the potentiometers hooked up to their respective pins, I think that would look like this:
int potpin1 = 0;
int potpin2 = 1;
int potpin3 = 2;
where potpin1 is what we are calling analog pin 0, but will control myservo1. You also need more variables to store the data from the potpins, so make those too.
int val1;
int val2;
int val3;
the numbers will correspond with the servos of the same number.
now you just need to add the commands for checking all 3 servos into the loop, which would look like this:
void loop()
{
val1 = analogRead(potpin1); // reads the value of potentiometer 1
val1 = map(val1, 0, 1023, 0, 179); // scale it
myservo1.write(val1); // sets servo 1's position according to the scaled value
val2 = analogRead(potpin2); // reads the value of potentiometer 2
val2 = map(val2, 0, 1023, 0, 179); // scale it
myservo2.write(val2); // sets servo 2's position according to the scaled value
val3 = analogRead(potpin3); // reads the value of potentiometer 3
val3 = map(val3, 0, 1023, 0, 179); // scale it
myservo3.write(val3); // sets servo 3's position according to the scaled value
delay(15); // delays for 15ms to let the servos catch up
}
I think this would work, but someone check over my work because I'm a complete noob at arduino coding. Someone with an arduino and 3 servos should write this and see if it works :p
void setup() {
myservo1.attach(9); //attach servo 1 to pin 9
myservo2.attach(10); //attach servo 2 to pin 10
myservo3.attach(11); //attach servo 3 to pin 11
}
etc.