A servomechanism (servo) can refer to quite a few different machines that have been around longer than most may realize. Essentially, a servo is any motor-driven system with a feedback element built in. Servos are found everywhere from heavy machinery, to power steering in vehicles, to robotics and a wide variety of electronics.
Here we take a look at the three main servo sizes, and a couple of quick and simple builds to demonstrate what servos can do.
If you open up a standard hobby servo motor, you will almost always find three core components: a DC motor, a controller circuit, and a potentiometer or similar feedback mechanism. The DC motor is attached to a gearbox and output/drive shaft to increase the speed and torque of the motor. The DC motor drives the output shaft. The controller circuit interprets signals sent by the controller, and the potentiometer acts as the feedback for the controller circuit to monitor the position of the output shaft. Nearly all hobby servos have a standard three-pin, 0.1”-spaced connector to power and control the servo. The color coding can vary between brands, but the pins are almost universally in the same order. When combined together, you can power and control the direction, speed and position of the output shaft with just three wires.
Inside a standard hobby servo
In order to move a servo to a position along its movement arc, or, in the case of continuous rotation servos the speed and direction of the motor, the controller needs to send a precisely timed signal for the servo to interpret. Typical hobby servos expect to see a pulse every 20ms, and the width of this signal determines the position. This width is usually between one and two milliseconds. This type of signal control is frequently referred to as Pulse Width Modulation, abbreviated as PWM. A servo controller will normally be a dedicated piece of hardware that can take inputs from other components like a joystick, potentiometer or sensor feedback to set the control signal for the servo. Other control options include using the PWM-capable pins on a microcontroller to send that signal directly to the servo.
A servo being controlled by SparkFun 9DoF IMU Breakout
Depending on the size and torque output of your servo the input voltage will vary, but most hobby servos will work fine with 5V from your preferred microcontroller or battery circuit. More important than voltage is the current draw a servo can pull while moving and with a load attached. When unloaded, a common hobby servo can pull as little as 10mA, but larger servos under load can pull in excess of an Ampere or more. It is important to check the specifications of the servo you intend to use to make sure your power supply has the proper voltage range and can deliver enough current to move the servo with your load attached.
An exerpt from a datasheet for the Hitec HS-422
We've pulled out a few key power specs from this datasheet for the Hitec HS-422 (Standard Size) servo. The first thing to notice is that this servo lists a Test Voltage, often labeled Operating Voltage, from 4.8V to 6V. The datasheet shows that at 4.8V the servo can move 60° at a speed of .21 seconds without any limiting force factors (load). Also operating at 4.8V, this servo motor can drive a load up to 3.3kg/cm (Stall Torque). At 6V, the high end of the test voltage, the servo can move 60° at a speed of .16 seconds with no load, and has a higher torque limit of 4.1kg/cm. It is worth noting that any measurement between no load and the stall torque spec will more than likely slow down the operating speed listed.
A standard hobby or “closed-loop" servo will have a movement range of 90 or 180 degrees. Some will be slightly greater or lesser than the specified range, so check the specifications of the motor you wish to use before implementing it in your project. Standard servos provide feedback for the controller to monitor its position on the movement arc over the control signal wire. This allows you to move the servo to precise locations with the right pulse length from your controller.
Continuous rotation or “open-loop" servos do not work like the standard servo. The control signal only controls direction and speed, not position. These enable you to easily control how fast the drive shaft is moving and which direction it's going, but there's no feedback for position control, so they are not recommended for applications that require moving between specific points on the rotation arc.
Most hobby servos will be classified by their size. Different manufacturers might have small variances in how they list their servo sizes but they can usually be boiled down to three types: micro, standard and giant. These types specify both the physical size of the servo as well as the output torque and the power required to generate that torque.
Each type has their own benefits and drawbacks. A giant servo will be able to generate a lot more torque than a micro servo, but the giant servo will require much more space and power to generate that force. The standard size offers a great middle-ground option, where the power requirements are not too taxing and the output torque is reasonable for most applications.
A servo on its own cannot do much so accessories connected to the drive shaft are necessary to get the most out of your servo. From shaft extensions to gripper kits and pan-tilt brackets, there are all sorts of hardware and components you can add to your servo to augment and improve its functionality.
There are two important factors to consider when choosing a servo accessory: Spline Size or Spline Count and Servo Size. We covered servo sizes in the previous section so we’ll focus on Servo Splines here. Just remember when choosing an accessory for your servo to make sure it will work with your servo’s size.
A Servo’s Spline Size refers to the size and number of “teeth” on the output shaft. Servo manufacturers like Hitec and Futaba have several types of splines for their various servo classes. Depending on your servo, you may see something like “C1 Spline” for a standard Hitec servo or possibly “3F Spline” for a standard Futaba one. Like the servo size, simply make sure the shaft accessories you choose match the spline type of your servo.
After choosing the correct servo for your project, you need a specific signal to tell it what position to move to and how long it should take to get there. There are a wide variety of ways to send this signal from a direct servo controller, found in most RC applications, to a PWM pin on your favorite microcontroller.
Using a microcontroller as a servo driver requires it to have at least one Pulse-Width Modulation-capable pin. With a SparkFun RedBoard or standard Arduino Uno, you have six PWM outputs that can control up to six servos individually. Going this route requires intermediate knowledge of programming in your chosen microcontroller’s development environment, whether it be Arduino, Python or another development software or language. A microcontroller allows you to add in other functions to your project that can, if needed, interact with your PWM pins to move a servo if, say, a distance sensor you have in the same circuit reports a change in its measurements. One drawback is that without the proper code to interact with external inputs like a joystick, you do not have the same direct control as you would with a dedicated servo driver. Essentially, a microcontroller can be converted to a servo driver, but only with the right code and components.
A basic servo connection to a SparkFun Redboard
A dedicated servo driver usually comes with a pre-programmed microcontroller to interpret inputs from something like a button, potentiometer or in other cases, serial data sent from a host device like a computer. The microcontroller on the driver listens for those inputs and then moves the servo to a position or, with a continuous rotation servo, spins the motor in a direction at a specific speed. This allows the user to have a direct interaction with the position, speed or direction of an attached motor, and is great for projects where you need to be able to directly control a servo’s movements.
Now that we've covered what a servo is and how to control it, it’s time to put a circuit together.
When learning how to use servos, one of the best ways to learn is to view the hookup guides. For each product SparkFun carries, we have an associated hookup guide on the product page located under the description. We do our best to walk through all the connections needed, associated libraries and a working demonstration or two to get your project off the ground.
SparkFun carries different sizes of both standard hobby and continuous rotation servos.
Servo drivers have a pre-programmed microcontroller to interpret inputs from something like a potentiometer, or in other cases, serial data sent from a host device like a computer.
Servo accessories can bring a whole new level to your project's functionality and precision.
Over the years we've created a lot of fun project using servos. Here are just a few to get you inspired.