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
}
}
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.
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??
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.
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!
"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'.
"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.
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.