Apr 112009
 

I’ve been exploring various types of gearmotors. DC motors by themselves spin too fast and have low torque. Gearmotors are motors with a gearbox that slows down the high speed of the motor and produces higher torque. Most gearmotors are pretty expensive though. I want a really cheap, almost throw-away, source of gearmotors. It turns out cheap servos can be made into continuous rotation gearmotors.

Modding servos for continuous rotation is not a new hack. You can find many examples of it. You can even buy a nice continuous servo made by Parallax. But I wanted a micro servo version. I’ve been getting cheap servo motors from Hobby City, and they have several super-tiny servos for less than $4. The ones I use here are the Hextronic HXT500 available for $3.49 each.

Here’s how to modify one of those servos to make it into a tiny little gearmotor.

How it works

Servos have a pulse input that specifies what angle the servo should be positioned at. Physically, servos contain a DC motor with a gear train, a potentiometer connected to the output shaft, and control electronics that reads the position of the shaft with the pot. The control electronics compare the commanded angle and compare it to the angle read by the potentiometer, and then proportionally controls the motor’s speed depending on how close the shaft’s position is to where the servo is being instructed. By removing the pot from this loop and inserting two fixed resistors of equal value, the servo will now drive the motor continuously either forward or reverse, with a speed proportional to how far away the commanded angle is from the mid-point.

Take apart the servo.

These servos have a case made of three pieces of plastic, press-fit together. You can use a small blade screwdriver or similar thin wedge to separate the pieces. From the top you can pull off all the gears (note which ones go where). From the bottom, you can access the servo’s circuit board.

(click on any of the images to enlarge)

cont_servo_1 cont_servo_2 cont_servo_3

Remove the mechanical stops

The servo’s shaft (which is also the potentiometer shaft) has mechanical stops to prevent it from rotating too much. You want to remove these. On these servos there are two stops: one is a metal bit at the base of the shaft that can easily be bent and removed with needle-nose pliers, the other is a little plastic nub on the top case which can be snipped off with diagonal cutters.

cont_servo_4 cont_servo_4 cont_servo_5

Replace the potentiometer with fixed resistors

The pot in the servo is 5k. You want to replace it with two fixed resistors that add up to about 5k. I used two 2.2k resistors. I’ve also used to 2.7k in another servo. Unsolder the three wires from the servo’s potentiometer, and solder them to the two resistors. To keep this new assembly from shorting against the existing servo circuitry, tape it up, or like here, slip a bit of heat-shrink tubing over it. Then tuck it and the rest of the electronics back in the servo case and put it back together!

cont_servo_7 cont_servo_9 cont_servo_10

Using it with Arduino and SoftwareServo library

The sketch in the video is a real simple one that uses the Software Servo library on the Arduino Playground. On the Playground, it’s still called just “Servo”, which causes some conflict with modern Arduino. I couldn’t find a renamed version, so below is the renamed version, called “SoftwareServo”.

The SoftwareServo library is great because it lets you use any digital I/O pin as a servo output, let’s you configure the parameters of different servos, and takes an 0-180 degree angle to control the servos.

The sketch used in my tests are packed up in the zipfile SoftwareServoKnob.zip, and contains everything needed to play with servos using the SoftwareServo lib. Just unzip it and open the SoftwareServoKnob.pde file in Arduino. The files in the zip are:
- SoftwareServoKnob.pde — the sketch
- SoftwareServo.h — the library header file
- SoftwareServo.cpp — the library code file

How to “center” a continuous servo in software

One thing you’ll notice after using one of these continuous servos is that sending an angle of 90 degrees should stop the servo from spinning, but doesn’t. This is because the two fixed resistors added aren’t exactly the same value. This means that one servo might have a “zero” point at 82 degrees and another at 91 degrees. This is a pain to keep track of and is why the Parallax continuous servo contains a small trimpot that lets you adjust the zero point.

With the SoftwareServo library you can get back to having 90 degrees be the zero by adjusting the “maximumPulse” value for each servo. Create a sketch that changes the value of it with “servo1.setMaximumPulse(value)” across a range until you find a value that stops the motor when set to 90 degrees. The default value for maximumPulse is 2400, varying it between 2100 and 2700 should be enough to find the value that works for a particular servo. Remember that value (maybe write it on the bottom of the servo), use that value to setMaximumPulse on setup, and you’ve got a reversible DC gearmotor for less than $4.

 Posted by at 12:10 am

  44 Responses to “Tiny Servos as Continuous Rotation Gearmotors”

  1. Hi, thank you for the smart tut!
    Simple question: why not glueing the pot in its central position, instead of replacing it by single resistors?
    Bye
    Fabio (from Italy)

  2. Hi Fabio,
    I wanted to do that, but on the servos I was using, the pot shaft was part of the gearing mechanism of the servo. I couldn’t remove or freeze the pot without messing up the gearing. So I left it in place and added resistors. :)

  3. Hello!
    I have enjoyed very much this great DIY page, about turning an hxt-500 into a continuous servo.
    I tried it myself and it worked very nice!

    Lately, i have an application that requires an even smaller and lighter continuous servos.

    I have a question: i found this servo, which weighs half of the hxt-500 (that is 2.5 grams), it looks from the outside, very similar to the hxt-500, here is a link to that servo:

    http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=3714

    My question is: Do you think it would be just as possible to turn this smaller one, into a continuous servo? Do you think that mechanically i need to follow the same steps and mostly unclear to me is: Do you think i should use the same resistors, as you used with the hxt-500? How did you find out, with the hxt-500, that you need a certain type of resistors and not others?

    Thanks a lot,
    Roi Neustadt.

  4. Hi Roi,
    In all the servos I’ve taken apart, they all use very similar position-sensing potentiometer, and always 5k ohms. If you want to test that, you can measure the value of the pot yourself with a multimeter by unsoldering it from the rest of the servo circuit and measure the resistance across the outer legs of the pot.

    I would be more concerned that since that’s such a tiny servo, it’ll be hard to solder to. You might want to get a magnifying glass! :-)

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>