How do you feel about this article? Help us to provide better content for you.
Thank you! Your feedback has been received.
There was a problem submitting your feedback, please try again later.
What do you think of this article?
A simple ‘walking’ robot based on just four joints motorised with standard RC servos. It doesn’t emulate a human gait, but it still moves about on two legs.
The RC Servo or Hobby Servo has been used to move the control surfaces of Radio-Control (RC) model aircraft for many years. It has since become very popular for driving the limb joints of small humanoid robots, and when converted for continuous rotation, the wheels of mobile robots. However, some features optimal for aircraft control are less than ideal for robots. First, let’s get the terminology straight:
- The term Servo is short for Servomechanism, a device that uses internal feedback to ensure that its mechanical output follows an input control setting. That’s what I’m talking about here.
- A servo motor is the source of motion in a servomechanism, in this case, a small PMDC motor.
- A Servomotor is usually a PMDC motor optimised for use in a servomechanism, perhaps featuring rapid acceleration and built-in feedback sensors. They tend to cost a lot of money are definitely not found in hobby servos!
These definitions are important, particularly when searching for suitable devices on the Internet. Use the search term ‘rc servo’.
This type of servo has a rotary output, but the shaft can only rotate a maximum of half a turn or 180°. With a lever called a ‘horn’ attached to the output shaft it can provide a linear push-pull action, hence its original purpose as an actuator for the flight controls of a model aircraft. Outwardly, all ‘standard’ size hobby servos look the same: a rectangular black plastic or alloy box with two sets of fixing lugs, a 3-wire flat cable connection with 0.1in pitch socket header, and a splined output shaft protruding from one side. The original standard size, for exampledesigned for fairly large radio-control model aircraft with IC engines, now sits alongside more compact versions termed ‘Mini’, ‘Micro’ and ‘Sub-Micro’. For really heavy applications there are sizes even larger than the standard.
All analogue servos are controlled in the same way: angular position is encoded in a constant repetition rate (50Hz) pulse train where the width of a pulse carries the information. A pulse width of 1ms corresponds to maximum anticlockwise while 2ms turns the servo to the maximum clockwise position. It’s often assumed that a servo will turn through 180° with these numbers, but that is usually not the case (see later).
Inside an RC Servo
All RC servos have the same basic internal format (Fig.1): a box containing a DC motor, a compact reduction geartrain and a circuit board.
This is usually incredibly weedy and cheap-looking because it has to fit into the case with a whole lot of other components. Fortunately, the gearbox which is necessary to reduce its rotational speed from about 6000rpm to an output in the region of 30rpm, also multiplies the torque available by the same factor.
A lot of gears have to be crammed in to achieve a reduction factor of about 180:1. Of course, the output shaft cannot rotate more than half a turn, so datasheets normally describe servo speed in terms of how long it takes to turn by 60°. For example, a typical figure might be 0.15 secs/60°. That rapid movement could be a problem when using servos to drive the joints of a legged robot. It does tend to make it lurch about like a mechanical toy but is easily solved by ensuring that movement from one angle to another doesn’t take place in one go. Instead, incremental changes in the PWM signal are made, each separated by a short delay until the target angle is reached.
All RC servos will deliver an impressive amount of torque thanks to the gears - even the Minis and Micros. A standard ‘power’ servo can have a torque figure of around 170N.cm measured at a distance of 1cm along the servo horn. That means, in theory, the servo can hold a weight of over 17kg hanging 1cm away from the output shaft. In practice, a basic low-cost servo with nylon gears and no proper shaft bearings is unlikely to last very long if asked repeatedly to apply its theoretical maximum torque. Load up a servo too heavily and you will soon hear the crunching sound of stripping gear teeth. For robust applications, servo manufacturers make more expensive versions of their products with metal (brass) gears and ball-bearings on the output shaft. Metal gears certainly won’t break easily, but they will wear, ultimately rendering the servo inaccurate due to all the ‘slop’ in the geartrain. They also add to the overall weight, and the increase in geartrain inertia slows the servo’s response to a change. Nylon gears might break if mistreated, but wear is negligible. Servos with gears made from an enhanced plastic formulation called Karbonite are now available offering light-weight, high-strength and long-life – at a price.
For a robot project, it’s very important to select servos with a good margin of torque. I have a toy/educational robot arm driven by mini-servos that’s prone to emitting loud buzzing noises and thrashing about wildly. I’m pretty sure the motors are not up to the task, load-wise.
It’s the electronics that turns a motor-gearbox set into a servomechanism with an operating principle based on feedback control. A potentiometer turned by the output shaft sets the pulse duration of a monostable triggered by the input control pulse. The two pulses are compared and the difference in duration between them provides an error signal to the motor driver circuit. The longer the error pulse, the faster the motor turns, slowing down as the error shrinks until it stops when the error reaches zero. Actually, the motor drive is cut off when a certain minimum error pulse width is achieved, introducing a short ‘deadband’ zone around the target position. The deadband stops the motor jittering once it has stopped, assuming any load has been removed. It must be remembered that with this type of servo, there is no ‘holding force’ applied once the target angle is reached. It means they are not very good for lifting weights and holding position against the force of gravity. They work best with horizontal applications, for example, moving a locking bolt backwards and forwards to unlock and lock a house door. Residual load will cause the motor to keep starting and stopping as it moves in and out of the deadband trying to hold position. This has two consequences: an annoying buzzing sound/vibration, and ultimately the motor windings burning out due to the high stall current flowing. It’s something to be borne in mind when designing a legged robot: make sure the servos are not under heavy load when it’s stationary.
Until recently, the circuits in an RC servo were always analogue; digital servos are available now with a microcontroller doing most of the processing. Going digital improves speed and accuracy by working with a higher PWM frequency: 300Hz, up from the original 50Hz. Digital servos are also faster to react because the microcontroller can drive the motor at high-speed right to the target angle, rather than ramping down to a stop. The downside is a potential drop in reliability by siting a complex digital chip right next to a major source of electrical interference: a PMDC motor!
The format of the control signal which determines the servo position is shown in Fig.2. It may seem over-complicated; why not after all, just use a variable voltage? What we have here is a method of encoding data called Pulse Width Modulation (PWM) used to modulate a Radio Frequency (RF) carrier for a wireless communications link. It all comes back to the original application for the hobby servo – radio-controlled model aircraft. Perhaps confusingly, PMDC motors can be driven directly by a PWM format signal with the pulse-width determining the motor speed. See my article ‘Spinning the Wheels’ for more information.
Earlier I suggested that the output shaft of an RC servo will turn through 180°, but as you can see from Fig.2, the standard pulse width limits of 1 and 2ms only give you about 120°. This seems to be the rule with all the servos I’ve tested and while it may be OK for moving a model aircraft control surface, it could be a handicap for a humanoid robot. Fortunately, by reducing the minimum pulse width to 0.6ms and increasing the maximum to 2.4ms, we can get the full half-turn. This usually works, but no doubt it won’t with some products, so check before purchase. Some of the new digital servos on the market can be programmed for either range.
Most microcontroller chips contain hardware ‘count-capture’ modules that can be programmed to generate PWM signals with no processor overhead. Or there are expansion boards available such as the Kitronik 16-channel modulefor the BBC Micro:Bit and the MikroElektronika 16-channel Click module for anything with a MikroBus socket. Both these modules generate the PWM on-board and communicate with the host microcontroller via an I2C serial bus link. The Pmod CON3 is a simple 4-channel adapter that needs to be connected to host-generated PWM signals.
Nearly all RC servos use a 3-wire flat cable terminated with a plug that fits over a 3-pin 0.1in PCB header. The three signals are Control input, DC power and Ground (Fig.2); wire colours vary between manufacturers, but the format is the same: the power supply +V is always in the middle. There is no polarising key so no matter which way it’s plugged in, +V is correctly connected!
RC servo datasheets often quote values for torque and speed at two different power supply voltages. These are usually +4.8 and +6.0 volts corresponding to the power packs found in model aircraft containing four or five 1.2 volt NiCd rechargeable batteries. The +5 volt logic supply of a robot application will normally be adequate for one or two servos, but a separate supply will be needed for any more. When a servo is holding position under load, its DC motor is drawing a stall current of perhaps 500mA or more, and digital chips sharing the supply are vulnerable to glitches caused by sudden current surges.
Some years ago, a bright spark decided that a servo contained all the elements of a mobility system for a wheeled robot: motor and a geartrain in a compact package with a speed/direction control signal that could be driven directly from a microcontroller GPIO pin. The slight snag was that the internal potentiometer limited wheel rotation to less than one revolution. The solution was easy: remove the pot, replace it with a trim-pot which can be adjusted through a hole drilled in the casing, and finally cut off the bump-stop on the final gear which prevents full rotation. ‘Modified’ servos became very popular with robot makers and since then most suppliers list Continuous Rotation products in their catalogues, for example, Parallax.
The PWM signal now determines speed and direction of rotation rather than angular position: 1ms selects maximum speed anticlockwise, 1.5ms stops the motor and 2ms gives maximum speed clockwise. That trim-pot is adjusted when your robot is ready for its first run to ensure that it doesn’t move when a 1.5ms pulse is applied.
Another oddity with servo specifications is the apparent importance attached to physical weight. So, you might see a micro-servo weighing 20 gm labelled as a ‘20g servo’ or a standard as a 50g. Not very important to the robot builder perhaps, but vital information for the model aircraft enthusiast.
If you're stuck for something to do, follow my posts on Twitter. I link to interesting articles on new electronics and related technologies, retweeting posts I spot about robots, space exploration and other issues.