ServoTimer2 0...160 degrees only

Hello,

I want to use ServoTimer2 library, because of a libraryconflict. But i'm not able to turn my servo from 0...180.

expected Values:

750 = 0° 1500 = 90° 2250 = 180°

my Values:

750 ~ 5° 1500 ~ 75° 2250 ~ 160°

Doesn't matter if i put in a higher value than >2250. The servo doesn't move on full 180°. Why?

EDIT: I use the example-code.

Maybe the servo wasn't made to go the full 180 ? You've done that with something other than the "ServoTimer2" library?

Servos are made for one purpose, to control the control surfaces in a model plane - there's absolutely no guarantee of any particular range of movement unless the manufacturer states it on the product description/datasheet. You send a control signal, it moves - that's the contract basically.

Expect at least 90 degrees and you'll be happy - 120 to 150 is quite common - if the specs don't mention range of movement you are best off avoiding.

Rachmaninow: I want to use ServoTimer2 library, because of a libraryconflict. But i'm not able to turn my servo from 0...180.

Does the servo move through a greater range with the regular Servo library?

If so maybe the ServoTimer2 library has in-built limits that you could change.

...R

Well i know it, that 0...190 is possible. There are no problems, whil using the normal Servo-Library.

@Robin2

could be, where can i find thos limits?

Use this short sketch to test your servo, enter a position in degrees in the serial monitor, it will print position and microseconds, work your way toward the ends of the stroke (0 - 180) 5 degrees at a time and you can find the limits.

#include <Servo.h>
Servo servo;

void setup() {
  // initialize serial:
  Serial.begin(9600);
  servo.attach(9);
}

void loop() {
  int angle;
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    angle = Serial.parseInt(); 
    // look for the newline. That's the end of your
    // sentence:
    if (Serial.read() == '\n') {
    
    servo.write(angle);
    Serial.print(servo.read());
    Serial.print("  ");
    Serial.println(servo.readMicroseconds());
    }
  }
}

Doesn’t matter if i put in a higher value than >2250. The servo doesn’t move on full 180°. Why?

Below is some servo test code you can use to find the mechanical control limits of your servo and corresponding command values.

// zoomkat 3-28-14 serial servo incremental test code
// using serial monitor type a character (s to increase or a 
// to decrease) and enter to change servo position 
// (two hands required, one for letter entry and one for enter key)
// use strings like 90x or 1500x for new servo position 
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include<Servo.h>
String readString;
Servo myservo;
int pos=1500; //~neutral value for continous rotation servo
//int pos=90;

void setup()
{
  myservo.attach(7, 400, 2600); //servo control pin, and range if desired
  Serial.begin(9600);
  Serial.println("serial servo incremental test code");
  Serial.println("type a character (s to increase or a to decrease)");
  Serial.println("and enter to change servo position");
  Serial.println("use strings like 90x or 1500x for new servo position");
  Serial.println();
}

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) {
    if(readString.indexOf('x') >0) { 
      pos = readString.toInt();
    }

    if(readString =="a"){
      (pos=pos-1); //use larger numbers for larger increments
      if(pos<0) (pos=0); //prevent negative number
    }
    if (readString =="s"){
      (pos=pos+1);
    }

    if(pos >= 400) //determine servo write method
    {
      Serial.println(pos);
      myservo.writeMicroseconds(pos);
    }
    else
    {   
      Serial.println(pos);
      myservo.write(pos); 
    }
  }
  readString=""; //empty for next input
}

Rachmaninow: @Robin2

could be, where can i find those limits?

I don't know - but if you poke around inside the library code you should be able to see if there are any.

Another test ... If you move the servo to 2250 (the max) and disconnect it from all power and from the Arduino can you move the arm further in the same direction with your fingers (GENTLY)? If not then the servo is as far as it can go and it may be worth trying to see how far it can go in the other direction. Maybe the problem is the lower limit.

...R

@Robin2:

yes i tried it. At position 15 the motor still is at 0°. also, if i move to the max, disconnect it - i can turn it to the max. Maybe 10°. strange thing, because i have the same problem with the normale servo-library. Looks like its an issue with the servo?!

Rachmaninow:
I have the same problem with the normale servo-library.

That’s not what you said in Reply #4

There are no problems, whil using the normal Servo-Library.

If you don’t provide us with accurate data it is very difficult to give sensible advice (and time wasting).

…R

Repeat servos are not normally designed to move 180 degrees, you cannot assume they do.