Servo Motor Interfacing with PIC16F877A

Servo motor is an electrical device that is a part of a closed-loop system and it usually drives a final control element. In servo motor, the term “servo” stands for the motor operates in a closed-loop system that uses feedback from an encoder or resolver. This should compare the motor’s actual position, velocity, or torque to the commanded value. When we used a DC powered motor then it is called DC servo motor, and if it is AC powered motor then it is called an AC servo motor. The servo motor has the same construction of the DC motor and it works on the PWM(Pulse Width Modulation) Principle. These motors are used to convert electrical signals applied to the angular velocity or movement of the shaft. The article discusses more details about servo motor interfacing with pic16f877a.

WORKING

A servo motor is a soft contained electrical device, it controls position and speed very precisely. The output of the shaft will move at a particular angle. This shaft is coupled with the motor through gears. The servo motor utilizes a regular motor and couples with a sensor for positional feedback. The controllers are the most important part of the servo motor designed in used specifically for this purpose. Servo motor is a closed-loop magnetism that incorporates positional feedback and also controls the speed of rotation very precisely. The motor is controlled with an electric signal either analog or digital which determines the amount of movement which represents the final command position for the shaft.

A servo motor is a closed-loop system that should have position feedback. Industrial type servo motors, the position feedback sensor is usually a high precision encoder. In a closed-loop system initially, we should be given input to the system device. Then it should be passing through the error detection part and fed to the controller. After that, the controller will be processing and produces output. At that time feedback will initiate which is used to control its motion and final position.

CLOSED-LOOP SYSTEM

closed loop control system

In a servo motor closed-loop system, the actual position captured by these devices is fed back to the error detector where it is compared to the target position.

Here we should give command input according to the position of the shaft. If the feedback signal differs from the given input, an error signal alerts the user. We amplify this error signal and apply as the input to the motor, hence the motor rotates. And when the shaft reaches the required position, the error signal becomes zero, and hence the motor stays standstill holding the position.

SERVO MOTOR CLOSED-LOOP SYSTEM

closed loop control of servo motor

Requirements of Good Servo Motor

  • Inertia of the rotor should be as slow as possible.
  • It should have linear torque-speed characteristics.
  • Linear relationship between the electrical control signal and the rotor speed over a wide range.
  • It should be easily reversible.
  • The motor should withstand frequency starting operations.
  • Its operation should be stable without any oscillations or overshoot.

TYPES OF SERVO MOTOR

Classified depending upon the nature of the electric supply to be used for its operation.

types of servo motor

AC Servo Motor

An AC servo motor is constructionally similar to a two-phase induction motor. There are two windings are in the AC Servo Motor. One winding called as control winding and the other winding is called reference winding (excited by the constant voltage). In between the two windings, the rotor will be connected to the load. Out of two winding placed are in quadrature (both are in 90 degrees).

ac servo motor

DC Servo Motor

DC Servo Motor behaves like a mechanical transducer that converts DC voltage into mechanical signals.More or less the same as normal DC motor. .The control of the DC servo motor can be from the field-side or armature side.

  • Armature Controlled DC servo motor

The Armature Controlled DC servo motor, the field current is held constant and armature current is varied to control the torque.

  • Field Controlled DC servo motor

In Field Controlled DC Servo Motor, the variable input voltage is applied to a field winding and armature current is kept constant.

Circuit Diagram for Interfacing Servo Motor with PIC16F877A

Circuit diagram for servo motor interfacing in PIC16F877A Microcontroller. Here, the servo motor is directly connected to the RB0 pin of the PIC16F877A Microcontroller. This RB0 pin will provide the required angular displacement of the motor. The angular rotation of a servo motor is limited to 0° – 180°. So under this limit, we have to control the rotation of the motor.


[fusion_global id=”18383″]

Firmware Example Servo Motor Interfacing with PIC16F877A

Angular rotation 0° is demonstrated in the code.

void Rotation0()   // 0 degree
{
unsigned int i;
for(i=0;i<50;i++)
{
PORTB.F0 = 1;      //connected to RB0, Motor OFF
Delay_us(800);     //delay of 800us
PORTB.F0 = 0;      //connected to RB0, Motor ON
Delay_us(19200);   //delay of 19200us
}
}

Angular rotation 90° is demonstrated in the code.

void Rotation90() //90 Degree
{
unsigned int i;
for(i=0;i<50;i++)
{
PORTB.F0 = 1;
Delay_us(1500); // delay of 1500us
PORTB.F0 = 0;
Delay_us(18500);  //delay of 18500us
}
}

Angular rotation of 180° is demonstrated in the code.

void Rotation180() //180 Degree

{
unsigned int i;
for(i=0;i<50;i++)
{
PORTB.F0 = 1;
Delay_us(2200); // delay of 2200us
PORTB.F0 = 0;
Delay_us(17800); //delay of 17800us
}
}
void main()
{
TRISB = 0; // PORTB as Ouput Port
do
{
Rotation0(); //0 Degree
Delay_ms(2000);
Rotation90(); //90 Degree
Delay_ms(2000);
Rotation180(); //180 Degree
}while(1);
}