PIC16F877A – Interfacing Servo Motor

Servos have simple electrical interface – they have 3 wires, one for power, one for ground and the other for the pulse train. Once the servo is powered, the signal wire is ready to receive signal in the form of pulse width modulation (PWM) from an external source.
The signal expects to be updated every 20 ms with a pulse between 0.5ms and 2.5ms. With a 1.5 ms pulse, the servo motor will be at the natural 90° position. With a 0.5 ms pulse, the servo will be at the 0° position, and with a 2.5 ms pulse, the servo will be at 180°. You can obtain the full range of motion by updating the servo with a value in between.

PIC 16F877A mini development board has a dedicated connector K16 to interface Servo motor. Regulated 5V is available on power supply pin and the signal pin is connected at the port pin RE1.

SchematicNote: Use adapter for powering since USB doesn’t provide required current.

Sample Code

Sample code to check servo motor is given below.
When ‘a’ is received, servo turns to 90°
When ‘b’ is received, servo turns to 180° and
When ‘c’ is received, servo turns to 0°


Topics related to PIC16F877A Development Board-Mini

  1. PIC16F877A Mini Development Board – Overview
  2. PIC16F877A Mini Development Board – Interfacing LED
  3. PIC16F877A Mini Development Board – Interfacing LCD
  4. PIC16F877A Mini Development Board – Serial communication(USART)
  5. PIC16F877A Mini Development Board – Interfacing Switch
  6. PIC16F877A Mini Development Board – Interfacing Buzzer
  7. PIC16F877A Mini Development Board – Interfacing  POT(ADC)
  8. PIC16F877A Mini Development Board – Interfacing Temperature sensor
  9. PIC 16F877A Mini Development Board – Interfacing Servo Motor
  10. PIC 16F877A Mini Development Board – Interfacing μRFID Reader

Resources

How to buy?

SupportPlease share your ideas with us, visit our forum for discussion

 

Leave a Reply