Simple Motor Optical Encoder: Introduction

Project Info
Author: Chris
Difficulty: Easy-Medium
Time Invested: 4 Hours

Take a look at the above
tutorials before continuing
to read this tutorial.
           There are many different types of motor encoders out there. Most common is an encoder that attaches to the back of the DC motor. Today we'll be looking at an encoder attached to the mechanics and not simply the motor. There is no real benefit to doing things this way other than, it's easier and uses bottom-line cheap parts you can buy at radio shack.
           The optical encoder will be a black and white paper made using a piece of printer paper and a sharpee pen. Then we will use an IR emitter and detector to keep track of the current location.

The Optical Encoder Finished Setup

The Parts Used In This Tutorial

Purpose & Overview of this project
           The goal of this tutorial is to create a way to know where the 'stage' is, accurate to about 1/4'' using optical encoding. The stage is controlled via a 12v motor so we will use an L298 motor controller for controlling the motor via a 18F4520 PIC.
           The PIC will use hardware PWM generators to output the correct frequency & duty cycle. The PIC will also take the analog input from the IR detector diode to keep track of how far the stage has moved via an internal analog to digital converter (ADC).