http://www.cs.washington.edu/education/courses/477/assignments/lab3/lab3.html
Distributed: April 22 - Complete By: May 2
You will also need to attach the motor and the sensor together. Scotch tape works well for this. Before you do this though, acquire a sense for how close the sensor needs to be to the spinning disk for it to obtain a good signal. You can do this by wiring up the sensor: the blue and white leads correspond to the anode and cathode, respectively, of the transmiting LED, and the green and purple leads correspond to the collector and emitter of the receiving phototransistor, respectively. No more than 20 mA should be allowed to flow through the LED. With a 5 volt supply, an 180 ohm series resistor works well. On the receiving end, a 6.8 kiloohm series resistor will make an excellent voltage divider converting the current change caused to the presense or absense of a reflecting surface into a voltage change interpretable at CMOS digital levels. To determine how close the sensor has to be to a reflecting surface, measure the voltage changes between the resistor/phototransistor connection and ground as the distance between the sensor and the surface varies. I found that the sensor had to be be about 1/20 of a inch from the surface. Your sensor and circuit might be slightly different.
To drive the motor, use the L293D bipolar driver chip. Please note the unusual pinout. There are four output buffers on this chip, so there is enough circuitry for 2 H-Bridges. To vary the speed of the motor, vary the duty-cycle of the enable signal. A larger duty-cycle will result in a higher average voltage and thus a higher motor speed. Experiment with different duty-cycles and determine the maximum/minumum no-load speeds of the motor.