# Servo Motor Interfacing with AT89C51

The Servo Motor is a Digital Electromechanical Device which converts electrical energy of a particular pulse width into mechanical energy as an equivalent angle. The electrical pulse width decides the angle of rotation. The angle of rotation of a Servo Motor ranges from 0ᵒ to 180ᵒ.

Servo Motor comes up with 3-wires only. Those are +VCC, Signal and Ground.

We can control two parameters of the Servo Motor:

A) Angle of rotation

B) Direction

A) Angle of rotation

Consider the Servo motor requires logic ‘1’ on its Signal pin for ‘A’ mS to rotate 180ᵒ and ‘B’ mS to rotate 0ᵒ then we can say that logic ‘1’ for ‘(A-B)/180’ mS is required to rotate the Servo Motor per degree on its Signal pin.

B) Direction

Small size Servo motor needs more than 100mA current in each coil to operate. As we know that 8051 microcontroller can sink/source maximum 10mA of current on any port pin. This requirement of current gets fulfilled through the power supply directly as Servo Motor has only three pins. The input pin is just for sending the Pulse Width to the internal controller circuit of Servo Motor. As per the Pulse Width the internal Controller circuit controls the direction of Servo Motor.

Example: Consider for 0ᵒ, angle value is 1mS and for 180ᵒ, angle value is 181mS.

So, for 1ᵒ angle, the angle value is equal to (181mS – 1mS)/180 = 1mS

Current angle is set to 90ᵒ and you want to set to 45ᵒ then you must send the angle value 46ᵒ to rotate the Servo Motor in backward direction.

Applications of Servo Motor:

– Automation

– Robotics

– Solar System for facing towards the Sun

– CCTV Surveillance System