About: Inventor, Author, Head of Innovation, Entrepreneur, Forbes 30 Under 30, 10 Outstanding Young Persons of the World
If you want to learn more, please visit our website.
Servo motors are great devices that can turn to a specified position.
Usually, they have a servo arm that can turn 180 degrees. Using the Arduino, we can tell a servo to go to a specified position and it will go there. As simple as that!
Servo motors were first used in the Remote Control (RC) world, usually to control the steering of RC cars or the flaps on a RC plane. With time, they found their uses in robotics, automation, and of course, the Arduino world.
Here we will see how to connect a servo motor and then how to turn it to different positions.
The first motor I ever connected to an Arduino, seven years ago, was a Servo motor. Nostalgic moment over, back to work!
We will need the following things:
There are few big names in the servo motor world. Hitec and Futaba are the leading RC servo manufacturers. Good places to buy them are Servocity, Sparkfun, and Hobbyking.
This instructable and many more can be found in my Arduino Development Cookbook available here. :D
In contrast, you instruct a servomotor where to turn using carefully-timed pulses. The servo has three wires: power, ground, plus a third wire to carry the command pulses.
An ordinary DC motor has two hookup wires and simply turns continuously when power is applied. If you want it to spin in the opposite direction, you'll need to reverse the power. And if you want to know how far it has turned, you'll need to devise a way to measure that.
Servo motors are an easy way to add motion to your electronics projects. Originally used in remote-controlled cars and airplanes, they now crop up in all sorts of other applications. They're useful because you can precisely control the positioning of these motors. Instruct them where to point, and they'll do it for you.
In the most generic sense, a servomechanism (servo for short) is a device that uses feedback to achieve the desired result. Feedback control is used in many different disciplines, including speed, position, and temperature.
In the context we are discussing here, we are talking about hobby or radio-control servo motors. These are small motors primarily used for steering radio-controlled vehicles. Because the position is easily controllable, they are also useful for robotics and animatronics. However, they shouldnt be confused with other types of servo motors, such as the large ones used in industrial machinery.
An Assortment of Hobby Servos
RC servos are reasonably standardized - they are all a similar shape, with mounting flanges at each end, available in graduated sizes, from "ultra-nano" to "giant". Servos often come with multiple attachments, such as wheels or levers, known as horns, than can be attached to the shaft, to fit the device they are operating.
Example Servo Horns
Most hobby servos use a standard type of 3-pin plug, with the same control signaling, which makes RC servos reasonably interchangeable.
The connector is a female, 3-pin, 0.1" pitch header. One thing that can be confusing is that the wiring color code isn't always consistent -- there are several color codes at play. The good news is that the pins are usually in the same order, just that the colors are different.
Servo Cables
The table below summarizes common color schemes. A useful mnemonic is that the most drab color (black or brown) is usually ground, and red is usually the power supply.
ARCSEC DRIVE are exported all over the world and different industries with quality first. Our belief is to provide our customers with more and better high value-added products. Let's create a better future together.
Pin Number Signal Name Color Scheme 1Servo Connection Color Coding
Heads up! If you're in doubt about your color scheme, check the documentation -- don't plug it in backwards!
The third pin of the servo connector carries the control signal, used to tell the motor where to go. This control signal is a specific type of pulse train. The pulses occur at a 20 mSec (50 Hz) interval, and vary between 1 and 2 mSec in width. The Pulse Width Modulation hardware available on a microcontroller is a great way to generate servo control signals.
Common servos rotate over a range of 90° as the pulses vary between 1 and 2 mSec -- they should be at the center of their mechanical range when the pulse is 1.5 mSec.
pulse to position
In RC vehicles, the nominal battery voltage is 4.8V. It will be somewhat higher after a charge, and it will droop as the batteries discharge. As the voltage drops, the available torque also drops -- if you've driven RC vehicles, you're no doubt familiar with the loss of control that occurs as the batteries get weaker. It starts to feel sluggish just before it dies.
If you're not using batteries, the 5VDC available from a garden variety power supply is a good option. If you're using an Arduino or other microcontroller (such as the SparkFun Servo Trigger) to control your motor, the absolute maximum supply voltage that should be applied is 5.5 VDC.
Regardless of how you're powering them, it's worth noting that the current consumed by the motor increases as the mechanical loading increases. A small servo with nothing attached to the shaft might draw 10 mA, while a large one turning a heavy lever might draw an Ampere or more! If your power supply isn't up to the task, a straining or stalled servo can cause the supply to sag, which may have other unpredictable repercussions, such as causing microcontrollers to reset.
Additionally, if you've got multiple servos, or in applications where the motors are moving non-trivial loads, its best to use heavy gauge wires and give each servo a direct connection to the power supply, rather than daisy-chaining power from one to the next. This configuration is commonly known as star power. If one servo causes the power rail to droop, it's less likely to effect the others when each has a direct connection.
Star power.
When in doubt, grab a multimeter, measure the current consumed, and check whether VCC sags when the servos are turning.
Internally, the mechanism of a servo motor uses a potentiometer attached to the rotating shaft to sense the position. It measures the width of the incoming pulse and applies current to the motor to turn the shaft, until the potentiometer indicates that the position corresponds to the incoming pulse width. This is a form of feedback control. The motor has received the desired position from the pulse width, and the actual shaft position is fed back to the circuit via the potentiometer. It compares the desired value to the actual value and drives the motor in the direction that causes actual to match desired.
Here are the insides of a servo that's been dissected. You can see the gears, DC motor, position potentiometer, and a small PCB. The PCB has a chip on one side, possibly a small microcontroller or specialized servo IC.
Inside an RC servo
The other side of the PCB has some discrete transistors, probably in an H-bridge configuration, which allow the controller to steer current through the motor in either direction, for both clockwise and counterclockwise rotation.
Back of the PCB
Are you interested in learning more about servo motor joint? Contact us today to secure an expert consultation!