Again: Servo Problem!

Hi!

I want to control three servo motors (TowerPro SG5010) with my arduino UNO. And sweep them with <servo.h> library.

first, I buy a (12v. - 2A.) adapter as external power. But it works only with one of the servos.

Then, I buy (12v. - 5A.) adapter. Again same problem. It doesn't work with two or three servos. Servos don't sweep correctly.

Can you help me please?!
:slight_smile:

Make a pencil drawing showing how you have everything connected and post a photo of the drawing.

Also post the code you are using.

As far as I can see those servos use the usual 4.8v to 6v power supply. Why are you using 12v?

I do hope you are not trying to power the servos from the Arduino 5v pin.

...R

Robin2:
Make a pencil drawing showing how you have everything connected and post a photo of the drawing.

Also post the code you are using.

As far as I can see those servos use the usual 4.8v to 6v power supply. Why are you using 12v?

I do hope you are not trying to power the servos from the Arduino 5v pin.

...R

Thanks.

I'm using the adapter for supplying the board, not the servos.

My code is like below:

Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
}

You hit the nail on the Head! I'm using 5v pin to power the servos. But why not?!

.

sweep_bb.png

Why not is because you are limited to the current in the regulator on the Arduino so if your external supply can give you 2A or 5A it does not matter because you can get less than 1A through the Arduino.
Next there needs to be decoupling between the motor's supply lines to cut down on interference from the motors.

Thanks.
I really appreciate your help.

Your servos should be powered separately from the Arduino and the Servo GND should be connected to the Arduino GND.

If you try to power a servo from the Arduino 5v pin you risk damaging the Arduino and, even if it is not damaged, it may cause the Arduino to reset thus preventing the code from working properly.

...R

Robin2:
Your servos should be powered separately from the Arduino and the Servo GND should be connected to the Arduino GND.

If you try to power a servo from the Arduino 5v pin you risk damaging the Arduino and, even if it is not damaged, it may cause the Arduino to reset thus preventing the code from working properly.

...R

OK, Thanks.

The external servo power setup idea in the attached pix.

servo-wire.jpg