PH 415 Computer Interfacing
OSU logo
The content of this page is undergoing revision and will be moved to another site soon.
Task 5

Table of Contents

Motion Control Concepts

Controlling a Stepper Motor

  • Analyze the stepper motor controller board, and connect it to both the DIO card and the motor. The controller board uses the UCN5804. Use a 12 V power supply for + Vcc if the stepper motor requires 12 V. Do not use a 5 V motor. You will need to supply the enable signal (true when low), a direction signal and a step pulse which will cause a step on the rising edge. All signals are TTL compatible. Use the P0 digital IO port on the 6221 as the source of these three signals. Read Chapter 6 Digital IO in the user manual.
  • Write a program to turn the motor. Determine both the number of steps per revolution and the maximum step rate. Measure the holding torque and maximum step torque.

Build a System to Determine the Direction of an Optical Signal

  • The system will consist of a fixed LED light source and a photodetector on the motor. The concept is to be able to rotate the detector until it is pointed exactly at the LED.
  • Set up a fixed LED source operated in DC mode. Use a bright, narrow beam LED. Mount a photodiode exactly on the axis of the stepper motor and connect it to the analog input of the IO card. Keep the LED and photodiode close together to avoid interference from room lights and to help overcome a significant deficiency in the optical system, the fact that you do not have a lens to focus the LED signal onto the photodiode.
  • 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. The program digital_test.py demonstrates how to create a digital output channel along with an analog input channel and then toggle the digital output.
  • 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.