Tower Pro 9g. Motor does not stop

Hi,

I have just received 4 Tower Pro 9g servos. These are my first servos. On 2 of them the motor does not stop when the arm gets to the end of the range.

When trying the knob example, the arm stops at the end of the sweep but the motor is still running, trying to make the arm go further. This only happens on 2 of the 4. Is this normal?

You may have damaged the servos. In these small types of servos the gears will often slip/strip when driven against their internal hard stop. below is some servo test code you can use to find the rotation/control limits of your servos to preclude damage.

// 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(1500); //set initial servo position if desired
  myservo.attach(7, 500, 2500);  //the pin for the servo control, and range if desired
  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
  } 
}

Thanks for the code.

everything is fine until I get to 160. At 160 the "vibration" is minor, at 180 it is quite severe. This made me think I was trying to force the motor further than it should be going. What is the range for this model? Is it less than 180 degrees?

A quick search gave me the following:

DIMENSION: 26mm13mm24mm
WEIGHT: 9G
OPERATING SPEED: 0.12sec/60degree(4.8V);0.11sec/60degree(6V)
STALL TORQUE: 1.2kg/cm or 17oz-in. (4.8V) 1.6kg/cm or 22oz-in.(6.0V)
OPERATING VOLTAGE: 4.8V~6.0V
FEATURE: 3 pole wire, all nylon gear, connector wire length: 15cm

Does the 60 degree mean the range of operation. IE 60 degree left, 60 degree right; a total of 120 degrees?

EDIT

Scratch the above. Just watched several videos on youtube and people are clearly getting 180 degrees.

Just tried the second servo that shows the same issue, the number is similar but not exactly the same. The "vibration" starts at 169.

Because of variations between individual servos I find that the Servo.Write(degrees) is not much use. I prefer to use Servo.writeMicroseconds().

In theory a servo will set its position to 0 when it receives a pulse width of 1 millisec (1000 microsecs) and it will set its position to 180 with a pulse width of 2000 microsecs. In practice the mechanism in the servo may not be perfectly aligned with the theory so you need to find (by trial and error) the appropriate numbers of microseconds that represent the two extremes of movement for each of your servos. At the extremes there shouldn't be any vibration, but if you asked it to go a little farther there would be.

...R

Robin2:
Because of variations between individual servos I find that the Servo.Write(degrees) is not much use. I prefer to use Servo.writeMicroseconds().

In theory a servo will set its position to 0 when it receives a pulse width of 1 millisec (1000 microsecs) and it will set its position to 180 with a pulse width of 2000 microsecs. In practice the mechanism in the servo may not be perfectly aligned with the theory so you need to find (by trial and error) the appropriate numbers of microseconds that represent the two extremes of movement for each of your servos. At the extremes there shouldn't be any vibration, but if you asked it to go a little farther there would be.

...R

just had chance to try this out.

Using microseconds the range of the one of the servos is around 560 - 2270. Is this a typical range?

Below 560 there is no movement and also no vibration from the motor trying to go beyond its limits.
Above 2270 the motor starts to stress out and is trying to move further than it can.
I haven't tried the other motors yet.

I have noticed that every now and then the motor jumps very slightly on its own.

Unfortunately you haven't said what angle the servo arm moves when you give it the numbers 560 and 2270. If it does what you want mechanically it doesn't matter what the numbers are.

...R

Robin2:
Unfortunately you haven't said what angle the servo arm moves when you give it the numbers 560 and 2270. If it does what you want mechanically it doesn't matter what the numbers are.

...R

Arduino's default value for 0 degrees is 544 microseconds, and for 180 degrees is 2400 microseconds. I have a Tower Pro servo (different model #) from Sparkfun. It's range of motion is 170 degrees. If yours is also 170 degrees, the 560-2270 microseconds range (I'm assuming that's for the two extremes of it's range of motion) sounds about right.

Using a potentiometer and "Serial.println" (as I think is included in the "Knob" sketch) you can easily monitor how far it moves with which values & determine what range you need for that servo.

I have noticed that every now and then the motor jumps very slightly on its own.

Put a 0.1uf bypass capacitor across the power leads of the servo to help filter noise. That cured problem for me.

thanks for the replies.

now using 544 to 2266 and getting about 177-178 degrees.
I can go a little higher than 2266 without forcing the motor but the arm does not turn.
Below 544 there is no movement nor vibration from the motor being forced.

groundfungus:

I have noticed that every now and then the motor jumps very slightly on its own.

Put a 0.1uf bypass capacitor across the power leads of the servo to help filter noise. That cured problem for me.

Do you mean across the +5V and the ground?

Below 544 there is no movement nor vibration from the motor being forced.

If you want to try a value less than 544, you will need to change servo us range in the setup section of the code. The below is from the servo.h file.

   attach(pin )  - Attaches a servo motor to an i/o pin.
   attach(pin, min, max  ) - Attaches to a pin setting min and max values in microseconds
   default min is 544, max is 2400

Do you mean across the +5V and the ground?

Across ground and the power wire to the servo, not 5V Arduino.

groundfungus:

Do you mean across the +5V and the ground?

Across ground and the power wire to the servo, not 5V Arduino.

sorry, this is what I meant. I am running the servo from a 5V breadboard power supply.