Problem with Digital Servo

Hi,
I'm trying to control a digital servo with arduino nano, but sometimes it stuck to certain angle or skip an angle from the code shown.
when i connect the ordinary tower pro servo (analog) it works fine.
I need help, i spent 4 days searching the internet with no luck.
I attached the code, digital servo sheet, serial monitor data.
Thanks,

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

void setup() {
  myservo.attach(6);  // attaches the servo on pin 9 to the servo object
  Serial.begin(9600);
}

void loop() {
  myservo.write(0);                  // sets the servo position according to the scaled value
  Serial.println("0");
  delay(2000);                           // waits for the servo to get there
  myservo.write(45);                  // sets the servo position according to the scaled value
  Serial.println("45");
  delay(2000);                           // waits for the servo to get there
  myservo.write(90);                  // sets the servo position according to the scaled value
  Serial.println("90");
  delay(2000);                           // waits for the servo to get there
}


How is the servo powered ?

Arduino via USB port
Servo powered from 5V and GND pins from arduino nano

Servos and other high current loads require an external power source.

A common ground between the Arduino and external power supply is needed.

How to connect external servo power.

Thank You

Thanks

Thank You All, it works fine, the problem came from the power source, it needed an external power source as you said.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.