180 degree servo stoppping?

by cwc1885 on Wed Sep 26, 2012 10:26 pm

I just set up some 180 degree servos on an Arduino Uno and ran the code below.
What happens when the servos hit the end of the 180 degree cycle (0 or 180) and the code keeps pushing them?

Will they burn up?

Is there code to end the servo when it gets to the end?

/*
Arduino Servo Test sketch
*/
#include <Servo.h>
Servo servoMain3; // Define our Servo 3
Servo servoMain5; // Define our Servo 5
void setup()
{
servoMain3.attach(3); // servo on digital pin 3
servoMain5.attach(5); // servo on digital pin 5
}

void loop()
{
servoMain3.write(45); // Turn Servo Left to 45 degrees
delay(1000); // Wait 1 second
servoMain5.write(0); // Turn Servo Left to 0 degrees
delay(1000); // Wait 1 second
servoMain3.write(90); // Turn Servo back to center position (90 degrees)
delay(1000); // Wait 1 second
servoMain5.write(135); // Turn Servo Right to 135 degrees
delay(1000); // Wait 1 second
servoMain3.write(180); // Turn Servo Right to 180 degrees
delay(1000); // Wait 1 second
servoMain5.write(90); // Turn Servo back to center position (90 degrees)
delay(1000); // Wait 1 second
}
cwc1885
 
Posts: 42
Joined: Sun May 24, 2009 1:12 am

Re: 180 degree servo stoppping?

by adafruit_support_bill on Thu Sep 27, 2012 4:55 am

There is some variation in analog servos. Sometimes you need to adjust the minimum & maximum in the code to avoid hitting the stops.

Hitting the stops puts a lot of load on the motor, the gear-train and the drive circuit. In some cases I have seen it actually strip the gears, so it is best not to run them that way.
User avatar
adafruit_support_bill
 
Posts: 25556
Joined: Sat Feb 07, 2009 9:11 am

Re: 180 degree servo stoppping?

by cwc1885 on Thu Sep 27, 2012 6:41 am

adafruit_support wrote:There is some variation in analog servos. Sometimes you need to adjust the minimum & maximum in the code to avoid hitting the stops.

Hitting the stops puts a lot of load on the motor, the gear-train and the drive circuit. In some cases I have seen it actually strip the gears, so it is best not to run them that way.



Is there a way to ZERO your servos prior to running the code with code?

OR

Do you have to manually turn your servos prior to running the code?
cwc1885
 
Posts: 42
Joined: Sun May 24, 2009 1:12 am

Re: 180 degree servo stoppping?

by adafruit_support_bill on Thu Sep 27, 2012 6:58 am

Not sure what you mean by 'zero'. You can do a "servo.write(0)' in setup for each of your servos. But that (or manual positioning) does not address the servo variablility issue.

You need to figure out what values will send your servos to 0 and 180 degrees without hitting the stops. You can then use the 'map()' function to scale 0-180 to the right values for your servo.
User avatar
adafruit_support_bill
 
Posts: 25556
Joined: Sat Feb 07, 2009 9:11 am

Re: 180 degree servo stoppping?

by cwc1885 on Thu Sep 27, 2012 8:33 am

adafruit_support wrote:Not sure what you mean by 'zero'. You can do a "servo.write(0)' in setup for each of your servos. But that (or manual positioning) does not address the servo variablility issue.

You need to figure out what values will send your servos to 0 and 180 degrees without hitting the stops. You can then use the 'map()' function to scale 0-180 to the right values for your servo.



got it! thank you so much. kind of wish i would have got the 360 servos but this will be good for us.
i looked at the bulk ordering for schools. id like to get at least 10 360 servos for our students along with 10 arduinos, 10 protshields led and wires .
Anyway . I'm putting together a wish list.
Thanks again!
cwc 1885
cwc1885
 
Posts: 42
Joined: Sun May 24, 2009 1:12 am