Servos Explained


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.

How does a servo work?

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 of a Servo

Inside a standard hobby servo

Controlling a 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.

Servo controlled by IMU

A servo being controlled by SparkFun 9DoF IMU Breakout

Powering a servo

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.

Let's take a look at an example :

Hitec Servo Datasheet

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.

Types of Servos


Standard Hobby Servos

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

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.

Servo sizes

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.

Servo Sizes

A size breakdown from the Hitec HS-85MG, Hitec HS-425BB, and Hitec HS-805BB in millimeters

Servo Accessories

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.


Driving a 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

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.

Simple Servo Fritzing Diagram

A basic servo connection to a SparkFun RedBoard Qwiic.
Click on image for a closer view.

Using a servo driver

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.

servo trigger fritzing

A simple circuit using a servo connection to the SparkFun Servo Trigger with Momentary Pushbutton Switch. Try it yourself with this hookup guide.


Getting Started


Now that we've covered what a servo is and how to control it, it’s time to put a circuit together.

Basic Servo Control for Beginners

February 25, 2020

An introductory tutorial demonstrating several ways to use and interact with servo motors!

Hobby Servo Tutorial

May 26, 2016

Servos are motors that allow you to accurately control the rotation of the output shaft, opening up all kinds of possibilities for robotics and other projects.

Make sure to look at our hookup guides!

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.

Servo motors:

SparkFun carries different sizes of both standard hobby and continuous rotation servos.

Servo - Hitec HS-85MG (Micro Size)

Servo - Hitec HS-85MG (Micro Size)

ROB-11887
$32.50
1
Servo - Generic High Torque (Standard Size)

Servo - Generic High Torque (Standard Size)

ROB-11965
$13.95
5
Servo - Hitec HS-805BB (Giant Scale)

Servo - Hitec HS-805BB (Giant Scale)

ROB-11881
$42.95
2
Servo - Generic High Torque Continuous Rotation (Standard Size)

Servo - Generic High Torque Continuous Rotation (Standard Size)

ROB-09347
$14.95
6

See all servo motors

Servo drivers:

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.

SparkFun Servo Trigger

SparkFun Servo Trigger

WIG-13118
$19.50
26
SparkFun Servo Trigger - Continuous Rotation

SparkFun Servo Trigger - Continuous Rotation

WIG-13872
$14.95
SparkFun Wireless Motor Driver Shield

SparkFun Wireless Motor Driver Shield

DEV-14285
$24.95 $9.50
2
SparkFun Servo pHAT for Raspberry Pi

SparkFun Servo pHAT for Raspberry Pi

DEV-15316
$11.95
5

See all servo drivers

Servo accessories:

Servo accessories can bring a whole new level to your project's functionality and precision.

Standard Gripper Kit A - Channel Mount

ROB-13174
4 Retired
Pan/Tilt Bracket Kit (Multi Attachment)

Pan/Tilt Bracket Kit (Multi Attachment)

ROB-10335
$6.50
5
Robotic Finger Sensor v2

Robotic Finger Sensor v2

SPX-14687
$39.95

Servo Gear - Hitec (20T; Metal)

ROB-12142
Retired

See all servo accessories


Cool Projects and Guides


Over the years we've created a lot of fun project using servos. Here are just a few to get you inspired.

LED Gumball Machine

April 24, 2019

Hacking gumball machines to make the world a happier, blinkier place.

Clap On Lamp

November 28, 2017

Modify a simple desk lamp to respond to a double clap (or other sharp noise) using parts from the SparkFun Inventor's Kit v4.0.

Wireless Motor Driver Shield Hookup Guide

August 17, 2017

Get started with the SparkFun Wireless Motor Driver Shield!

Servo Trigger Hookup Guide

March 26, 2015

How to use the SparkFun Servo Trigger to control a vast array of Servo Motors, without any programming!

Pi Servo pHAT (v2) Hookup Guide

July 11, 2019

This hookup guide will get you started with connecting and using the Pi Servo pHAT on a Raspberry Pi.