Pages: [1]   Go Down
Author Topic: Sparkfun's full rotation servo - SpringRC SM-S430R  (Read 2438 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Last week, SparkFun was blowing out these full rotation servos for $7.95 (they still have 1300 in stock, so I have a feeling they will be doing the sale again on these.)

I saw that lots of folks had questions about getting them to work. Here is what I deduced from reading the forums, and below is a really basic sample to get the servo actually doing something. You would never use this in any real application, it is just to make the motor turn in both directions at different speeds so you can see it move.

Code:
#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);
   }

}

And you can watch the speeds in the serial monitor. Note that my motor would not start turning until about 1440 in one direction and 1560-80 the other direction, so let it get up to those numbers before you expect your servo to move.

I noticed that the range to get a difference in speed is only about 200+ or - either way from 1500. Once you pass 200 either direction you don't see any difference, no matter if you go down to 100 or up to 5000 there is no additional increase in speed from  ~1300 or 1700. I didn't see one anyway. Feel free to change the values in the loops and experiment with yours. I would be interested in hearing what other peoples results are.

I am not sure if this is the actual way to use this motor, there have been a lot of discussions about PPM or PWM and if you need a controller or not with these. I am not using any kind of controller, I just plugged into Pin9 with the white lead, and gave it power and ground on the red/black lines and thats it.

I would be interested in seeing any code that could extend the width for speeds or drive it in a better/more efficient way.

All in all, for a motor that cost 8 bucks, claims to have a 3.3kg/cm torque rating (um, I am skeptical about that, but we will see) and that you don't need a controller to use, these were a great deal. You can just plug 'em in and go.

Just posting to give back some of the help I have received here!
« Last Edit: July 03, 2010, 03:27:21 am by Intenzity » Logged

Pages: [1]   Go Up
Jump to: