Laboratory Interfacing Using the LabVIEW Software Package

settable) with 12-bit accuracy, and which can also sup- ply several programmable output voltages and multiple switchable TTL-level voltages.2 Our appl...
0 downloads 0 Views 67KB Size
Information • Textbooks • Media • Resources

computer bulletin board

Laboratory Interfacing Using the LabVIEW Software Package Paul J. Ogren Department of Chemistry, Earlham College, Richmond, IN 47374 Thomas P. Jones Department of Chemistry, Carroll College, Waukesha, WI 53186 Several interfacing applications based upon LabVIEW®1 have been developed at Earlham College for the physical chemistry laboratory program and for analytical research in remote colorimetric sensing. The flexibility of LabVIEW, including the programming features, is well suited to student use (1). In our case, we have used National Instruments interface boards, which can monitor several voltages in the ±5 V d.c. range (jumper settable) with 12-bit accuracy, and which can also supply several programmable output voltages and multiple switchable TTL-level voltages.2 Our applications use Macintosh computers, but very similar hardware and software is available for Windows systems. In physical chemistry, students are first familiarized with the interface system by using a voltage monitoring program (EMF) to follow voltage changes during a potentiometric titration (2). Each student selects some common example of such a titration (other than pH), prepares the necessary reagents, wires up the system, and collects the data. The data are stored by the LabVIEW program in a format which can then be read and analyzed in detail by a standard spreadsheet program such as Excel. In an early version, titrant was added from a

Figure 1. Monitor display of the potentiometric signal (top chart) from a titration of 0.0050 M Fe2+ with 0.0050 M Ce4+ . Measurements were made with a Pt–saturated calomel electrode pair. The lower chart shows the photocell voltage resulting from a HeNe laser beam interrupted by discrete drops. Only the most recently acquired drops are shown in this rolling display. The black arrow is a cursor used to start the acquisition program and to control program interrupts for procedures such as data filing.

simple constant-addition-rate motorized buret, the addition rate being one of the program parameters. More recently, we have used a second input line to obtain the necessary volumetric data by monitoring the drop count from a standard buret. To accomplish this, a HeNe laser beam is passed just below the buret tip. At a slow discrete drop rate, the beam is interrupted most of the time, but the voltage changes abruptly when the drop falls and the light beam temporarily reaches a photodetector. The drop rate slows appreciably as the buret drains unless the student carefully adjusts the stopcock; alternatively, use of the Mariotte method for creating a constant hydrostatic pressure keeps the drop rate reasonably constant (3). Figure 1 shows a typical monitor display during an experiment where Fe2+ is titrated with Ce4+ . The lower trace on the display (“Panel” in LabVIEW jargon) shows the drop signal, and the upper trace shows the titration curve. These graphs provide a real-time indication that

Figure 2. This section of the program “Diagram” measures laser light voltages for drop counting. The large “page” icon with N in the upper left corner is an N-cycle loop. On the lower left, the Total mL and mL/Drops values, both user-specified entries on Panel 1, are combined to give the number of drops, and this value is directed to the loop structure by the output line connecting to N. The gray boundary between the two inner “filmstrip” structures is a While loop, which cycles until the light voltage, measured by the READ and SCALE icons, rises above a threshold value. At that point, a drop has fallen, the light is unblocked, and the potentiometric titration voltage, read in a previous operation, is processed for filing. The V and mL lines on the lower right represent data arrays that are transferred to a later element in the outer sequence structure for filing.

Vol. 73 No. 12 December 1996 • Journal of Chemical Education

1115

Information • Textbooks • Media • Resources

the experiment is proceeding as expected; better potentiometric plots are obtained by later spreadsheet processing of the stored data. Figure 2 shows a part of the LabVIEW “Diagram” that controls the acquisition program. In the language of LabVIEW, one creates the program by selecting the symbols in the diagram from a menu, and then defining data collection and manipulation by lines (“wires”) drawn with a wiring tool to connect the icons. (Some of the symbols also appear as input and output displays on the Panel.) Sequences of operations are defined by enclosures such as the large “film strip” border of the figure, which indicates that this diagram is the third element of a sequence. (In this case the first element (0) configures the interface board prior to operation, and the second element (1) detects formation of the first drop from the buret.) In the same physical chemistry course, students construct a simple op-amp-based circuit for obtaining cyclic voltammograms. This uses the voltage output feature of the interface board as well as the response current (converted to voltage). An earlier version of this experiment has been described previously (4 ). The LabVIEW programming language has made it particularly easy to add the useful feature of starting at any point in the voltage cycle and moving in either an oxidizing or a reducing direction. Both of the previous experiments use a “canned” program to collect the data. We also want students to understand something about how the acquisition is controlled at the level of the LabVIEW program. Therefore, as a follow-up to the titration experiment, we provide a generic I/O program similar to the early EMF program and ask students to modify it to do something else. Examples include (i) monitoring a thermistor-derived voltage during a calorimetry experiment (and using the thermistor calibration to convert the voltage to temperature); (ii) following a titration photometrically using a white light source, filter, and photodetector; (iii) counting drops (done when the earlier version of the EMF experiment is used); (iv) generating and plotting slow square waves, sawtooths, etc., using the output voltage feature; (v) monitoring almost any other reasonable d.c. signal—for example, we have a continuous local ozone monitor, which produces a signal suitable for creating diurnal concentration plots. Fairly simple modifications to the generic program will suffice for these projects. Students must become familiar with a short list of LabVIEW programming features: for example, how to select icons for arithmetic operations, how to use loop structures to average several readings, how to control the timing of voltage readings, how to “wire” icons together. To some extent, the difficulty of a project can be adapted to the abilities of the student. A first caution is that LabVIEW programming is unusual enough that some one-on-one instruction is usually required. This, coupled with some written stepby-step guidelines, will get most students under way. A second caution is that the interface board can be dam-

1116

aged by voltages that are too high. The maximum range for the Lab-LC board is ±45 V d.c., which is unlikely to be exceeded in any of the above experiments. As a final example, LabVIEW has also been used in the operation of single- and dual-wavelength fiber-optic photometers for use with optical sensors. These applications utilize analog output (to control light sources) and input (to monitor detector signals). In the singlewavelength photometer, a light-emitting diode (LED) is electronically modulated at 400 Hz to allow subtraction of signal from background radiation. The transmitted intensity from a chemical-sensing probe is detected by an amplified photodiode. The dual-wavelength photometer is similar, but has two LED light sources of different wavelengths, a fiber-optic beam splitter (which combines the light from the two light sources and divides it into sample and reference channels), and two photodiode detectors (sample and reference). The LabVIEW program determines the absorbances at the two wavelengths and displays them graphically as a function of time. Our emphasis in this paper has been upon applications of LabVIEW to direct interfacing of experiments. Further information and copies of programs for the earlier applications are available upon request from PJO. TPJ should be contacted for information on the operating details of the last item, the operation of fiber-optic photometers. LabVIEW can also be used for the versatile control of a wide range of commercial instruments, and this can contribute to its cost effectiveness in an educational setting. For example, we have used this package for GPIB-based control of a diode array spectrophotometer, a programmable digital voltmeter, and a digital oscilloscope. Acknowledgment Early work on some of these applications was supported in part by NSF grant USE-8750543. Notes 1. LabVIEW and NI-DAQ are trademarks of National Instruments Corporation. The company has an extensive web site at http://www.natinst.com/ 2. The example of Figures 1 and 2 was obtained using a Macintosh LCII system equipped with a National Instruments LabLC board (NI-DAQ software supplied) with connections to a CB50 I/O connector block. To prevent inadvertent tampering with the connector lines, the block was enclosed in a Radio Shack project box with two input and two output lines wired to banana plugs.

Literature Cited 1. The “Getting Started” and “User” manuals supplied with the software by National Instruments are clearly written resources for the instructor and for advanced students. A more general presentation may be found in: Johnson, G. W. LabVIEW Graphical Programming; Mc Graw-Hill: New York, 1994. 2. Two relatively recent discussions of similar experiments in this Journal are: (a) Meyer, E.F. J. Chem. Educ. 1992, 69, A158-A160; and (b) Mak, W. C.; Tse, R .S. J. Chem. Educ. 1991, 68, A95–A96. 3. Lynch, J. A.; Narramore, J. D. J. Chem. Educ. 1990, 67, 533–535. 4. Ontko, R. J.; Russell, R. N.; Ogren, P. J. J. Chem. Educ. 1986, 63, 325–326.

Journal of Chemical Education • Vol. 73 No. 12 December 1996