Go Down

Topic: Grumbling servo following swap from one to another (Read 621 times) previous topic - next topic

Dane

I recently replaced a micro servo with nylon gears rated for 1.2kg/cm - with a mini servo with metal gears rated for 2.2kg/cm.

Both are standard servos, not 360deg or continous rotation.

With my previous servo, I could tell it:

Code: [Select]
Servo.write(180);
with the new servo, it grumbled massively (as if it had hit a mechanical stop). I changed the code to
Code: [Select]
Servo.write(150); and all was well.

I still don't understand why this should be any different between servos! :) Does this mean I can use
Code: [Select]
Servo.write(-20); to regain the 20deg of travel I've otherwise lost? Does this make sense?

This new servo also "twitches" at idle (the old one didn't). Should I return it or spray it with WD40 (as I've seen recommended here).

Thanks all


Dane


How is it powered?


with a wallwart. A different wallwart to the one which powers the Arduino. Grounds tied.

jraskell

Have you confirmed that the new servo has 180 degrees of sweep?  Not all do.  Some have 160, 120, 90 degrees of sweep.  It's easy enough to confirm by manually sweeping the output shaft to determine where it's stops are.

If it is a full 180 degree servo, then try using the writeMicroseconds() method of Servo.  Not all 'standard' servos are actually standard.  In fact, I would even go so far as to say there really isn't any true standard for servos.

Under the covers, the Servo library converts your 180 to a microsecond pulse value, and I believe it assumes as 'standard' pulse window of 1000-2000 microseconds.  Not all servos use the same range, and if yours uses a different range, then using write() to specify the position in degrees isn't going to map correctly.

cyborgcnc

Exactly as jraskell said....

The default values for the library are 544 ms for min, and 2400 ms for max...think of these almost as the trim values you would have to adjust if you were using the servo with say a standard RC radio, so as to limit it's movement when you are setting up something..

you can control these settings as well, but issuing a command like this as well:

servo.attach (yourPIN , min , max) so something like servo.attach(9, 520 , 2000) for example, to trim the min and max

and then specify the values that will make the servo not slam into it's extremes, and maybe stop twitching...


Dane

I'm very curious to try this! Thank you. The servo is a Hextronik MG14 and I have totally failed in my bid to find a datasheet for it! I imagine having the datasheet would make specifying the values that would make the servo not slam into its extremes and not twitch trivial...

Thanks

MarkT

#6
Apr 20, 2012, 05:52 pm Last Edit: Apr 20, 2012, 05:54 pm by MarkT Reason: 1

Under the covers, the Servo library converts your 180 to a microsecond pulse value, and I believe it assumes as 'standard' pulse window of 1000-2000 microseconds.  Not all servos use the same range, and if yours uses a different range, then using write() to specify the position in degrees isn't going to map correctly.

Its 544 to 2400us

[ Oh yes, the other thing, the ratings are torques, and its not 1.2kg/cm, its 1.2 kg cm - the product of force and distance of the line-of-action from the shaft.  It should really be quoted in sensible units such as Nm ]
[ I won't respond to messages, use the forum please ]

Dane

#7
Apr 20, 2012, 06:13 pm Last Edit: Apr 20, 2012, 06:17 pm by Dane Reason: 1

Its 544 to 2400us

Sorry, what is? Are these the trim "values that will make the servo not slam into it's extremes, and maybe stop twitching"

And if it is, would you mind letting me know how you found these? Did you find the datasheet?

Thanks


wildbill

Read reply #4 again - those numbers are the library defaults that will be used if you don't override them. They specify the min and max that will be used to control the server. He isn't telling you anything about your particular servo

Dane


Read reply #4 again -


Ah right-I guess he didn't see cyborgcnc had already posted them. Thanks for clearing that up.

Dane

#10
Apr 20, 2012, 10:03 pm Last Edit: Apr 21, 2012, 07:41 pm by Dane Reason: 1
OK - I've used zoomkat's code and discovered the servo likes values between 3 and 180. Or 600 and 2300 microseconds. Thanks zoomkat! .
P.S. With the feline code, the servo doesn't twitch. Well done the man who identified it was the use of the library that was causing the twitch. I was poised with the WD40!

Code: [Select]
// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// 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(57600);
 myservo.writeMicroseconds(1500); //set initial servo position if desired
 myservo.attach(6);  //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);  //slow looping to 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();  //convert readString into a number

   // 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
 }
}

Go Up