CHAPTER 22

WORKING WITH
SERVO MOTORS
DC and stepper motors are inherently open feedback systems—you provide electricity and they spin. How much they spin is not always known, not even for a stepper motor, which turns by finite degrees based on the number of pulses it gets. Should something impede the rotation of the motor it may not turn at all, but there’s no easy, built-in way that the control electronics would know that.
Servo motors, on the other hand, are designed for closed feedback systems. The output of the motor is coupled to a control circuit; as the motor turns, its speed and/or position are relayed to the control circuit. If the rotation of the motor is impeded for whatever reason, the feedback mechanism senses that the output of the motor is not yet in the desired location. The control circuit continues to correct the error until the motor finally reaches its proper point.
Servo motors come in various shapes and sizes. Some are smaller than a walnut, while others are large enough to take up their own seat in your car. They’re used for everything from controlling computer-operated lathes to copy machines to model airplanes and cars. It’s the last application that is of most interest to hobby robot builders: the same servo motors used with model airplanes and cars can readily be used with your robot.
These servo motors are designed to be operated via a radio-controlled link and so are commonly referred to as radio-controlled (or R/C) servos. But in fact the servo motor itself is not what is radio-controlled; it is merely connected to a radio receiver on the plane or car. The servo takes its signals from the receiver. This means you don’t have to control your robot via radio signals just to use an R/C servo—unless you want to, of course. You can control a servo with your PC, a microcontroller such as the BASIC Stamp, or even a simple circuit designed around the familiar 555 timer integrated circuit.
In this chapter R/C servos will be presented along with how they can be put to use in a robot. While there are other types of servo motors, it is the R/C type that is commonly available and reasonably affordable. For simplicity’s sake, when you see the term servo in the text that follows understand that it specifically means an R/C servo motor, even though there are other types.
Fig. 22-1 shows a typical standard-sized R/C servo motor, which is used with flyable model airplanes and model racing cars. The size and mounting of a standard servo is the same regardless of the manufacturer, which means that you have your pick of a variety of makers. Along with the standard-sized servor, there are other common sizes of servo motors also available, which will be discussed later in the chapter.
images
Inside the servo is a motor, a series of gears to reduce the speed of the motor, a control board, and a potentiometer (see Fig. 22-2). The motor and potentiometer are connected to the control board, all three of which form a closed feedback loop. Both control board and motor are powered by a constant DC voltage (usually between 4.8 and 6.0 V, although many will work with power inputs up to 7.2 V).

images
To turn the motor, a digital signal is sent to the control board. This activates the motor, which, through a series of gears, is connected to the potentiometer. The position of the potentiometer’s shaft indicates the position of the output shaft of the servo. When the potentiometer has reached the desired position, the control board shuts down the motor.
As you can surmise, servo motors are designed for limited rotation rather than for continuous rotation like a DC or stepper motor. While it is possible to modify an R/C servo to rotate continuously (as discussed later in this chapter), the primary use of the R/C servo is to achieve accurate rotational positioning over a range of 90° or 180°. While this may not sound like much, in actuality such control can be used to steer a robot, move legs up and down, rotate a sensor to scan the room, and more. The precise angular rotation of a servo in response to a specific digital signal has enormous uses in all fields of robotics.
The motor shaft of an R/C servo is positioned by using pulse width modulation (PWM). In this system, the servo responds to the duration of a steady stream of digital pulses (Fig. 22-3). Specifically, the control board responds to a digital signal whose pulses vary from about 1 ms (one-thousandth of a second) to about 2 ms. These pulses are sent some 50 times per second. The exact length of the pulse, in fractions of a millisecond, determines the position of the servo. Some servos are very tolerant of varying PWM periods, while others will not work properly or “jitter” if the pulses come at anything other than 50 times per second. To be on the safe side, always try to maintain 20 ms between the start servo control pulses.
images
At a duration of 1 ms, the servo is commanded to turn all the way in one direction (for example counterclockwise). At 2 ms, the servo is commanded to turn all the way in the other direction. Therefore, at 1.5 ms, the servo is commanded to turn to its center (or neutral) position. As mentioned earlier, the angular position of the servo is determined by the width (more precisely, the duration) of the pulse. This technique has gone by many names over the years. One you may have heard of is digital proportional—the movement of the servo is proportional to the digital signal being fed into it.
The power delivered to the motor inside the servo is also proportional to the difference between where the output shaft is and where it’s supposed to be. If the servo has only a little way to move to its new location, then the motor is driven at a fairly low speed. This ensures that the motor doesn’t overshoot its intended position. But if the servo has a long way to move to its new location, then it’s driven at full speed in order to get there as fast as possible. As the output of the servo approaches its desired new position, the motor slows down. What seems like a complicated process actually happens in a very short period of time—the average servo can rotate a full 60° in a quarter to half second.
images
The control circuit in the servo correlates this voltage with the timing of the incoming digital pulses and generates an error signal if the voltage is wrong. This error signal is proportional to the difference between the position of the potentiometer and the timing of the incoming signal. To compensate, the control board applies the error signal to turn the motor. When the voltage from the potentiometer and the timing of the digital pulses match, the error signal is removed, and the motor stops.
Servos also vary by the amount of rotation they will perform for the 1 to 2 ms signal they are provided. Most standard servos are designed to rotate back and forth by 90° to 180°, given the full range of timing pulses. You’ll find the majority of servos will be able to turn a full 180°, or very nearly so. Should you attempt to command a servo beyond its mechanical limits, the output shaft of the motor will hit an internal stop. This causes the gears of the servo to grind or chatter. If left this way for more than a few seconds, the gears of the motor or the motor itself and its drivers may be permanently damaged. Therefore, when experimenting with servo motors exercise care to avoid pushing them beyond their natural limits.
The actual length of the pulses is fairly constant at 1 to 2 ms for most manufacturers’ products, but it should be noted that the Futaba brand and servos that are compatible have a 1 to 1.5 ms pulse width. There can be a problem with passing a 2 ms pulse to a Futaba servo if the pulse causes the servo to push against its stop (potentially damaging the servo). Rather than experimenting on an unknown servo with 1 to 2 ms pulses, you should start with 1 to 1.5 ms pulses and raise the pulse width to 2 ms if the servo only turns 45 degrees.
While the standard-sized servo is the one most commonly used in both robotics and radio-controlled models, other R/C servo types, styles, and sizes exist as well.
  • Quarter-scale (or large-scale) servos are about twice the size of standard servos and are significantly more powerful. Quarter-scale servos are designed to be used in large model airplanes, but they also make perfect power motors for a robot.
  • Mini-micro servos are about half the size (and smaller!) of standard servos and are designed to be used in tight spaces in a model airplane or car. They aren’t as strong as standard servos, however.
  • Sail winch servos are designed with maximum strength in mind, and are primarily intended to move the jib and mainsail sheets on a model sailboat.
  • Landing-gear retraction servos are made to retract the landing gear of medium- and large-sized model airplanes. The design of the landing gear often requires the servo to guarantee at least 170° rotation, if not more (i.e., up to and exceeding 360° of motion). It is not uncommon for retraction servos to have a slimmer profile than the standard variety because of the limited space on model airplanes.
The motor inside an R/C servo turns at several thousand r/min. This is too fast to be used directly on model airplanes and cars, or on robots. All servos employ a gear train that reduces the output of the motor to the equivalent of about 50 to 100 r/min. Servo gears can be made of plastic, nylon, or metal (usually brass or aluminum).
Metal gears last the longest, but they significantly raise the cost of the servo. Replacement gear sets are available for many servos, particularly the medium- to higher-priced ones ($20+). Should one or more gears fail, the servo can be disassembled and the gears replaced. In some cases, you can upgrade the plastic gears in a less expensive servo to higher-quality metal ones.
Besides the drive gears, the output shaft of the servo receives the most wear and tear. On the least expensive servos this shaft is supported by a plastic bearing, which obviously can wear out very quickly if the servo is used heavily. Actually, this piece is not a bearing at all but a bushing, a sleeve or collar that supports the shaft against the casing of the servo. Metal bushings, typically made from lubricant-impregnated brass, last longer but add to the cost of the servo. The best (and most expensive) servos come equipped with ball bearings, which provide longest life. Ball bearing upgrades are available for some servo models.
R/C servo motors enjoy some standardization. This sameness applies primarily to standard-sized servos, which measure approximately 1.6 by 0.8 by 1.4 in. For other servo types the size varies somewhat between makers, as these are designed for specialized tasks.
Table 22.1 outlines typical specifications for several types of servos, including dimensions, weight, torque, and transit time. Of course, except for the size of standard servos, these specifications can vary between brand and model. A few of the terms used in the specs require extra discussion. As explained in Chapter 19, “Choosing the Right Motor,” the torque of the motor is the amount of force it exerts. The standard torque unit of measure for R/C servos is expressed in ounce-inches—or the number of ounces the servo can lift when the weight is extended 1 in from the shaft of the motor. Servos exhibit very high torque thanks to their speed reduction gear trains.
TABLE 22-1   Typical Servo Specifications
table

The transit time (also called slew rate) is the approximate time it takes for the servo to rotate the shaft X° (usually specified as 60°). Small servos turn at about a quarter of a second per 60°, while larger servos tend to be a bit slower. The faster the transit time, the faster acting the servo will be.
You can calculate equivalent r/min by multiplying the 60° transit time by 6 (to get full 360° rotation), then dividing the result into 60. For example, if a servo motor has a 60° transit time of 0.20 s, that’s one revolution in 1.2 s (0.2 × 6 = 1.2), or 50 r/min (60 / 1.2 = 50).
Bear in mind that there are variations on the standard themes for all R/C servo classes. For example, standard servos are available in more expensive high-speed and high-torque versions. Servo manufacturers list the specifications for each model, so you can compare and make the best choice based on your particular needs.
Many R/C servos are designed for use in special applications, and these applications can be adapted to robots. For example, a servo engineered to be used with a model sailboat will be water resistant and therefore useful on a robot that works in or around water.
While many aspects of servos are standardized, there is much variety between manufacturers in the shape and electrical contacts of the connectors used to attach the servo to a receiver. Despite this diversity, you will find that you can usually connect servos to three standard 0.100" connector posts either soldered into a PCB or pressed into a breadboard. You may decide the connector issue isn't worth the hassle, and just cut it off from the servo, hardwiring it to your electronics. This is an acceptable alternative, but hardwiring makes it more difficult to replace the servo should it ever fail.
There are three primary connector types found on R/C servos:
  • “J” or Futaba style
  • “A” or Airtronics style
  • “S” or Hitec/JR style
Servos made by the principle servo manufacturers—Futaba, Airtronics, Hitec, and JR—employ the connector style popularized by that manufacturer. In addition, servos made by competing manufacturers are usually available in a variety of connector styles, and connector adapters are available.
images
TABLE 22-2   Connector Pinouts of Popular Servo Brands
table

Most servos use color coding to indicate the function of each connection wire, but the actual colors used for the wires vary between servo makers. Table Fig. 22-3 lists the most common colors used in several popular brands, but chances are you will be right if you assume that red is positive voltage, black is negative, and the third wire is the signal.
TABLE 22-3   Color Coding of Popular Servo Brands
table
Unlike a DC motor, which runs if you simply attach battery power to its leads, a servo motor requires proper interface electronics in order to rotate its output shaft. While the need for interface electronics may complicate to some degree your use of servos, the electronics are actually rather simple. And if you plan on operating your servos with a PC or microcontroller (such as the BASIC Stamp), all you need for the job is a few lines of software.
A DC motor typically needs power transistors, MOSFETs, or relays if it is interfaced to a computer. A servo on the other hand can be directly coupled to a PC or microcontroller with no additional electronics. All of the power-handling needs are taken care of by the control board in the servo, saving you the hassle. This is one of the key benefits of using servos with computer-controlled robots.
images
 
IC1
556 timer chip
Pot
100k single turn potentiometer
R2, R3
100k resistor
R1
2.7M resistor
C1–C4
0.01 μF capacitors (any type)
Bat
4× AA battery clip
Misc.
Circuit breadboard, wiring, servo connector header
With a little bit of thought to the software, a BASIC Stamp 2 can be used to control one or more servos as well as have enough time left over to poll inputs and determine what is the appropriate next action. Fig. 22-7 shows the hookup diagram for connecting a standard servo to the BS2. It is very important to note that the power to the servo does not come from the BS2, or any prototyping board it is on. Servos require more current than the power supply on the Stamp can provide. A pack of four AA batteries is sufficient to power the servo. For proper operation ensure that the grounds are connected between the Stamp and the battery pack. Use a 33 to 47 μF capacitor between the +V and ground of the AA pack to help kill any noise that may be induced into the electronics when the servo turns on and off.
images
The following application sends the appropriate pulses to a servo for 1s and then polls the user (using the DEBUG and DEBUGIN console interface statements) to enter in a value that is passed to the servo. The reason why the application is called calibrate is due to its use as a method to find the correct stop pulse length for a servo modified for continuous rotation (described in the following).
'Calibrate   –   Find the Center/Not Moving Point for Servo
'{$STAMP BS2}
'{$PBASIC 2.50}
images
R/C receivers are designed with a maximum of eight servos in mind. The receiver gets a digital pulse train from the transmitter, beginning with a long sync pulse, followed by as many as eight servo pulses. Each pulse is meant for a given servo attached to the receiver: pulse 1 goes to servo 1, pulse 2 goes to servo 2, and so on. The eight pulses plus the sync pulse take about 20 ms. This means the pulse train can be repeated 50 times each second, which is its refresh rate. As the refresh rate gets slower the servos aren’t updated as quickly and can throb or lose position as a result.
The main benefit of dedicated servo controllers is that a great number of servos can be commanded simultaneously, even if your computer, microcontroller, or other circuitry is not multitasking. For example, suppose your robot requires 24 servos. Say it’s an eight-legged spider, and each leg has three servos; each servo controls a different “degree of freedom” of the leg. One approach would be to divide the work among three servo controllers, each capable of handling eight servos. Each controller would be responsible for a given degree of freedom. One might handle the rotation of all eight legs; another might handle the flexion of the legs; and the third might be for the rotation of the bottom leg segment.
Dedicated servo controllers must be used with a computer or microcontroller, as they need to be provided with real-time data in order to operate (commonly sent in a serial data format). A sequence of bytes sent from the computer or microcontroller is decoded by the servo controller, with each byte corresponding to a servo attached to it. Servo controllers typically come with application notes and sample programs for popular computers and microcontrollers, but to make sure things work it’s very helpful to have a knowledge of programming and serial communications.
Servos are designed to be used with rechargeable model R/C battery packs, which normally put out 4.8 V or four AA alkaline battery packs (which put out approximately 6 V). As the batteries drain the voltage will drop, and you will notice your servos won’t be as fast as they used to be. Somewhere below about 4.5 V the servos stop being responsive. Similarly, while servos may work with power supplies greater than 6 V, you cannot count on it and you will find that at some point you will burn out their control electronics or even their motors.
Ideally, your servo power supply should be monitored to ensure that the voltage stays within the range of 4.5 and 6 V. This may mean that the servos in a particular robot will require their own power supply or battery pack, but by ensuring the correct voltage is applied to them, they can be assumed to work properly for their full lives.
References to the Grateful Dead notwithstanding, all servos exhibit what’s known as a dead band. The dead band of a servo is the maximum time differential between the incoming control signal and the internal reference signal produced by the position of the potentiometer. If the time difference equates to less than the dead band—say, 5 or 6 ms—the servo will not bother trying to nudge the motor to correct for the error.
Without the dead band, the servo would constantly hunt back and forth to find the exact match between the incoming signal and its own internal reference signal. The dead band allows the servo to minimize this hunting so it will settle down to a position close to, though maybe not exactly, where it’s supposed to be.
The dead band varies between servos and is often listed as part of the servo’s specifications. A typical dead band is 5 μs. If the servo has a full travel of 180° over a 1000 μs (1 to 2 ms) range, then the 5 μs dead band equates to 1 part in 200. You probably won’t even notice the effects of dead band if your control circuitry has a resolution lower than the dead band.
However, if your control circuitry has a resolution higher than the dead band (which is the case with a microcontroller such as the BASIC Stamp 2 or the Motorola MC68HC11) then small changes in the pulse width values may not produce any effect. For instance, if the controller has a resolution of 2 μs and if the servo has a dead band of 5 μs, then a change of just one or even two values—equal to a change of 2 or 4 μs in the pulse width—may not have an effect on the servo.
The bottom line: choose a servo that has a narrow dead band if you need accuracy and if your control circuitry or programming environment has sufficient resolution. Otherwise, ignore the dead band since it probably won’t matter one way or another. The trade-off here is that with a narrow dead band the servo will be more prone to hunt to its position and may even buzz after it has found it.
You’ve already read that the typical servo responds to signals from 1 to 2 ms. While this is true in theory, in actual practice many servos can be fed higher and lower pulse values in order to maximize their rotational limits. The 1 to 2 ms range may indeed turn a servo one direction or another, but it may not turn it all the way in both directions. However, you won’t know the absolute minimums and maximums for a given servo until you experiment with it. Take fair warning: performing this experiment can be risky because operating a servo to its extreme can cause the mechanism to hit its internal stops. As noted earlier in this chapter, if left in this state for any period of time, the gears and electronics of the servo can become damaged.
If you just must have maximum rotation from your servo, connect it to your choice of control circuitry. Start by varying the pulse width in small increments below 1 ms (1000 μs), say in 10 μs chunks. After each additional increment, have your control program swing the servo back to its center or neutral position. When during your testing you hear the servo hit its internal stop (the servo will chatter as the gears slip), you’ve found the absolute lower-bound value for that servo. Repeat the process for the upper bound. It’s not unusual for some servos to have a lower bound of perhaps 250 μs and an upper bound of over 2200 μs. Yet other servos may be so restricted that they cannot even operate over the normal 1 to 2 ms range.
Keep a notebook of the upper and lower operating bounds for each servo in your robot or parts storehouse. Since there can be mechanical differences between servos of the same brand and model, number your servos so you can tell them apart. When it comes time to program them, you can refer to your notes for the lower and upper bounds for that particular servo.
Many brands and models of R/C servos can be readily modified to allow them to rotate continuously, like a regular DC motor. Such modified servos can be used as drive motors for your robot. Many modern servos also come with the ability to turn continuously with just the flick of a switch. Servos that can turn continuously can be easier to use than regular DC motors since they already have the power drive electronics built in, they come already geared down, and they are easy to mount on your robot.
Servo modification varies somewhat between makes and models, but the basic steps are the same:
1. Remove the case of the servo to expose the gear train, motor, and potentiometer. This is accomplished by removing the four screws on the back of the servo case and separating the top and bottom.
2. File or cut off the nub on the underside of the output gear that prevents full rotation. This typically means removing one or more gears, so you should be careful not to misplace any parts. If necessary, make a drawing of the gear layout so you can replace things in their proper location!
3. Remove the potentiometer and replace it with two 2.7K-Ω 1 percent tolerance (precision) resistors, wired as shown in Fig. 22-8 This voltage divider circuit “fools” the servo’s control circuitry into thinking it’s always in the center position and will respond by turning the motor any time the incoming PWM is outside the center position (which is found using the calibrate program previously listed). Another approach is to relocate the potentiometer to the outside of the servo case, so that you can make fine-tune adjustments to the center position. If you do this, it is suggested that a multi-turn trimmer potentiometer is used.
4. Reassemble the case.
images
The gears in a servo are lubricated with a white or clear grease. As you remove and replace the gears during your modification surgery, it’s inevitable that some of the grease will come off on your fingers. If you feel too much of the grease has come off, you’ll want to apply more. Most any viscous synthetic grease suitable for electronics equipment will work, though you can also splurge and buy a small tube of grease especially made for servo gears and other mechanical parts in model cars and airplanes.
When applying grease be sure to spread it around so that it gets onto all the mechanical parts of the servo that mesh or rub. However, avoid getting any of it inside the motor or on the electrical parts. Wipe off any excess.
While it may be tempting, don’t apply petroleum-based oil to the gears, such as three-in-one oil or a spray lubricant like WD-40. Some oils may not be compatible with the plastics used in the servo, and spray lubricants aren’t permanent enough.
After reassembly but before connecting the servo to a control circuit, you’ll want to test your handiwork to make sure the output shaft of the servo rotates smoothly. Do this by attaching a control disc or control horn to the output shaft of the servo. Slowly and carefully rotate the disc or horn and note any snags. Don’t spin too quickly, as this will put undo stress on the gears. If you notice any binding while you’re turning the disc or horn, it could mean you didn’t remove enough of the mechanical stop on the output gear. Disassemble the servo just enough to gain access to the output gear and clip or file off some more.
Once you are comfortable with the servo’s ability to turn, you can see how it works using the 556 or BS2 circuits (and software) presented earlier in the chapter.
Modifying a servo typically entails removing or gutting the potentiometer and clipping off any mechanical stops or nubs on the output gear. For all practical purposes, this renders the servo unusable for its intended use, that is, to precisely control the angular position of its output shaft. So, before modifying a servo, be sure it’s what you want to do. It’ll be difficult to reverse the process, and in any case you are voiding its warranty.
Even though a servo has been modified for continuous rotation, the same digital pulses are used to control the motor. Keep the following points in mind when running modified servos:
  • If you’ve used fixed resistors in place of the original potentiometer inside the servo, sending a pulse of about 1.5 ms will stop the motor. Decreasing the pulse width will turn the motor in one direction; increasing the pulse width will turn the motor in the other direction. You will need to experiment (using the calibrate program) with the exact pulse width to find the value that will cause the motor to stop.
  • If you’ve used a replacement 5K potentiometer instead of the original that was inside the servo, you have the ability to set the precise center point that will cause the motor to stop. In your software, you can send a precise 1.5 ms pulse, then adjust the potentiometer until the servo stops. As with fixed resistors, values higher or lower than 1.5 ms will cause the motor to turn one way or another.
Modifying a servo for continual rotation carries with it a few limitations, exceptions, and “gotchas” that you’ll want to keep in mind:
  • The average servo is not engineered for lots and lots of continual use. The mechanics of the servo are likely to wear out after perhaps as little as 25 hours (that’s elapsed time), depending on the amount of load on the servo. Models with metal gears and/or brass bushing or ball bearings will last longer.
  • The control electronics of a servo are made for intermittent duty. Servos used to power a robot across the floor may be used minutes or even hours at a time, and they tend to be under additional mechanical stress because of the weight of the robot. Though this is not exactly common, it is possible to burn out the control circuitry in the servo by overdriving it.
  • Standard-sized servos are not particularly strong in comparison to many other DC motors with gear heads. Don't expect a servo to move a 5- or 10-lb robot. If your robot is heavy, consider using either larger, higher-output servos (such as ¼-scale or sail winch), or DC motors with built-in gear heads.
  • Last and certainly not least, remember that modifying a servo voids its warranty. You’ll want to test the servo before you modify it to ensure that it works.
Another way to modify a servo for continuous rotation is to follow the steps outlined previously and also remove the control circuit board. Your robot then connects directly to the servo motor. You’d use this approach if you don’t want to bother with the pulse width schema. You get a nice, compact DC motor with gearbox attached.
However, since you’ve removed the control board, you will also need to provide adequate power output circuitry to drive the motor. The circuitry built onto the servo PCB was designed for the motor; ideally, you might want to do a bit of probing on the servo PCB to try and figure out what are the components and circuit used in the motor driver so that you can replicate it rather than having to come up with your own circuit.
images
Servos reengineered for full rotation are most often used for robot locomotion and are outfitted with wheels. Since servos are best suited for small- to medium-sized robots (under about 3 lb), the wheels for the robot should ideally be between 2 and 5 in diameter. Larger-diameter wheels make the robot travel faster, but they can weigh more. You won’t want to put extra large 7- or 10-in wheels on your robot if each wheel weighs 1.5 lb. There’s your 3-lb practical limit right there.
The general approach for attaching wheels to servos is to use the round control disc that comes with the servo (see Fig. 22-10). The underside of the disc fits snugly over the output shaft of the servo. You can glue or screw the wheel to the front of the disc. Here are some ideas:
  • Large LEGO balloon tires have a recessed hub that exactly fits the control disc included with Hitec and many other servos. You can simply glue the disc into the rim of the tire.
  • Lightweight foam tires, popular with model airplanes, can be glued or screwed to the control disc. The tires are available in a variety of diameters. If you wish, you can grind down the hub of the tire so it fits smoothly against the control disc.
  • A gear glued or screwed into the control disc can be used as an ersatz wheel or as a gear that drives a wheel mounted on another shaft.
images
In all these cases, it’s important to maintain access to the screw used to secure the control disc to the servo. When you are attaching a wheel or tire be sure not to block the screw hole. If necessary, insert the screw into the control disc first, then glue or otherwise attach the tire. Make sure the hub of the wheel is large enough to accept the diameter of your screwdriver, so you can tighten the screw over the output shaft of the servo.
Servos should be securely mounted to the robot so the motors don’t fall off while the robot is in motion. The following methods do not work well, though they are commonly used:
  • Duct tape or electrical tape. The “goo” on the tape is elastic, and eventually the servo works itself loose. The tape can also leave a sticky residue.
  • Hook-and-loop, otherwise known as Velcro. Accurate alignment of the hook-and-loop halves can be tricky, meaning that every time you remove and replace the servos the wheels are at a slightly different angle with respect to the body of the robot. This makes it harder to program repeatable actions.
  • Tie-wraps. You must cinch the tie-wrap tightly in order to adequately hold the servo in place. Unless your robot is made of metal or strong plastic, you’re bound to distort whatever part of the robot you’ve cinched the wrap against.
Experience shows that hard mounting—gluing, screwing, or bolting—the servos onto the robot body is the best overall solution, and it greatly reduces the frustration level of hobby robotics.
Gluing is a quick and easy way to mount servos on most any robot body material, including heavy cardboard and plastic. Use only a strong glue, such as two-part epoxy or hot-melt glue. When gluing it is important that all surfaces be clean. Rough up the surfaces with a file or heavy-duty sandpaper for better adhesion. If you’re gluing servos to LEGO parts, apply a generous amount so the extra adequately fills between the nubs. LEGO plastic is hard and smooth, so be sure to rough it up first.
A disadvantage of mounting servos with glue is that it’s more or less permanent (and, according to Murphy’s Law, more permanent than you’d like if you want to remove the servo, less permanent if you want the servo to stay in place!). For the greatest measure of flexibility, use screws or bolts to mount your servos to your robot body. All servos have mounting holes in their cases; it’s simply a matter of finding or drilling matching holes in the body of your robot.
Servo mounts are included in many R/C radio transmitters and separately available servo sets. You can also buy them separately from the better-stocked hobby stores. The servo mount has space for one, two, or three servos. The mount has additional mounting holes that you can use to secure it to the side or bottom of your robot. Most servo mounts are made of plastic, so if you need to make additional mounting holes they are easy to drill.
You can also construct your own servo mounting brackets using -in-thick aluminum or plastic. A template is shown in Fig. 22-11. (Note: the template is not to scale, so don't trace it to make your mount. Use the dimensions to fashion your mount to the proper size.)
images
The first step in constructing your own servo mounting brackets is to cut and drill the aluminum or plastic, as shown in Fig. 22-12. Use a small hobby file to smooth off the edges and corners. The mounting hole centers provided in the template are designed to line up with the holes in LEGO Technic beams. This allows you to directly attach the servo mounts to LEGO pieces. Use or nuts and bolts, or self-tapping screws, to attach the servo mount to the LEGO beam.
images
Fig. 22-12    shows a servo mounted on a bracket and attached to a LEGO beam. If necessary, the servos can be easily removed for repair or replacement.