180 degree servo stoppping?

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
1885
 
Posts: 94
Joined: Sun May 24, 2009 2:12 am

180 degree servo stoppping?

Post by 1885 »

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
}

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: 180 degree servo stoppping?

Post by adafruit_support_bill »

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
1885
 
Posts: 94
Joined: Sun May 24, 2009 2:12 am

Re: 180 degree servo stoppping?

Post by 1885 »

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?

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: 180 degree servo stoppping?

Post by adafruit_support_bill »

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
1885
 
Posts: 94
Joined: Sun May 24, 2009 2:12 am

Re: 180 degree servo stoppping?

Post by 1885 »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”