Can't get servo to work

Hi Guys!

At first: The Arduino is awesome. I just love it! I got mine yesterday. I bought a servo too, it's a SpringRC SM-S430R.

I Can't get it to work.

I saw a topic here in this forum, but I can't find it anymore.
Well - The Servo stops at 1500. 0-1500 is CCW, 1500+ is CW.

I found this script in the post:

#include <Servo.h>

Servo myservo;

void setup()
{
  myservo.attach(9); //set up the servo as usual
  Serial.begin(9600); //for watching the speeds in the serial monitor
}

void loop() {

// on this servo 1500 is stopped, above 1500 is clockwise, below is counter clockwise

     for (int i=1500; i >= 1300; i=i-20) //start from a stop and slowly increase to get the motor turning
     {
      myservo.writeMicroseconds(i);
        Serial.print("Running motor at: ");
        Serial.println(i, DEC);
      delay(5000);
   }
  
       for (int i=1300; i <= 1500; i=i+50)
     {
      myservo.writeMicroseconds(i);
        Serial.print("Running motor at: ");
        Serial.println(i, DEC);
      delay(5000);
   }
  
   delay(5000); //wait for five seconds and then spin it the other way, counting up again.
  
    for (int i=1500; i <= 1700; i=i+20)
     {
      myservo.writeMicroseconds(i);
        Serial.print("Running motor at: ");
        Serial.println(i, DEC);
      delay(5000);
   }

}

But when I connect my servo and upload this script to my Arduino Uno (rev3), I just hear a buzzing noise coming from the Servo.
I made some adjustments yesterday, I changed some values - then the servo worked fine. But today, I can't remember these adjustments, and it doesn't matter what I do (changing the power Value from 1500 to 3000 for an example), the servo just doesn't move and its just this annoying buzzing noise. As I said, the servo worked fine yesterday.

Any suggestions?

Im very confused.

Thanks :slight_smile:

How are you powering your servo?

the servo is connected to 5V, GND and Pin 9.

I just plugged three Jumper Wires into the female connector.

Generally trying to power a servo from an arduino is not a good idea. Below is some servo test code.

// zoomkat 10-14-11 serial servo test
// use a microseconds value like 1500 in serial monitor
// for IDE 0022 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  // allow buffer to fill with next character
    }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    myservo.writeMicroseconds(readString.toInt()); //convert readString to number for servo
    readString=""; //empty for next input
  } 
}

is the servo vibrating which is the cause of the buzzing noise???

Thank you Zoomkat, I will give it a try.

@kirti:

Yes, the Servo buzzes because the motor works or is powered, but the power level is too low, allthough I changed the power values.