Servo Motor

A servo motor is a specially designed motor mechanism that consists of different gears so that the actual motor speed can be controlled and only a desired deflection of movement can be made possible. A servo motor can be applied in different fields of industrial robotics for controlling any arm or wheels of a robot.

Explain Servo motor............................................................................

Photo of the servo motor..................................


Live Demo of the Project

There are different applications of servo motors :

  • Robotics : In robotics different arms, wheels, shafts, cameras are moved using Servo Motors. The servo motors are very powerful, as they use the concept of gears, that is why a small motor can be made to perform a heavy load task.
  • CCTV Cameras: There are situations when it is not possible to install multiple cameras in one place, in such areas servo motors can be used to change the orientation of the camera to a different angle.
  • Drone Technologies : In drones, it is almost impossible to change the direction without a servo motor. When a drone has to be moved, a little inclination is required in the fan's shaft, in such case servo motors can be made applicable.
  • CD/DVD Trays : Almost in all the devices, the disc trays are controlled and operated by servo motors. Due to their small size and great power, small installations can be made to carry out critical tasks.
  • Automated Car : Nowadays, in automated cars, the servo motors control the speed of the car by pulling or pressing the accelerator wire as per the speed required.
  • Commercial Aircraft : Aircraft uses the main engine to lift push inside the airplane. But, servo motors are installed in all areas, so that if the engine connection fails, in an emergency, all the push and pull related works goes smoothly.

Working of a Servo Motor:

There are servo motors that have a size less than 1 inches, but still, they have high power, enough to move a 250-gram camera module to 180 Degrees. This is possible because it uses the law of physics, that is, work= force *distance.

Now, the DC motor inside a small servo motor is very small(less than 2 cm diameter) and so, of course, the torque produced by it will be less. But the speed(Rotation per minute) is very high.

Therefore, inside the servo motor, there is an arrangement, which converts the high speed into low speed. This causes to create more torque, but with less speed. In small servo motors, there are small gears which are made of plastics, but in the case of bigger sized servo motors, which are designed to do heavier tasks, the gears are metallic are not prone to damage.

There is a sensor attached in one of the gears of servo motors which can sense the deflection or the rotation of the shaft and produce data which signifies the angle the shaft has moved.

Different Types of Servo Motors:

There are different types of servo motors:

  • Positional rotation servo : This is the most used types of servo motors. The output shaft can move to and fro by about 180 degrees. It consists of a physical mechanism which does not allow it to move beyond the angle, that is 180 degrees. These types of sensors can be found cars, toys, camera, etc
  • Continuous Rotation Servo : This is the most flexible type of servo motor which can move two and fro in either direction(clockwise or anti-clockwise). This type of servo motors is used in applications where there is a necessity of moving an object all in all directions. Such as- antenna, in radar systems, satellites, etc.
  • Linear Servo : This is actually a positional servo motor which uses a rack and pinion system to change the circular output into the back and forth output. This types of servo are used in application such as inside the photocopying machine, disc tray, etc, where there is an application of linear motion.

Servo with Arduino

There are 6 Pins in the Arduino which has a property called pulse width modulation(PWM). Through this property, the average power of an electric signal can be lower, by chopping down it into discrete parts.

Components Required :

  • Arduino Uno Board
  • Jumper Wires
  • DC 5v Servo Motor
  • Bread Board
  • LCD module (Optional, if you want to display the degree of rotation of the servo)
Connecting the Servo to the Arduino:


  • Connect the plus(+) pin of the servo into 5v pin of the Arduino
  • Connect the minus(-) pin of the servo into the GND of the Arduino
  • Connect the data pin of the servo into the PIN 2of the Arduino.
Connecting the LCD into the Arduino:


  • Connect the Anode Pin of the LCD into the GND of the Arduino.
  • Connect the Cathode Pin of the LCD into the 5V pin of the Arduino.
  • Connect the PIN D7 of the LCD into the PIN 13 of the Arduino.
  • Connect the PIN D6 of the LCD into the PIN 12 of the Arduino.
  • Connect the PIN D5 of the LCD into the PIN 11 of the Arduino.
  • Connect the PIN D4 of the LCD into the PIN 10 of the Arduino.
  • Connect Vss PIN of the LCD into the GND of the Arduino.
  • Connect the VDD pin of the LCD into the 5v pin of the Arduino.
  • Connect the Contrast pin of the LCD into the GND pin of the Arduino via a 10K ohm Resistor or a 10K potentiometer.
  • Connect the RS pin of the LCD to the PIN 4 of the Arduino.
  • Connect the RW pin of the LCD to the GND of the Arduino.
  • Connect the Enable pin of the Arduino to the PIN 6 of the Arduino.


Edit the following code into the Arduino Editor
#include <Servo.h> 
#include <LiquidCrystal.h>
Servo myservo;
int servoPin = 9; 
LiquidCrystal lcd(4, 6, 10, 11, 12, 13);
void setup() { 
     lcd.begin(16, 2);
void loop(){ 
   lcd.print("30 Degrees");
   lcd.print("45 Degrees");
   lcd.print("60 Degrees");
   lcd.print("75 Degrees");
   lcd.print("90 Degrees");
   lcd.print("150 Degrees");
   lcd.print("150 Degrees");
   lcd.print("180 Degrees");
   lcd.print("0 Degrees");

Program Analysis :

  • #include<Servo.h> , is the library that has to be imported explicitly.
  • #include <LiquidCrystal.h> , is the LCD library that has to be imported explicitly.
  • Servo myservo; , here myservo is an object to access the attribute of the servo motor. It is used to access the motor orientation and read the sensor data of the servo motor.
  • int servoPin = 9; , variable called servoPin is declared and assigned the pin 9.
  • LiquidCrystal lcd(4, 6, 10, 11, 12, 13); , the PINS 4,6,10,11,12 and 13 are assigned for the LCD.
  • Inside the function void setup(), we have a function called lcd.clear(), to clear the LCD.
  • Then we used the function called attach() to attach a pin to the servo variable which is myservo in our case.
  • myservo.write(0); , the function write() takes a parameter, which is nothing, but the degree of rotation of the servo shaft. The object myservo is used with the write() function, to access the servo motor and change the degree of rotation.
  • Inside the void loop() function, we use the write() function to rotate the shaft into some degrees as well as print the degree into the LCD using the line -lcd.print("some values in Degrees");.
  • Then we induce a delay() to distinguish between the next task.
  • Then the write() function is used in iteration to change degrees from- 30 to 180 and then myservo.write(0) will bring the servo back to zero degrees, and again the iteration will start.


Can I rotate the Servo 360 degrees?

Yes. You can. But all the servo(s) are not capable of doing this. Most of them are made only to rotate up to 180 degrees.

Where can I use the Servo?

You can use the Servo motor in any field where dynamics are required. Such as in Robotics(controlling its arm) or in drones, etc.

Is there any maximum load that can be handled by the Servo?

Yes. All Servo has a certain capacity for load handling. If more load is made to handle by a servo, than the motor may be damaged permanently, or the torque may be reduced.

Which Power Source should I use for my Servo motor?

For small projects,(for small servos) you can use the power from the Arduino Board itself. But, in the case of larger projects, an external power source should be used which will reduce the load of the Arduino.

A step by step....

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions