PH415 Computer Interfacing 2013
OSU logo
Optical Encoding and Tracking

Table of Contents

There are two tasks that will be performed with the stepper motor. The first will be to implement a simple optical encoder that will be used to determine the reliability of the motor at various speeds. The second task will be to create a system using the stepper motor that will find and track a light source.

Simple Optical Encoder

The stepper motor only has the capability to move discrete amounts in one direction or another. When the motor is set on a slow speed it is easy to tell if the motor is moving or not, but what if precise positioning is needed at higher speeds? How can we be sure that the motor actually stepped the number of times it was told to? Without any sort of feedback, a system controlling this motor can only assume that the motor stepped as many time as it was told. An encoder can be attached to the motor to provide feedback to a user or system to determine the movement of the motor. You will be creating a very simple encoder for the stepper motor using a LED, photodiode, and a piece of card stock.

Optical Encoder Task

  • Create a circuit containing a LED pointing at a photodiode. Attach a oscilloscope to the in a way that will show he voltage change when the light source is cut off.
  • Wire the stepper motor controller to the chip kit, be sure to ground the MS1 and MS2 pins on the stepper controller.
  • Attach a strip of card stock to the stepper motor, be sure it sticks out past the motor body.
  • Write a program that can control the speed at which the stepper motor operates. Add the ability to send a pulse out of one of the ports for each time the controller thinks the motor has completed a revolution. (It is advisable to use a class for this program)
  • Set up the motor so the strip of card stock will block the light from the LED at some point in the rotation.
  • Vary the speed of the motor and use the pulse for a revolution as a trigger to watch the voltage change on the oscilloscope. What happens as the motor is sped up, can you tell if the motor begins to miss steps at higher speeds?

Optical Tracking

Now that you have used a simple encoder and should have found a range of speeds at which the motor can run reliably, you will make a system that will find and track a light source. A LED and battery will bew attached to the stepper motor and a photodiode will be used to capture the intensity of the incoming light. You will need to use the data collected from the photodiode to determine if the LED is pointing at it.

Optical tracking Task

  • The system will consist of a fixed photodiode and a LED light source on the motor. The concept is to be able to rotate the LED until it is pointed exactly at the photodiode.
  • Attach a high intensity LED and battery to the shaft of the stepper motor in a manner that does not allow the light to wobble. Set up a fixed photodiode and connect it to an analog input on the microcontroller. Keep the LED and photodiode close together to avoid interference form the room lights and to help overcome a significant deficiency in the optical system. The light coming from the LED is dispersive so the intensity will diminish with distance.
  • Write a program to rotate the motor until the signal is maximized. This might require dithering the motor to determine the exact position of the maximum signal. Your program will need to take a single step, measure the signal and then decide whether the signal has risen or fallen.
  • Increase the separation between the source and the detector until your program can no longer find the source. Based upon some concepts you have already explored, rebuild your physical system and program as necessary to be able to find the source reliably.