user19196: We are trying to control a robotic arm using the Tower Pro MG 996R 180° high torque servo.
Firstly we tried to power the servo from Arduino's default 5V, but it didn't work, then we power it from an external source, the servo ran, but only in one direction. Then it stopped rotating. We used the sweep code from the Arduino examples to test the motor.
Here's the code:
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

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 >= 0; 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
  }
}

Can anyone please specify what are we doing wrong, and what is the right way to do it.

user19152: The Arduino's 5V is hardly enough for driving servos. I found that even a simple 9g micro servo draws well over 1A spikes, which causes the board to reset itself.

Power the servo from an external battery pack (e.g. 3xAA or 4xAA batteries will do);
Ensure that the GND of the battery pack is connected to the GND of the servo as well as to the GND of the Arduino;
So you'll have two wires between the Arduino and the motor: GND and the driving signal.

It has to work, servos are pretty standard stuff. However there are many complaints against this particular type at this link Towerpro MG996R 10kg Servo 10kg / 0.20sec / 55g. 

user32971: Si no me equivoco tiene 64 pasos. El servo no deberia ir de grado en grado sino por c/u de los 64 pasos. 180 grado / 6r es 3 grados x cada cambio de paso step to step. ?
Atte.
If I'm not mistaken in 64 steps. The servo should not go from grade to grade but by c / u of the 64 steps. 180 degree / 6r is 3 degrees x each step change step to step. ? Atte.

19196: <p>We are trying to control a robotic arm using the <em>Tower Pro MG 996R 180°</em> high torque servo.</p>

<p>Firstly we tried to power the servo from Arduino's default 5V, but it didn't work, then we power it from an external source, the servo ran, but only in one direction. Then it stopped rotating. We used the sweep code from the Arduino examples to test the motor.</p>

<p>Here's the code:</p>

<pre class="lang-c prettyprint-override"><code>#include &lt;Servo.h&gt;

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

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 &lt;= 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 &gt;= 0; 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
  }
}
</code></pre>

<p>Can anyone please specify what are we doing wrong, and what is the right way to do it.</p>
 19152: <p>The Arduino's 5V is hardly enough for driving servos. I found that even a simple 9g micro servo draws well over 1A spikes, which causes the board to reset itself.</p>

<ul>
<li>Power the servo from an external battery pack (e.g. 3xAA or 4xAA batteries will do);</li>
<li>Ensure that the GND of the battery pack is connected to the GND of the servo <em>as well as</em> to the GND of the Arduino;</li>
<li>So you'll have two wires between the Arduino and the motor: GND and the driving signal.</li>
</ul>

<p>It has to work, servos are pretty standard stuff. <em>However</em> there are many complaints against this particular type at this link <a href="http://www.hobbyking.com/hobbyking/store/__6221__Towerpro_MG996R_10kg_Servo_10kg_0_20sec_55g.html" rel="nofollow">Towerpro MG996R 10kg Servo 10kg / 0.20sec / 55g</a>. </p>
 32971: <p>Si no me equivoco tiene 64 pasos. El servo no deberia ir de grado en grado sino por c/u de los 64 pasos. 180 grado / 6r es 3 grados x cada cambio de paso step to step. ?
Atte.</p>

<p>If I'm not mistaken in 64 steps. The servo should not go from grade to grade but by c / u of the 64 steps. 180 degree / 6r is 3 degrees x each step change step to step. ? Atte.</p>
