ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

The Infrared Remote, A Tool For The Lazy  
Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.
RESOURCE PAGES
c50r40g4.gif (3024 bytes)
A Guide for Online Information About:

Servo Control

by Rick Prescott

Part: 1 2

Hobby servos are an integral part of just about any robotic or animatronic application. There are literally hundreds of uses for a high torque motor that can be rapidly (and accurately) positioned within a 180ý field of motion. Unfortunately, hobby servos have the side-effect of requiring precise timing signals (used to position the motor) that are a bit more difficult to produce than a simple on/off signal. (more)

A typical R/C servo is the Futaba S148. This servo looks like a rectangular box with a motor shaft coming out of one end and a connector with three wires out of the other end. Attached to the motor shaft is usually (but not always) a "control horn." This is a plastic piece with holes in it for attaching push rods or other mechanical linkages to the servo. The three wires are V+, control, and ground. R/C servos typically run on 4.8 V (four NiCd batteries), but they often work with voltages between 4 and 6 V. The control line is used to position the servo. In an R/C model, this line it attached to the radio receiver, and on robots it is usually attached to the processor. (more)

What's Inside the Case?
A servo consists of a small motor, a gearset, a feedback potentiometer (variable resistor), and some control electronics. The motor spins at variable speeds (much faster than the output shaft) and is coupled to a (reduction) gearset that converts the motor's high speed into something that is more usable for your purpose. When you reduce the motor's speed through a reduction gearset, you gain torque. Torque is the twisting power of the servo. The more torque, the heavier the object the servo can move. (More)

How They Work
A servo is a classic example of a closed-loop feedback system. The potentiometer is coupled to the output gear. Its resistance is proportional to the position of the servo's output shaft (0ý to 180ý). This resistance is used by the control electronics to generate an error signal when the desired position isn't the same as the current position. If you send a servo a command to place itself at 90ý and the head is at 45ý, an error signal will cause the motor to move the head (via the gears) until the error signal is 0 (when the head has reached 90ý). If the head had been at 180ý, an error signal of opposite polarity would have been generated and the motor would have turned in the opposite direction to bring the head back to 90ý. As you can see, the current position is fed-back to the control system in a loop to maintain a zero error signal. The farther the actual position from the desired position, the faster the motor turns to bring the error back to zero. (More)

How are They Controlled?
Servos have three wires coming out of them—power, ground, and control. The control lead is used to send the positioning signal I'm going to talk about. Servos are controlled using a system called pulse code modulation (PCM). In order to understand this, you need to understand the terms milliseconds(ms) and microseconds(ýs). One ms is 1/1000th of a second, or put another way, there are 1000 ms in every second. One ýs is 1/1,000,000th (one-one millionth) of a second, or there are 1 million ýs in each second. Servo manufacturers usually specify pulse-widths in ýs, so its hands are able to convert between ýs and ms. The servo's electronics work in 20-ms blocks (50 of them every second). For each 20-ms block, the servo needs to see a positive-going pulse who's period (width in ms) tells it where to position the head (output shaft).

The period of the pulse that is sent determines where to place the head (0ý to 180ý). Different servo manufacturers require different pulse-widths, so you have to experiment a little to find the pulse-widths that correspond to each position. For example, the Futaba servo sold by HVW Technologies has a 90ý position (middle) pulse-width of about 1.5 ms. This means that if you send a 1.5-ms pulse to the servo at least once every 20 ms, the servo will move to, and hold at, its 90ý position. If you try to turn the head with your hand, you will feel the servo forcing against you, trying to keep the 90ý position.

In practice, you can send pulses more often that once every 20 ms. You can send them less often as well, but if you don't send any pulses for about 50 ms , the control electronics in the servo will "go to sleep" (enter power-saving mode). Don't forget, servos were designed for R/C airplanes and cars, where battery life is important. When a servo powers-down, it no longer works against an applied force to maintain its position. You'll find that even then the head is fairly difficult to turn. (more)

Continuous Rotation
For many applications, modified servos make excellent drive wheels for mobile robots. But, how do you get them to keep going around instead of stopping at 180ý? There are a couple of problems:

• The feed-back loop: the servos' head gear is connected to the feed-back potentiometer, so it can track the head's position and feed-back this information to the control electronics. The potentiometer has a finite resistance—it can't keep increasing with successive rotations of the head gear.

•ý Mechanical stop: the head gear has a little plastic tab on it that hits other plastic tabs on the servo's case at the 0ý and 180ý positions. This tab stops the head from going all the way around.

Solution ? Make the servo think that its head is always at the 90ý (middle) point and cut off the plastic tab. There are two ways to do this (see below). When you give it a command to go to 0ý, the control circuitry will see that the head is at 90ý and will turn the motor on to try and bring the head to 0ý. What happens though is that because the resistance isn't changing as the head moves, the control system will keep the motor on indefinitely. Telling the servo to go to 180ý, will cause the motor to spin (indefinitely) in the opposite direction. The tab no longer mechanically stops the head. Presto ! A nifty little gearmotor. (more)

As mentioned above, there are two ways to make the servo think its head is always at 90ý:

• Method 1: remove the potentiometer and replace it with two resistors whos values match the "center" resistance of the potentiometer

• Method 2: leave the potentiometer in, but stop it from turning with the head gear

Click here for instructions on how to modify (Method 2) the Futaba FP-S148 for continuous rotation.

Servo Circuits
Servos have their own proprietary circuitry built inside the servo case. This circuitry consists of a pulse width comparator, which compares the incoming signal from the receiver with a one-shot timer whose period depends on the resistance of a potentiometer connected to the servo's drive shaft. This feedback is what provides the stability for the control circuitry. The difference between the control signal and the feedback signal is the error signal. This error signal is used to control a flip-flop that toggles the direction the current flows through the motor. The outputs of the flip-flop drive an H-bridge circuit that handles the high current going through the motor.

If you were going to try to build a circuit to take a PWM signal and convert it to a motor position, you'd probably end up with a fairly large circuit. A microcontroller would do the job, but if you can't program, you're back to square one.

Thankfully there is a chip available which does the work for you. The M51660L servo motor control chip from Mitsubishi contains all the electronics needed to decode the signal and control a motor.

All you supply are two PNP transistors for the upper half of the H-bridge and a handful of resistors and capacitors. A complete circuit is given on the second last page of their datasheet.

If you don't have a radio transmitter and receiver handy, you won't have any way of generating the control signal for the servo. A simple circuit using a 555 timer chip can generate the needed signal.

The equations for the 555 timer are simple and easy to use. They are as follows:

THIGH = 0.693(R1 + R2)C
TLOW = 0.693(R3)C

Because R2 is variable, the time the signal is high will vary from 0.693(10k + 10k)0.15e – 6 = 2.079 mS to 0.693(10k + 0)0.15e – 6 = 1.039 mS.

The time the signal is low is equal to 0.693(390k)0.15e – 6 = 40.54 mS.

The diode is there to bypass resistor R3 during the THIGH charging phase. The timing values are close enough to work with just about any servo. If you want exact timings, you can replace resistor R1 with a trimmer potentiometer. (more)

NEXT



I am always looking for more material about interesting subjects. If you would like to share more information about robotics or would like to see a Resource Page on a particular topic, contact me,
Rick Prescott.


Circuit Cellar provides up to date information for engineers, www.circuitcellar.com for more information and additional articles.
©Circuit Cellar, the Magazine for Computer Applications. Posted with permission. For subscription information, call (860) 875-2199 or e-mail subscribe@circuitcellar.com

 

Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ