Servo Control tutorial

We have reached the most important and interesting section of this tutorial: Servo Control.

Controlling a servo as discussed before involves sending a modulated square-wave pulse which is known as pulse-Width-Modulation (PWM) or Pulse-Duration-Modulation (PDM). If signal voltage from peak to peak (amplitude) is taken care as per the datasheet (which is generally 3V to 5V), then there two other main factors to be considered while sending a PWM signal to servo; “Frequency” and “Duty cycle”.


Servo expects continuous pulses to move or hold its position. Frequency (or repetition time, or cycle time) is the number of times a positive pulse is fed to servo in a unit time (which is generally measured in seconds); for analog servos, frequency is generally 50 times a second (50Hz) and for digital servos it is 300 times a second (300Hz).

50Hz = Positive pulse 50 times a second; i.e. 1/50 = 0.02 seconds = 20ms (timeout period). This means every 20 milliseconds servo expects a pulse to retain its corresponding angular position.

300Hz = Positive pulse 300 times a second; i.e. 1/300 = 0.0033 seconds = 3.33ms (timeout period). This means every ~3 milliseconds servo expects a pulse to retain its corresponding angular position.

If servo does not receive a pulse before the timeout period, then servo releases its hold and can move to any forced position.

Note: Required pulse frequency for few servos may be less, or more depending on the particular model and manufacturer.

Duty Cycle

“Duty cycle” is the width of positive pulse (square wave) and a deciding factor for servo’s angular position. For example, if you have a servo with 180° turn, then 90° is the center position of the servo with 0° being minimum, and 180°, being the maximum. Now, if a positive pulse of 1.5ms is sent, then the servo stays at 90° (servo center) as long as it receives the same pulse. If another pulse of 1ms is sent, the circuit tries to move the shaft to 0°, and a pulse of 2ms tries to move the output shaft to 180°.  This means, a pulse shorter than 1.5ms moves the servo in one direction and wider than 1.5ms moves it in another direction.

Servo Duty Cycle

Different servo models have different minimum and maximum pulse requirements. For example, a Hextronik servo I have has a minimum pulse requirement of 0.5ms to move to 0° and maximum pulse duration of 2.5ms to move to 180°. Sending a pulse of 1ms moves it to 45° and 2ms moves it to 135°. Another servo requires 1ms pulse to move to 0°, 1.5ms to move to 45° and 2ms to move to 90° and maximum angular rotation being 90°. The de-facto standard is 1ms for minimal angle, 1.5ms for servo center and 2ms for maximum angle. Servo center is almost always 1.5ms and minimum and maximum should be verified in product’s datasheet.

Do you have anything to say?
Visit the Forum to discuss, learn and share anything related to robotics and electronics !!

rss feeds

Featured Videos


Recent Articles

Atmega8 Development Board

A great step-by-step tutorial on building your own Atmel AVR based Atmega8 development board. The board is ideal for beginners with detailed explanation and pictures More...

L293D Motor Driver

For robots to do work, you need to know how to control a motor. L293D is a cleverly packed IC which can control two DC motors in both directions: forwards and reverse. Here is a detailed explanation of building a board based on L293D ICMore...

Hobby Servo Tutorial

Servo Motor is a device which uses error-sensing feedback signals to determine and control the position of a motor shaft. The term "servomechanism" closely relates to servo motors..More...

Blinking LED Tutorial

This is similar to what we achieve in any "Hello World" program. However, it is not just limited to blinking LED but scratches the surface of AVR-GCC programming... More...

Kindly Donate

If this site has helped you, then kindly consider a Donation to say "Thank You!!". Donation might help us keep all this information available for free and also pay for the resources.

If that is difficult, then a simple "Hi" in the forum would still do good :)