Tiny Servos as Continuous Rotation Gearmotors

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.

51 Replies to “Tiny Servos as Continuous Rotation Gearmotors”

  1. It seems that one could make a micro motor that already has an esc with a servo. Is this correct? Have you done this?
    Thanks,
    Ron

  2. hi, i want to bulid robot with bluetooth and micro servo with android phone control.
    i use metaboard + v3 bluetooth, and 2 micoro servo 9g.
    i’m hacking the micro servo with this instruction

    but i don’t know why, after my robot can connect to the android
    phone, then i push the gui app to move forward. but my micro servo is
    being error. the left and the right servo is move opposite direction
    and the servo is cannot stop and always spin.
    i don’t know how to fix it. and i don’t know where the error, it’s in
    the servo or another part problem.

  3. hi, i hack micro servo for my mobile robot. but something error with the rotation. it cannot stop, and if i command it in arduino to move forward, the left and the right servo move different direction. i dont know why it this happen, can you helping me?

  4. I have an application that requires a gearmotor to run in one direction only, at a single continuous speed, with no angle control. Just a simple on/off control. Is it possible to apply a fixed DC voltage directly to one of these hacked units, without controlling the pulse width, like a DC can motor? Or do they operate more like a stepper motor, requiring pulses to be properly aligned for the device to rotate at all?

  5. With a normal servo, you can control angle but not speed. With a continuous rotation servo, you can control speed, but you give up the ability to set its angle. In both cases, you send it a varying pulse-width. In one case that pulse width is interpreted as an angle, the other, speed.

  6. i have servo continuous, and i want to control speed servo motor, and i don’t care about position!! how i can do it?
    please
    thank’s

  7. I want to use a continuous servo but I want angle control. Is there any possibility?

  8. thanks for your tutorial. i just rebuilded two hxt500. i only had 1k or 4 k resistors, so i took the 4k. they work great!

  9. Hi Enrico,
    The “0.12 secs / 60 degrees” is a measure of how fast the servo moves. That is, for it to move 60 degrees, it takes 0.12 seconds. Different servos have different speed attributes, but they all have the same control pulse signaling.

    The control pulse is a pulse of around 1000 microseconds to 2000 microseconds, 50 times a second. That’s the same as saying a 1 millisecond to 2 millisecond pulse every 20 milliseconds. Some servos can move more with a pulse shorter than 1000 microseconds or greater than 2000 microseconds; it depends on the servo.

    Where ever you read about that .24 second pulse is wrong.

    If you have an Arduino, you should check out some of the Arduino servo tutorial sketches, like this one:
    http://arduino.cc/en/Tutorial/Sweep

  10. Hi *, the how-to is nice ;)
    I have some questions because I’m in trouble with my servo.

    I have an “ec-power sg90” servo http://www.ecpower.com.hk/index.php?main_page=product_info&cPath=67&products_id=205 and I’m not so sure I know how to read the specs.

    They say: 0.12 seconds/60 degrees
    Does it mean that the servo can turn from 0 degree-angle to 60 degree-angle where a 0.12 second pulse cause the servo to turn the shaft at the 60° position?

    Reading some code on the web from people that have a servo with .24 sec/xx degrees I see that they use the .24 second pulse as the pulse for the xx degrees (maximum angle), so in my example I set the min to 600 ms and max to 1200 ms but trying some code on Arduino I discover that the servo can turn continuously (360°) by sending it a pulse long 600 ms every 20 ms, but if I try to move the servo from 0° to 180° using the standard servo library it wouldn’t move more than 60°.

    Can someone explain why the servo will move continuously by always sending it the 600 ms (0° angle i guess) pulse?

    Thanks in advance and sorry for my bad english.
    Cheers, Enrico

  11. Tod, you killed me with your use of the phrase “these big, huge, honkin’ things”. :) Great post, I’ve gotta get some of those tiny servos.

Leave a Reply

Your email address will not be published. Required fields are marked *