Introduction: Converting Micro-Servos for Continuous Rotation
Micro-servos are great devices perfect for adding motion to your projects. Unlike steppers, they can be controlled directly from your Arduino or other favorite microcontroller. Most servos are limited to 180 degrees of motion. This allows microcontrollers to know the exact position of the servo's shaft. You can find continuous rotation servos, but if you have access to lots of cheap micro-servos of the 180 degree variety, it might be helpful to learn this quick hack to make them continuous.
What You'll Need
- A 9g micro-servo;
- Needle nose pliers;
- Screw drivers matching screws on your servo;
- A 1.4mm flat head screw driver;
- Box cutter or hobby knife;
- Superglue;
- Arduino or other microcontroller to test your servo (including USB cable to attach to your computer) and;
- Jumper wires to hook your servo up to your Arduino for testing.
Step 1: Open Your Servo's Case
This is simple. Just unscrew the screws usually found on the bottom of the servo case. Next, very carefully open the case and try not to knock out any of the gears. Sometimes they are just barely hanging in there and the pressure of the case is all that is keeping them in place.
Next, take a picture of how everything looks before going any further. You will thank me later when it is time to put it all together. I know what you're thinking, "I can remember how it goes back together." Trust me, take a picture! I've included one of the 9g Tower Pro we have here at Maker Zoo. Yours might be identical, or maybe a little different.
Step 2: Modify Topmost Gear
The topmost gear needs to be removed. Take a look underneath and notice what should be a tab. This tab is part of what limits the servo's motion to 180 degrees. You're going to need to shave it off with your box cutters or hobby knife.
Be very careful with your hands and fingers because the gear is small and difficult to hold on to while cutting. Take your time, and don't rush through this step. Take a little material off at a time to reduce the amount of force needed.
Next, look closely at the hole that this topmost gear fits onto the shaft with. It is a semicircle. To make sure it spins freely on the shaft 360 degrees, we need to auger out material to make it a full circle. Using an approximately 1.4mm jeweler's screwdriver, slowly twist it until the hole becomes circular.
Step 3: Remove All the Gears and Glue the Potentiometer
Remove the rest of the gears. Keep the servo sitting up and support it with something if necessary for this next step. Get your pliers (though you could use your fingers if you are very dexterous), and twist the shaft of the potentiometer. You will notice its 180 degrees of rotation to the left and right. Twist it back and forth a few times to get an idea of where center is, then leave it as close to center as you can.
Next, you need to carefully apply some superglue around the base (not on the shaft) of the potentiometer. Give it some time to dry. Gently blow on it and if you see the glue moving, it isn’t dry yet. If you were careless when gluing and assembling the servo while it is still wet, you might glue everything together! Disaster!
Step 4: Reassemble the Servo
Once the superglue is fully dried, using the picture we took at the beginning after removing the case, we can reassemble the gears carefully. Place the top cover of the casing back on, making sure it is securely and properly fitted in place. Then screw the case closed with the four screws removed in Step 1.
Step 5: Testing Your New Continuous Servo
Now that you have everything put back together, it’s time to test the servo and make sure the conversion was successful. An Arduino is perfect for this and all you need to test it is your Arduino (we’re using an UNO board), 3 jumper wires, and a USB cable to connect the UNO to our computer. On our servos, the brown cable is ground, red is positive, and orange is for the signal. Connect ground to GND on your Arduino, postive to 5V on your Arduino, and the signal wire to pin 9 on your Arduino. (Note: A servo under any kind of load should not be hooked up to your Arduino like this, it could overdraw amps and cause your Arduino to reset or burn it out. But here we are just testing rotation, and just for a short time.)
We typed in and uploaded the following code:
//Test continuous servo conversion
#include Servo myservo;
void setup() {
myservo.attach(9);
}
void loop() {
myservo.write(180); //clockwise rotation
delay(2000); //rotation duration in ms
myservo.detach(); //detach servo to prevent “creeping” effect
delay(500); //short pause
myservo.attach(9); //reattach servo to pin 9
myservo.write(0); //counterclockwise rotation
delay(2000); //rotation duration in ms
myservo.detach(); //detach servo to prevent “creeping” effect
delay(500); //short pause myservo.attach(9); //reattach servo to pin 9 before looping
}
180 causes your servo to spin clockwise at full speed. 0 causes it to spin counterclockwise at full speed. Values of 45 and 135, for example, have the servo spin slower in their respective directions while 90 theoretically should keep the servo at rest. However, we say “theoretically” because the servo is never really perfectly centered. This causes the servo to creep ever so slowly in one direction or another. Besides being annoying it also ruins the accuracy of your project. So to prevent this creeping, we attach and detach the servo when necessary in the above Arduino code. Detaching it leaves it unpowered and therefore completely at rest.
Closing Thoughts
Now you have a continuously rotating servo that you can use alone for various projects, or pair up to power a robot or anything else you can imagine. There are definitely many other ways to do this particular hack. And there are obviously many better options you can use if you have the time and money to source them than a hacked continuously rotating servo. But in case you have a bunch lying around and want a quick solution, here it is.
At Maker Zoo we've used this hack while developing our open-source Arduino robot, and are currently using it for an upcoming IoT project. An automatic fish feeder we are redesigning also used this very hack and operated for a year and a half without any problems. Just be careful with the final position of the potentiometer before gluing. If you didn't center it, the whole hack will fail. Good luck!
23 Comments
1 year ago
Thanks so much for this! Straightforward and easy to understand.
Question 3 years ago on Step 5
Hello, may I ask why my servo only rotating clockwise? Can anybody tell me how to fix it?
8 years ago
You may consider this approach:
Before gluing the potentiometer, connect the servo to an Arduino and use the MyServoWrite(90) to set the non-rotation state. Gently turn the potentiometer until the motor stops. This will reduce your motor drift error. Remove power to the circuit and lock the potentiometer position with a small dab of enamel paint (aka nail polish.)
In the future if motor drift appears due to components aging out of tolerance then the paint can be broken loose and the procedure repeated to readjust.
Reply 8 years ago
That gives me an idea to shift the potentiometer out of the servo case and if tuning is needed I can do it on-the-fly.
Reply 4 years ago
haha, also came to this conclusion. was about to post my findings
6 years ago
Excellent post, thank you.
Questions: Must one use the "myservo" library? or can the "servo" library be used? If so where can I get the "myservo" lib?
Reply 5 years ago
You should just be able to use the servo library
6 years ago
Great Project, a money saver.
7 years ago
can it be rotated in forward backward direction???
8 years ago
Remember that you can add flags and other sensors to get some of your positioning back. You could effectively 'home' the servo to a position sensor before repeat movements (hit flag, wait for proximity switch, pulse 1.8 ms for 2 seconds, then stop at the flag again) or put distance meters for external limits.
8 years ago
If I understand this correctly, you have reduced the server to a geared motor that can be controlled by an arduino without additional control circuitry. You have the ability to tell the server to turn one way or the other, but you have lost the ability to go to a particular position.
Reply 8 years ago
Yes, correct. You trade off being able to position it for the ability to move continuously and control it with an Arduino.
We show people how to do this hack even though there are obviously better alternatives out there in case all you have laying around is a micro-servo and basically nothing else.
8 years ago
I find that using a voltage divider made with two resistors instead of gluing the potentiometer provides a better long-term stability.
Reply 8 years ago
How could you know the position in this case ?
Reply 8 years ago
Actually, you won't know your absolute position once the resistance is no longer giving feedback to the servo. But, technically the position no longer matters. If you need position then you have to leave servos behind and get stepper motors.
Reply 8 years ago
Using 2 equal resistors (2.5 V divider) the position will be 90°.
8 years ago
raman_083 - Generating significant power from servos is thought provoking but inherently inefficient. At best I suspect you'd get 0.5 amps at 4V at peak torque. Most servos contain plastic gearing which would strip out quickly with any kind of continuous torque. So with a metal gear servo I'd say a conservative 0.2 Amp per servo at 4V, so to charge a lead acid battery we're talking 5 servos in series to get nominal 20V and then multiply by 5 in parallel to get 1 amp, so roughly 25 servos for 20 watts (which you could push to 40 Watts and wear out your $1000 in servos twice as fast). Then you have to figure out how to make them all turn, etc.
8 years ago
raman_083 - Generating significant power from servos is thought provoking but inherently inefficient. At best I suspect you'd get 0.5 amps at 4V at peak torque. Most servos contain plastic gearing which would strip out quickly with any kind of continuous torque. So with a metal gear servo I'd say a conservative 0.2 Amp per servo at 4V, so to charge a lead acid battery we're talking 5 servos in series to get nominal 20V and then multiply by 5 in parallel to get 1 amp, so roughly 25 servos for 20 watts (which you could push to 40 Watts and wear out your $1000 in servos twice as fast). Then you have to figure out how to make them all turn, etc.
8 years ago
I second the two resistor method for stability. I have modified on the order of a hundred servos with this method for my company. Centered pot servos tend to drift, even if they are glued down. You normally have plenty of space for the resistors once you remove the pot.
8 years ago
Can we use it to continuous run the wind turbine for continuous power send detail Raman_083@yahoo.co.in