Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

Servo Motor : Basics and Working

Written By: 

Nikhil Agnihotri

Servo Motor

Fig. 1: An image Of Commonly Used Servo Motor 

 

What are Servo Motors?

 

Servo refers to an error sensing feedback control which is used to correct the performance of a system. Servo or RC Servo Motors are DC motors equipped with a servo mechanism for precise control of angular position. The RC servo motors usually have a rotation limit from 90° to 180°. Some servos also have rotation limit of 360° or more. But servos do not rotate continually. Their rotation is restricted in between the fixed angles.
 
Where are Servos used?
The Servo motors are used for precision positioning. They are used in robotic arms and legs, sensor scanners and in RC toys like RC helicopter, airplanes and cars.
 
Servo Motor Applications in RC Helicopter
Fig. 2: An Image Showing Servo Motor Used In RC Helicopters
 
 
Servo Motor Applications in RC Airplanes
Fig. 3: An Image Showing Servo Motor Used In Airplanes
 
Servo Motors in Robotic  Arms
Fig. 4: An Image Showing Servo Motor In Robotic Arm
 
Servo Motor manufacturers
There are four major manufacturers of servo motors: Futaba, Hitec, Airtronics and JR radios. Futaba and Hitec servos have nowadays dominated the market. Their servos are same except some interfacing differences like the wire colors, connector type, spline etc.
 
Servo Motor Manufacturers
Fig. 5: An Image Showing Manufacturers Logo Of Servo Motor 
 
 
Servo Motor wiring and plugs
The Servo Motors come with three wires or leads. Two of these wires are to provide ground and positive supply to the servo DC motor. The third wire is for the control signal. These wires of a servo motor are color coded. The red wire is the DC supply lead and must be connected to a DC voltage supply in the range of 4.8 V to 6V. The black wire is to provide ground. The color for the third wire (to provide control signal) varies for different manufacturers. It can be yellow (in case of Hitec), white (in case of Futaba), brown etc.
 
Futaba provides a J-type plug with an extra flange for proper connection of the servo. Hitec has an S-type connector. A Futaba connector can be used with a Hitec servo by clipping of the extra flange. Also a Hitec connector can be used with a Futaba servo just by filing off the extra width so that it fits in well.

Hitec splines have 24 teeth while Futaba splines are of 25 teeth. Therefore splines made for one servo type cannot be used with another. Spline is the place where a servo arm is connected. It is analogous to the shaft of a common DC motor.
 
Structure of Servo Motor
Fig. 6: An Image Showing Spline And Arm In Servo Motor


Unlike DC motors, reversing the ground and positive supply connections does not change the direction (of rotation) of a servo. This may, in fact, damage the servo motor. That is why it is important to properly account for the order of wires in a servo motor.
 
 

Servo Motor Control

The servo motor can be moved to a desired angular position by sending PWM (pulse width modulated) signals on the control wire. The servo understands the language of pulse position modulation. A pulse of width varying from 1 millisecond to 2 milliseconds in a repeated time frame is sent to the servo for around 50 times in a second. The width of the pulse determines the angular position.
 
For example, a pulse of 1 millisecond moves the servo towards 0°, while a 2 milliseconds wide pulse would take it to 180°. The pulse width for in between angular positions can be interpolated accordingly. Thus a pulse of width 1.5 milliseconds will shift the servo to 90°.
 
It must be noted that these values are only the approximations. The actual behavior of the servos differs based on their manufacturer.
 
A sequence of such pulses (50 in one second) is required to be passed to the servo to sustain a particular angular position. When the servo receives a pulse, it can retain the corresponding angular position for next 20 milliseconds. So a pulse in every 20 millisecond time frame must be fed to the servo.
 
Servo Motor Rotation
Fig. 7: Diagram Showing Angular Rotaion Of Servo Motor Using PWM Wave

 
 
 
 
 

Inside a Servo Motor

 
Internal Structure of a Servo Motor
Fig. 8: Image Showing Internal Parts Of Typical Servo Motor
 
A servo motor mainly consists of a DC motor, gear system, a position sensor which is mostly a potentiometer, and control electronics.
 
Components of a Servo motor
Fig. 9: 
 
The DC motor is connected with a gear mechanism which provides feedback to a position sensor which is mostly a potentiometer. From the gear box, the output of the motor is delivered via servo spline to the servo arm. The potentiometer changes position corresponding to the current position of the motor. So the change in resistance produces an equivalent change in voltage from the potentiometer. A pulse width modulated signal is fed through the control wire. The pulse width is converted into an equivalent voltage that is compared with that of signal from the potentiometer in an error amplifier.
 
Servo Motor System
Fig. 10: Simple Block Diagram Showing Diffrent Funtions Of Servo Motor 
 
 
The difference signal is amplified and provided to the DC motor. So the signal applied to the DC servo motor is a damping wave which diminishes as the desired position is attained by the motor.
 
Control Signal Feed to Servo Motor
Fig. 11: Diagram Showing Generation Of Control Signal Using PWM Wave In Servo Motor
 
When the difference between the desired position as indicated by the pulse train and current position is large, motor moves fast. When the same difference is less, the motor moves slow.
 
The required pulse train for controlling the servo motor can be generated by a timer IC such as 555 or a microcontroller can be programmed to generate the required waveform. Refer Servo Motor interfacing with 8051 microcontroller and Servo control using AVR ATmega16.
 
 

Power Supply & Selection of Servo

Power supply for Servo
The servo requires a DC supply of 4.8 V to 6 V. For a specific servo, its voltage rating is given as one of its specification by the manufacturer. The DC supply can be given through a battery or a regulator. The battery voltage must be closer to the operating voltage of the servo. This will reduce the wastage of power as thermal radiation. A switched regulator can be used as the supply for better power efficiency. Learn more about working of a servo motor through exclusive images at the Insight about servo motor.
 
Selection of a Servo    
The typical specifications of servo motors are torque, speed, weight, dimensions, motor type and bearing type. The motor type can be of 3 poles or 5 poles. The pole refers to the permanent magnets that are attached with the electromagnets. 5 pole servos are better than 3 pole motor because they provide better torque.
 
The servos are manufactured with different torque and speed ratings. The torque is the force applied by the motor to drive the servo arm. Speed is the measure that gives the estimate that how fast the servo attains a position. A manufacturer may compromise torque over speed or speed over torque in different models. The servos with better torque must be preferred.
 
The weight and dimensions are directly proportional to the torque. Obviously, the servo having more torque will also have larger dimensions and weight. The selection of a servo can be made according to the torque and speed requirements of the application. The weight and dimension may also play a vital role in optimizing the selection such as when a servo is needed for making an RC airplane or helicopter.
 
The website of the manufacturers can be seen to obtain details about different models of the servos. Also their product catalogue can be referred to. Some manufacturers like Futaba also provide online calculator for the selection of a servo.
 
 

Noise and Modification

Interference and Noise Signal
The PWM signal is given to the servo by the control wire. The noise or interference signals from the surrounding electronics or other servos can cause positional errors. To eliminate this problem the control signals are supplied after amplification. This will suppress the noise and interference signals.
 
Servo Modification for full Rotation
One may want to use the servo for his robot applications and desire to move the servo continually. This is possible by a little modification. The servo gear box has a mechanical stop which avoids the servo to make full rotation. File off the mechanical stop(s) so that the gear box is free to make a complete rotation.
 
Servo Modification for full rotation
Fig. 12: Image Showing Arrangement Of Mechenical Stop In Servo Motor For Full Rotation

 
 
 
 
But this is not the only sufficient thing. The servo works on a feedback mechanism. So the pot of the servo must be first moved to the centre position. This can be done by sending medium pulses to the servo by a microcontroller. Then fix the gears attached to the pot shaft with glue. This will keep an impression to the control electronics of the servo that the current position is the middle point. So the servo would then move with respect to the middle position and not to the current position.

 

 

Comments

Thanks for this article i was searching about for servo motors and finally i found what i wanted to learn.

okay carry on...

 

Hi there to all, the contents present at this website are genuinely remarkable for people experience, well, keep up the good work fellows.

thanks for this article. i wanted to know about servo motors.......

thank you i fully understand about servo motor very thanhs

give the detailed explain of electronic component in servo

 very informative article

 A article with all information about servo motor at one place. 

hi sir

this was really informative.I m using HS-311 servo mortors with ATMEGA 16 microcontroller.for making it rotate to 0degree i gave 0.33 us on pulse and 20 ms off pulse,for 90 degree i gave 0.95ms on pulse and for 180 degree......1.56 ms pulse.... it worked effectively.for2 servos i had to use 2 avr ports. i want to use 4 servos in only 1 port in ATMEGA 16,how can it be done without interfering with other servo's PWM??

super like.....its 2 good ....
really i impressed with this presentation
how will move servo from ic 555. 

i am really impressed with the explanation of servomotor. i now see that its a step ahead of the dc motor we used back in the days

thanks 

thank u it was really helpfullyes

Informative post on servo motors. This post will really help in selecting a servo and in manufacturing it. Generally, people have to face problem while selecting a particular servo according to their requirement. Thanks a lot for this wonderful post.

very informative article

should post some relative circuit diagram to check the servo's working

hi plz attach pdf form of this artile for download tanx very informative article

nice information very usefull 

Thanks........

nice article

this is a really nice to learn all about the servo motor by the artical.

 

The post is really cool, thanks for sharing it here. Good thing someone shared it so we can all use it as guide and future reference when it comes to servo motor.

Anyway, it's nice to know that a lot of people shows interest at servo motors.:)

A very well done by the author. A very informational article with clear a well structured literature. A real joy to read . Once again WELL DONE!

Hi, 

I am new to electronics world i would like to know is there a way to reduce the speed of sservo motors without decreasing its toque. 

Thanks in advance.

Regards

Hi sir

Im using MG995 twoerPro servo motor interfacing with arduino.
im not getting result as programed 
I connected red to +5v
brown to ground

& yellow for signal to arduinos pin 9

 

and want to rotate 20 degrees like this

for (i=0;i<=180; i=i+20)

move 20 degree

 

 

here is the complete program (i tested with arduino uno board with vs2 and v0006 servo)

 

 

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
               
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
 
 
void loop() 
  for(pos = 0; pos < 180; pos += 20)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 20 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=20)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 

hy sir

i'm using pic 16f877A controller
i'wanna conrol a servo motor in such a way that pulses of different time period  are given to motor ........
i'm using CCs compiler
i've confusion to make the code
any 1 help me please

engg_umair17@yahoo.com

i'm tHankful to yOUh.. .. ..

I GOT WHAT I M FINDING ABOUT SERVO MOTOR

 

thanks  a lot

Very good explanation. Better than text book and manual.

Very nice and awesome!

Really great post!!.Thank you for sharing this knowledge with us.Its a well written post i would share with my friends also.

i WANT TO CONTROL THE DIRECTION OF SERVO MOTOR USING ULTRASONIC SENSOR SO PLEASE HELP .. I AM DOING ARM 7 LPC2368

 

I recently came across your blog and have been reading along. I think I will leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

Thanks and Regards,

Pharmaexpressrx.net

thanks for post

It does help me a lot knowing that you have shared this information here freely. I love the way the people here interact and shared their opinions too

Very Useful article for beginners like me .....

 

Thanks

Sairam.

sir, I'm working with 6 servomotor robotic arm, which will pick up & place object,.......but I didn't get the o/p with my program........plz help

 

nice information

hi sir,

 

i'm using pic 16f877A controller..i'wanna conrol a servo motor in such a way that pulses of different time period  are given to motor ........
i'm using hitech compiler.i've confusion to make the code.any 1 help me please.

i need 0 to 90 of rotation and 90 to 0 of rotation ... pls send me the code to ..

 

nataraj87@gmail.com..Pls reply me as soon as possible...

 

Thanks ......

I'm having trouble understanding what the sw 1 goes to in the first ic 555. Can u help?

please help me 

i want make robot arm by using servo motor but i donot know which servo model can be used and any type 

servo which rotate 180 degree or 360 degree.

i will use pic16f877a .i want code for controll arm by micro c langague .

 

hi , i am using atmega32. i want to control servo motor with help of keypad 4*3 (eg. by pressing key '1' motor should rotate anticlockwise and by pressing key '4' it should rotate clockwise) atmega32 comes with pwm output(pin 21), i want some help in programing the output pin(21) with desire duty cycle generated by pressing key 1 or 4 to rotate servo motor acw or cw respectivly..

 

thanking you in advance..

avdish@gmail.com

Hi Sir

 

I am using ATMEGA16 for my robotic arm which has a servo motor 

I have connected the data pin of servo motor to Port B3 .

I need to control the position of servo motor using a 10k potentiometer.

The servo has to rotate only when i change the resistance through pot

Plese give me the code ,it is so important and also urgent

 

this website is remarkable. i learnt a lot from this web

Can anyone tell me whether servo motor can be run by Atmega-16 ?

Yes it can be... there is another article on this site detailing the avr code: http://www.engineersgarage.com/embedded/avr-microcontroller-projects/atm...

Can you tell me how to rotate a servo in the reverse direction?

Are you sure that there is nothing in the electronics as well that would prevent a 180 degree servo motor from making a full 360 degree rotation, once we file off the mechanical stops??

Are you sure that there is nothing in the electronics as well that would prevent a 180 degree servo motor from making a full 360 degree rotation, once we file off the mechanical stops??

Sir,

I wrote a program for LPC1768 i connceted servomotor to 5v and motor is not rotating but when i keep on insertimg and removing my PWM output it is slightly rotating...how can i solve this issue