servos only go 90 degrees???

Using the Arduino example "Sweep" as below I am getting only 90 degree rotation with several servos I'm using, instead of the 180 degrees. Any reasons Why???

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

Maybe the servo you have is designed for a 90 degree travel.

Hi Groove - no: I can move the servos by hand carefully and see that they are for 180 degrees. And three different servos behave the same way. Somehow this code does not give the pulsewidths that are required for full range. And yet this is the program and equipment provided in the learning kit. And I have double checked everything else and it seems to work EXCEPT for the range.

If you carefully move the servo to one end of it's travel, does it still only move 90 degrees?

How about starting from the other end?

You could have a look at the "writeMicroseconds" method and see if that gives you any more travel.

Try:

myservo.attach(9, 800, 2200); //change 800 and 2200 to your servo's min and max.

See Servo - Arduino Reference
for more info

Mowcius

1 Like

thanks for suggestions
-the servo can be turned by hand 180 degrees - only 0 to 45 seems to be accessed by code - changing the numbers 0 to180 in the code to any other numbers never gets it past the 45 degree position

  • seems the code for position (0 to 180) is inappropriate - and yet this is the code supplied with the kit and tutorial. tutorial??? i.e. How do numbers between 0 and 180 get translated into pulse width for position??

I'll try what you suggest. 'Tis annoyong!! :slight_smile:

Have you got the grounds connected?

Hi Groove - yes all ground common - the Arduino board, breadboard and servo are being driven by the USB port to the Arduino. Couldn't be a simpler circuit and tutorial code.

meh.

Did you try altering the max and min then? If that didn't work then your servo's probably broken...

Mowcius

If that didn't work then your servo's probably broken

Or only designed for <180 degree travel.

Groove - the same thing happens with three different servos, of different kinds including two new ones and the new one supplied with the kit

Has anybody tried this code, seen above, with their servo?

yes

OK folks - this is definitive but really really puzzling

I tried the min and max test as suggested, no fancy programming, just setting the position of the servo by the microseconds delivered.

BOTH With the Arduino Duemilanove board AND with the Arduino Pro Mini

AND with three different servos, two minis and one bigger

  • all servos can be moved by hand 180 degrees when unpowered

  • all gave min and max positions with close to 1000 and 2000 microseconds respectively as "expected"

BUT the min and max positions were only 90 degree rotations!!! They are claimed and supposed to be 180 degrees.

AM I crazy? - What the heck is going on??? Why do I get the limits at the right microseconds but the limits are only half full range of the all servos with both boards. HELP!

They are claimed and supposed to be 180 degrees

Where is that claimed, by the servo manufacture? Link available?

Lefty

Lefty; - Standard servo motors have 180 degree range almost universally

for example see the code above taken from the Arduino examples and used in tutorials and kits.

jus as an example see an array of servos here

I believe 180 degrees is a universal standard.

It is said 90 degrees in each direction but I take it that just means from a central position

The microsecond pulse limits I use are general 1000, 1500,2000 for one extreme, mid point and other limit 180 degrees away.

Am I wrong??

"Standard servo motors have 180 degree range almost universally" "I believe 180 degrees is a universal standard."

I've used R/C servos for decades and can tell you that your above statements are not facts let alone universal.

R/C servo standards revolve around pulse width specifications for the PPM encoding used. The 'standard' is that all R/C type servos will have a range of movement that includes 1000 usec to 2000 usec with a nominal 1500 usec center of range. There is no standard that equates that to a given degrees of travel. 90-100 degrees were typically at first but gradually most servo manufacturer increased range (over travel) above and below the 1000/2000 specs, but not to any agreed on 'standard'.

Here is a useful servo guide: http://www.servocity.com/html/how_do_servos_work_.html

And an extract from same:

"When a pulse is sent to a servo that is less than 1.5 ms the servo rotates to a position and holds its output shaft some number of degrees counterclockwise from the neutral point. When the pulse is wider than 1.5 ms the opposite occurs. The minimal width and the maximum width of pulse that will command the servo to turn to a valid position are functions of each servo. Different brands, and even different servos of the same brand, will have different maximum and minimums. Generally the minimum pulse will be about 1 ms wide and the maximum pulse will be 2 ms wide."

Some R/C servos will indeed cover 180 degrees using the pulse widths below and above the 'standard' 1000/2000 usec pulse width, but again there is no 'standard' or guarantee that the ones you own will indeed cover 180 degrees.

Also the electrical range of travel will always be less then the mechanical range of travel. The gear train has 'hard stops' to prevent mechanical damage to the internal feedback pot, but the control electronics will never drive the gear train too close to it's mechanical travel limit.

Lefty

Many thanks Lefty for the information. I was simply going by all I read and claims that I hear - I am no expert and take these things at face value. I'm certainly surprised with my results as described - that the 90 degree range was so similar for all the hardware combinations I tried and that 90 was so far from 180.

So do I understand it that you are not surprised at my results? And that I am doing things right and can relax my expectations? 90 degrees is rather limiting for many movements I want.

Many thanks again for the advice.

Lefty - even the servocity site you send me to has 0 and 180 as the limits described????? Surely one expects to be close to those limits???

Peter.