Problem with running a Servo With Arduino Pro mini

Hi all,

I am using a Arduino pro mini connected to computer via USB cable (with six pin header at other end to connect pro mini) to run servo motor..... but the servo motor goes to angle 0 and jiggles at that position .... i just tried to run servo sweep in examples......
note: blink led in examples in running fine with this.....

i am struggling to find out what is wrong in it ? .... can anyone suggests possible solutions to this??

Thanks in advance

The most common issues with servos are 1) trying to power a servo from the arduino power supply, 2) the servo and arduino grounds are not connected, and 3) everything else such as bad code.

hi zoomkat,

common Ground problem ...... thanks i solved that ..... but the servo sweep example i am running have a problem again.... it rotates upto 100 or 110 deg and comes back to zero in a loop....but actually it should go upto 180 deg.... is this means that Pro mini (3.3v, 8Mhz) is unable to provide high PWM signals for rotating higher degrees?????.... what should i do

Thanks

The Servo library doesn't provide PWM signals, it provides PPM signals.
It may be that your servo is incapable of rotating 180 degrees - the 0..180 convention of the Sero library bears no relation to how far the servo can actually turn.
Or your software may be incorrect (hint).

Simple servo test code you can try to see if the servo moves as expected.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// 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(2000); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22-dual-input"); // 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 
    int n = readString.toInt();

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}

Thanks to all,

Servo fault i think mistake was mine and i now running a new servo......now the servo works fine ....

Thanks again