SparkFun Forums 

Where electronics enthusiasts find answers.

General suggestions or questions about the SparkFun Electronics website
By signal7
#76311
Can you post the code you're using with an explanation of how you have everything hooked up?

Servo's don't rotate 360 degrees. Usually they are fed a pulse width modulated signal which tells them what position they should be in. Changing the pulse width will change the position of the servo head.
By SkyRider
#76382
I used the Servo library example Sweep Code
Code: Select all
// Sweep
// by BARRAGAN <http://barraganstudio.com> 

#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 
  } 
} 
I connected the White Pin to the 9 pin in the board, and Red pin to the +5 on the board, and black to the ground
By signal7
#76394
I'm not sure if the arduino can supply enough power to run a servo directly. Are you using a motor shield of some sort? Did you recieve any specs with the motor? The product page for the servos don't have any data regarding the motor's power requirements.
By n1ist
#76397
The PWM pin doesn't power the servo; it just controls it.
By SkyRider
#76411
I tried connecting the Power and Ground externally to the battery and then connecting the signal to the Arduino Board. But it doesn't work that way either.
By signal7
#76583
If it's not a power related issue, I would guess that the servo isn't getting a changing PWM signal. An oscilloscope, if you have one available, would show if the Arduino is doing the right thing or if you have a defective servo. I haven't done it with an Arduino, but you might try manipulating the PWM channel directly instead of using the servo library.
By SkyRider
#76588
I don't have an Oscilloscope at home, but I do have at my University (by the way, I am Electronics Engineering Student).
but you might try manipulating the PWM channel directly instead of using the servo library.
And how exactly that would be done? I am sorry, but I am kinda noob at Servos, actually the servos aren't available in my country, I have bought from Sparkfun for the first time, I have no experience of them. And I really want help to get these Servos started.

Anybody who has used Servos and Arduino, could help me. Thanks guys![/quote]
By signal7
#76717
PWM is commonly used for LED fading:

http://arduino.cc/en/Tutorial/Fading

Some minor modifications to that example should get you going - or - at the very least, the example sketch should give you some ideas of how to adapt your example to using analogWrite() instead of the servo library. At the least, you'll determine if it's a problem with the library or not.
By SkyRider
#76808
When I use the Fading Example on the Servo, the servo rotates about a few degrees and then stops, and then it rotates more and then stops. After it reaches its extreme point, it no longer rotates.