Boris LeonovSam KristoffArthur Brown
Published © MIT

Servo Signals and Characterization

Exploring the signals behind Arduino's Servo library, and characterizing a servo's response to pulse width.

BeginnerProtip1 hour14,542
Servo Signals and Characterization

Things used in this project

Hardware components

Servos (Tower Pro MG996R)
Most servos have the same operating parameters.
OpenScope MZ
Digilent OpenScope MZ
Arduino UNO
Arduino UNO
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms

Software apps and online services

Digilent WaveForms Live


Read more


Servo Characterization

Use this code to characterize the servo. It was written for the Arduino Uno.
#include <Servo.h>

// create a servo object
Servo servo; 

//analog input from the potentiometer
int potPos = A0;

void setup() {
  // link the servo to pin 9, and set the pulse width limits (544ms and 2400ms in this case)
  servo.attach(9, 544,2400);  

  //set the analog pin as an input
  pinMode(potPos, INPUT);

void loop() {
  //store the potentiometer position as a float
  float level = analogRead(potPos);

  //calculate analog data as a voltage
  float voltage = 5*level/1024;

  //make sure the voltage isn't outside the acceptable range
  if(voltage < 0){
    voltage = 0;
  if(voltage > 5){
    voltage = 5;

  //scale voltage to 180 degrees
  servo.write(36 * voltage);

  //give the servo time to move to new position


Boris Leonov

Boris Leonov

10 projects • 22 followers
Electrical engineering student in the Seattle area. Electrical and mechanical DIY enthusiast. Fixer of things, large and small.
Sam Kristoff

Sam Kristoff

35 projects • 49 followers
Director of Engineering at Digilent.
Arthur Brown

Arthur Brown

14 projects • 28 followers
Applications engineer and digital logic geek


Add projectSign up / Login