Problems with my HXT HX5010 servo.

Hi,to whoever is reading this.I recently purchased a HXT HX5010 servo :http://www.hobbyking.com/UNITEDHOBBIES/store/uh_viewItem.asp?idProduct=22930
and i'm facing quite a few problems with it .I've never used a servo before so i really don't know how to trouble shoot it .
first is that when i try the "sweep" program from the arduino examples,once it has reached 180 degrees,it  tries to go past the gear stopper and it takes it a few seconds to "realize" that it i sat 180 degrees and then only comes back to 0 degrees .
the sweep program is: 
#include <Servo.h>

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
  }
}

According to the program ,as soon as the servo reaches 180 degrees it is supposed to go back to 0 degrees however my servo first tries to go past the gear stopper and then only comes back to 0 degree.I am powering the servo with the 5v pin on the arduino.Should i use a external power supply for my arduino?I don't understand what the problem is .Please help me!

AndyGadget4 years ago

I'm no expert on the Arduino, but looking at the servo library which is the one I assume you're using I see the default minimum and maximum endpoints (MinimumPulse and MaximumPulse) are 544us and 2400us.  This may be beyond the endstops of some servos - Safe values for just about any servo are 750 to 2250us.  Try adjusting to those values.

Also, if the 5V you mention is from the logic supply then it may not be up to the task as servos take short pulses of high current.  It may be OK off load but for a loaded 39g servo I'd suggest powering it straight from a separate supply of up to 6V rather than through the Arduino regulator. (The 0V wire would still be connected to the Arduino 0V.)  However, check the power supply recommendations on the Arduino board you're using.  

Don't reverse the power leads of the servo - That would most likely kill it.

Correct link : http://playground.arduino.cc/ComponentLib/servo
So the servo is trying to turn in the wrong direction? If so then reverse the power leads of the servo.