Arduino with servo and gear motor

 hi friends, i am new user of arduino. plz tell me how i program three servo. can i directly connect servos to arduino board to operate it. Is voltage regulator and capacitor required for it, if it is, then what's the value of regulator and capacitors. also provide information (with diagram) how to connect three servos to arduino uno.
there is one question, i want to use two geared motor to arduino. how can i control the speed of motors individually. is any motor drive circuit is required. how can i design this circuit. plz provide all parts details and conection details.

Perhaps a Robot Builder’s

Perhaps a Robot Builder’s Shield can help you. You can control up to 6 servos, 2 DC motors, read up to 6 analog sensors plus 2 more pins available for external interrupt sensors like encoders. Plug in a 6V battery and the jumper will transfer power to the Arduino. Eazy. You can use the prototyping area for experimenting with other stuff.

You can drive a few servos

You can drive a few servos directly from an Arduino, as long as you don’t overload the total current the board can provide, or the current for each output pin. If you try to run too much stuff directly from the Arduino, you’ll blow something.

To run motors, and have speed and direction control over each, you need a separate motor driver circuit. You may see these referred to as h-bridge circuits. An h-bridge allows you to use two output pins of your Arduino to control one motor in each direction. A second h-bridge and two Arduino outputs are needed to control a second motor. You can often find a motor driver that is a dual h-bridge, able to control two motors.  You can use Pulse Width Modulation (PWM) to control the speed of your motors.

There are examples on the Arduino site, on LMR, and all over the 'Net. So take a look around.

Complete boards like the one Ro-Bot-X suggest make it easy to get started!

Motor control

For speed control use PWM and since motors are an induced load you will need a small transitor circit look at this youtube vid-

http://www.youtube.com/watch?v=cEz1i5xzGEE&feature=channel_video_title

 

heres some sample PWM code (this can also Reverse the motors)-

 

//2-Way motor control

int motorPin1 = 5; // One motor wire connected to digital pin 5
int motorPin2 = 6; // One motor wire connected to digital pin 6

// The setup() method runs once, when the sketch starts

void setup() {
  // initialize the digital pins as an output:
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
  rotateLeft(150, 500);
  rotateRight(50, 1000);
  rotateRight(150, 1000);
  rotateRight(200, 1000);
  rotateLeft(255, 500);
  rotateRight(10, 1500);
}

void rotateLeft(int speedOfRotate, int length){
  analogWrite(motorPin1, speedOfRotate); //rotates motor
  digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
  delay(length); //waits
  digitalWrite(motorPin1, LOW); // set the Pin motorPin1 LOW
}

void rotateRight(int speedOfRotate, int length){
  analogWrite(motorPin2, speedOfRotate); //rotates motor
  digitalWrite(motorPin1, LOW); // set the Pin motorPin1 LOW
  delay(length); //waits
  digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
}

void rotateLeftFull(int length){
  digitalWrite(motorPin1, HIGH); //rotates motor
  digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
  delay(length); //waits
  digitalWrite(motorPin1, LOW); // set the Pin motorPin1 LOW
}

void rotateRightFull(int length){
  digitalWrite(motorPin2, HIGH); //rotates motor
  digitalWrite(motorPin1, LOW); // set the Pin motorPin1 LOW
  delay(length); //waits
  digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
}

this is very helpful

this is very helpful information for me. i thanx to all my friends.

could u elaborate this line i am little bit confusing,

rotateLeft(150, 500);

rotateLeft, rotateRight,

rotateLeft, rotateRight, rotateLeftFull, and rotateRightFull are all functions defined within the program. In the code you quote above, the numbers in between the parentheses are passed to the function rotateLeft. The 500 is a duration. The 150 is the number fed to analogWrite (a built in Arduino function), which will send pulses to the motor so that it is on-off-on part of the time. This is PWM.