Hello Guys, I am having trouble, I would like to rotate my servo from 0 to 360 and then stop. The first Servo I bought only goes from 0 to 180. So I bought another one that said it was a 360 degree, however that one just turns forever. Any help on how to make a servo just do one single rotation?
The 0 to 180 Servo is a Tower Pro SG90, the continuous Servo is a Fitec FS90R
My Code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
for (pos = 0; pos <= 360; pos += 1) { // goes from 0 degrees to 360 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
}
}
void loop() {
}
You should share your code and a schematic (including parts number of the servo), otherwise it will be difficult to help you.
That is a continuous rotation servo, and that's the expected behavior. The input from the Arduino controls speed, not angle. Continuous rotation servos are not good if you need precise control of the angle, unfortunately.
You should post a link to the servo you bought. There are 2 different types of '360°' servos: servos that spin continuously and speed and direction can be controlled by the input signal, and servos that can position +/- 180°. Obviously you bought a 360° continuous rotation servo.
Thanks, I did mention that I have a 0 to 180 servo, my question is how can I get to the outcome I need? 0 to 360 and then stop?
Buy an appropriate servo.
Thanks Micro, I have both and neither seems to be able to do what I want. I have one that only goes up to 180 degrees and one that spins forever. Is there no way for me to get from 0 to 360 degrees? I need 0 to 360, what are my options?
You can't with the servos you have. Most normal servos are not capable of rotating greater than 180 degrees. You need to find a 360-degree servo that is not a continuous rotation servo, or use a stepper motor instead. Another option would be to make or buy a gear drive to increase the maximum rotation output with your 180-degree servo, but beware that you will decrease the torque and angular resolution by doing so.
Man it is hard, are you honestly that uptight mate? I can only ask if I do not know? Could you please be so kind as to point me in the right direction here please? Can you or someone with a bit more knowledge than I do please tell me what to buy?
Do you really need a servo?
What are you trying to do?
I will buy anything that will do the job lol, I want to make something rotate 360 degrees once then stop, so it ends in the same position it started. It will spin a cylinder that is light and 20mm diameter.
PS: I already know I can't do it, hence the question asking for someone to help me with how I can
You have four options that I can see:
- Find a 360-degree servo that is not for continuous rotation. (I don't already know of one like that, and I'm not going to search for you, if that's what you are asking for.)
- Use a stepper motor instead. They are designed for precise angular control and are not limited to 180-degrees or less like most servos.
- Use your continuous rotation servo. You can control the angle, just not precisely. The signal from the Arduino is proportional to rotation speed. The change in angle is rotation speed x time. Some testing will be required to figure out how much time to run it to get the angular change you desire. Also beware that continuous rotation servos are prone to drift.
- Make or buy a gear drive to increase the angular output of your servo. Again, this will reduce the torque and angular resolution, and don't expect someone to find a suitable one for you.
Thanks for the help mate. I have searched and cannot find a 360 degree servo that is not continuous. I had hope someone in here would be able to tell me if one existed or not. I will just keep trying to figure this out and look into a stepper instead. Thanks again.
One can take a servo apart and remove the stop that prevents rotation beyond the pre-set limits. It is a small plastic nub in many.
But I am not sure if the potentiometer that senses the servo position will allow that. If it is a cheap servo, it may be worth a try.
Clearly my Google-fu sucks, this is 100% what I was looking for. Thank you so very much! This one is discontinued but at least I know they do exist!
That generally means do not use in new designs! They may still have them in stock or perhaps Ebay or other sources.
Other search terms that will turn up results are "sail winch servo" and "multi-turn servo." They tend to be rather big and expensive, though, from what I can tell.