Use a PIC Microcontroller to Control a Hobby Servo
How Servos are Different from Regular Motors
Inside a servo is a traditional DC motor, a potentiometer (variable resistor), and control circuitry. The potentiometer is connected to the motor such that when the motor shaft turns it also turns the potentiometer. The controller can then measure the voltage at the center pin of the potentiometer and get an indication of the shaft's position. The controller receives a signal (see next step) from the user that sets a desired position. The controller compares the desired position to the current position of the motor and uses that information to turn the motor in a direction that minimizes the error.
The way this works in practice is you specify the angle you want the shaft at using your PIC, the shaft turns to that position, and then holds there. The further it gets pushed away from that position, the harder it tries to turn back. Hobby servos are usually geared way down, so even a wimpy $15 or $20 one can hold its position reasonably well.
The Control Signal
These timing/voltage values are for a typical servo. You should be able to find documentation for you specific servo from the manufacturer.
The Circuit

The only change that needs to be made for this project is to replace the LED and its resistor with the wire for the control signal. So instead of connecting pin 3 to a resistor and then to an LED and then to ground, just connect pin 3 to the white/yellow wire from the servo. The ICD2 block represents the PIC programmer I used, substitute your own if you want. Also, don't forget to hook up the servo's power and ground connections.
Related projects
JDM2 based PIC Programmer
JDM2 based PIC Programmer Schematic & layout for an updated JDM2 PIC Programmer. Includes clock & data filter, Vpp voltage divider for...
Communication & Interfacing · PIC18F2455USB IO Board PIC18F2455 / PIC18F2550 using pic microcontoller
About PIC18F2455 / PIC18F2550 USB IO Board USB Input / Output Board is a spectacular little development board / parallel port replacement...
Communication & Interfacing · PIC18F2455OBD-II ELM327 compatible AllPro adapter using PIC18F2455
Overview This adapter allows you to interface with your car's OBD-II bus. It provides you a USB interface using the ELM327 command...
Motors & RoboticsReal-Time CAN-Based Vehicle Monitoring System with PIC MCU
INTRODUCTION The Controller Area Network (CAN) is a robust vehicle communication bus standard that was primarily developed for automobile applications but has...
Motors & RoboticsEasy Way to Learn Robotics Using Microcontrollers: A Beginner’s Guide
The title, "Easy Way to Learn Robotics Using Microcontrollers," promises an accessible entry point for those curious about the exciting world of...
Motors & Robotics · PIC16F877AEfficient Sun-Following Robot: A Solar Tracker with Microcontroller Control
Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....
