IR Proximity Motor Control

Current Part:

7805 +5v Regulator
PIC 18F4520
TIP42 Power BJT
IR Proximity Sensor
+3v Motor
20 MHz Crystal
3x 10uF Capacitors
Green LED
2x 100Ω Resistor
330Ω Resistor Network
10kΩ Resistor
Jumper Wire
+9v Battery Connector

Parts List Details
           Luckily this project is half hardware intensive and half software intensive, so there aren't too-too many parts. Below I'll describe the most important parts in more detail.

PIC 18F4520
           This microcontroller will be used for understanding the input (an analog voltage) using its built-in Analog to Digital converter and it will also be used to drive the motor output and the LED bar output.

20 MHz
           A 20 MHz crystal will be used to run the microcontroller at a 20 MHz clock rate (5 MHz instruction rate).

Sharp IR Distance Sensor
           This sensor is the center-piece of this article. It outputs a specific analog voltage depending upon how far away an object is from the sensor.

TIP42 Power BJT
           To provide enough current to the motor we need to use a power transistor. A PWM signal from the PIC will tell the power transistor when to turn the motor on and when to turn the motor off. The PWM's duty cycle will determine the speed the motor turns.

Breadboard and Jumper Wire
           We'll use a breadboard for building the circuit since everything is low frequency. Standard jumper wire will be used to connect the circuit together.