Servo Motor Control by using Microcontroller PIC16F877A

Summary of Servo Motor Control by using Microcontroller PIC16F877A


PIC16F877A microcontroller project demonstrating servo control: two switches move an RC servo to +90° or -90° using PWM pulses (1–2 ms pulse width every 20 ms). Tools used: MikroC PRO for programming and Proteus 8 Professional for circuit simulation and design. The article explains RC servo basics, PWM principles, and how pulse width sets servo position.

Parts used in the PIC16F877A Servo Control Project:

  • PIC16F877A microcontroller
  • R/C servo motor
  • Two push-button switches
  • 5 V power supply
  • Ground connection
  • MikroC PRO (software for programming)
  • Proteus 8 Professional (simulation and design software)
  • Connecting wires
  • Resistors (for switch pull-ups or protection)

PIC16F877A is an easy micro controller for the beginners
Here in project:
1) How PIC switches servo motor forward and back ward
When we push one switch it goes to positive 90 degree , on second switch it moves backward to  negative 90 degree
Servo Motor Control by using Microcontroller PIC16F877A
a. MickroC  PRO        // for programming of MICRO CONTROLLER
b. Proteous  8 professional       //For simulation of CKT and Design

BEST OF LUCK.
Eng. Mahmoud Abuzayed

Step 1: R/C Servo Control Theory

Servos designed for use in radio-controlled airplanes, cars, and boats can be easily interfaced to a PIC MCU. They are often used for robots and applications where simple mechanical movement is required. This might be surprising because a positional servo is considered to be an analog device. The output of an RC servo is usually a wheel that can be rotated from 0 to 90 degrees. (some servos can turn from 0 to 180 and others have very high torque outputs for special applications). Typically, they only require +5 V, ground, and an input signal.

An RC servo is an analog device; the input is a PWM signal at digital voltage level. This pulse is between 1.0 and 2.0 ms long and repeats every 20 ms .The length of the PWM pulse determines the position of the servo’s wheel. A 1.0-ms pulse will cause the wheel to go to 0 degrees and a 2.0-ms pulse will cause the wheel to go to 90 degrees.

Pulse Width Modulation (PWM)
Pulse Width Modulation (PWM) is one of the powerful techniques used in control systems today. They are not only employed in wide range of control application which includes: speed control, power control, measure and communication.
Servo Motor Control by using Microcontroller PIC16F877A
Basic Principal of PWM

PWM is achieved with the help of a square wave whose duty cycle is changed to get a varying voltage output as a result of average value of waveform. A mathematical explanation of this is given below:

 

For more detail: Servo Motor Control by using Microcontroller PIC16F877A

Quick Solutions to Questions related to PIC16F877A Servo Control Project:

  • How does the PIC16F877A control a servo motor?
    It generates PWM pulses where pulse width between 1.0 and 2.0 ms repeated every 20 ms sets the servo position.
  • Can two switches control forward and backward movement?
    Yes; one switch moves the servo to positive 90 degrees and the other moves it to negative 90 degrees as described.
  • What pulse width corresponds to 0 and 90 degrees?
    A 1.0 ms pulse causes 0 degrees and a 2.0 ms pulse causes 90 degrees (as given in the article).
  • What repeat period should the servo PWM use?
    The PWM pulses should repeat every 20 ms according to the article.
  • What software is recommended for programming the PIC?
    MikroC PRO is recommended for programming the microcontroller.
  • What software is recommended for circuit simulation and design?
    Proteus 8 Professional is recommended for simulation and design.
  • What supply connections does an RC servo require?
    An RC servo typically requires +5 V, ground, and an input signal.
  • Is PWM only used for servos?
    No; the article states PWM is used in many control applications including speed control, power control, measurement, and communication.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter