PIC18F4520 – 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.

PIC18F4520 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. Sample code to check servo motor is given below,upon code execution servo turns each angle.

Schematic

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

Sample Code


Topics related to PIC18F4520 Mini Development Board

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

Resources

How to buy?

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

 

Leave a Reply