RETURN to the CHEM 498C Home Page

Simultaneous Digital Control and Analog Data Acquisition

Revised Spring 1996

Stepper motors are widely used in automated instrumentation whenever precisely controllable rotary motion is desired. Common uses in chemical instrumentation include monochromator wavelength drives in spectro photometers and reagent delivery pumps in automatic titrators. In this experiment you will interface a simple stepper motor to the computer and use it to scan a small monochromator.

There are basically two ways to interface a stepper motor to a computer: you can buy (or build) a special motor driver card which plugs into the computer's bus and connects directly to the motor, or you can use a separate, stand-alone motor controller box and interface the motor to the controller box. The stepper motor we are using is powered by a separate motor controller. It has several manually-adjustable knobs and switches for controlling motor speed and direction; try them to verify that the controller and motor are working properly. In addition to those controls, the driver box also has a set of remote control inputs on the 12-pin card edge con nector on the back panel. This allows the stepper motor to be stepped forward and backward by an external controller, e.g. a computer. The electrical connections between the computer's digital output port and the stepper controller remote control pins have already been set up (each bit is interfaced via a simple transistor switch).

To control the motor controller from the computer, we need two bits of digital (on-off) outputs from the computer, one to step up and one to step down. Eight such digital output bits are available on the CIO-AD08 card; we will need only two of them. e.g., bits Ø and 1. Refer to the manual to determine the pin-out and I/O address of these bits. To cause the motor to step, you need to generate a complete pulse (from zero volts to 5 volts and back to zero volts) at the pin corresponding to the direction you want to step. For example, to turn on bit Ø , you OUTput a 1 (binary 00000001) to the digital output port I/O address and to turn it off, you OUTput a Ø . To turn on bit 1 you OUTput a 2 (binary 00000010) to that address and to turn it off you OUTput a Ø .

1. Refer to the manual to determine the address of the digital I/O port. Write a little QuickBasic program to turn bit Ø on and then immediately off. What happens to the wavelength when you do this? Modify the program to turn bit 1 on and then immediately off. What happens to the wavelength when you do this?

2. Modify the program to produce a train of pulses to make the monochromator scan. Make sure the motor works in both directions. Determine the fastest rate at which you can step the motor smoothly. If you find that the program runs too fast for the motor to keep up, you can easily slow the program down in either by using the TIMER function or by adding a time-wasting "do-nothing" loop within stepping loop (e.g. FOR J = 1 TO N: NEXT J ), where N is the smallest number that gives reliable stepping.

3. Your stepper motor is attached to a small grating monochromator by means of a simple gear reduction coupling. Each step of the motor corres ponds to 0.1 nm. Write a program that will scan the monochromator to any wavelength typed in. Provide a continuous on-screen display of the wave length in nanometers (Use LOCATE to keep the wave length display in the same place on the screen. If you update your wavelength display once each motor step, you may not have to use a time-wasting loop, because of the time required to print a number on the screen). Check your set-up by scanning 50 nm in one direction and then 50 nm back in the other direction and see if the wave length comes back to where it started.

4. The output (anode) of the photomultiplier tube is connected to the input of the Oriel Detection System with a BNC cable and that the high voltage input of the photomultiplier tube is connected to the output of the Fluke power supply. The output of the Oriel Detection System (0 - 100 millivolt range) is connected to an operational amplifier and the output of the operational amplifier is connected to analog input channel 0 of the CIO-AD08 analog-to-digital converter in the IBM-PC (the same model you used in the previous ADC experiment).

Set the mono chrom ator wavelength to 500 nm. Turn on the light source and focus the light on the entrance slit of the monochromator. Turn on the detector system and adjust the range switch of the Oriel Detection System so the meter reads about one-half full scale.

5. Write a simple program which scans the monochromator between any desired wave length limits, stops every 10 nm and takes the average of 50 ADC readings, and prints out to the screen a two-column table giving the wavelength and the corresponding ADC reading, like so:

400 923
410 1032
420 1098
and so on.....

Hint: Put the main functional modules in subroutines to facilitate re use of the routines in the program modifications specified below. Use your program to scan over the visible spectral region of 400 to 600 nm and find the wavelength of maximum intensity (maximum ADC reading). Adjust the range switch of the Oriel Detection System to keep the meter reading on scale.


1. What is the advantage of using a computer to control the wavelength and scanning of the monochromator, when we have a perfectly good stand-alone controller box that can scan at variable rates? If you were to use the stand-alone controller box, how would the computer know what wavelength the monochromator is on at any particular point in a scan?

2. What is the maximum scan rate, in nm per min, you can get? Is this a limitation of the computer pro gram speed or of the hardware?

3. What is the advantage of using the TIMER function to control scanning rate compared to the use of a do-nothing loop?

Lab Report: Submit your program listings on paper or on diskette.

This page is maintained by Tom O'Haver , Department of Chemistry and Biochemistry, The University of Maryland at College Park. Comments, suggestions and questions should be directed to Prof. O'Haver at