Integration of National Instruments' LabVIEW Software into the

Modern analytical instruments controlled by computer workstations equipped with LabVIEW have been used to enhance the investigative nature of a studen...
0 downloads 0 Views 128KB Size
Information • Textbooks • Media • Resources

Integration of National Instruments’ LabVIEW Software into the Chemistry Curriculum1 Steven M. Drew Department of Chemistry, Carleton College, Northfield, MN 55057 Using and understanding chemical instrumentation is an important part of being a chemist. All of the most powerful qualitative and quantitative chemical techniques are now performed by some form of chemical instrumentation such as NMR, HPLC, or ICP-MS. Nowadays, one of the integral components of any instrument is its central computer system, which is often a specialized desktop PC. This PC usually controls the instrument, collects data, and reduces the data into a usable form via a user interface consisting of specialized software. Computers are also used in research and development laboratories to control newly developed instruments and automate bench-top experiments. In these cases chemists must integrate their knowledge of computers and interfacing hardware and software to develop their specialized computer-assisted experiment. Therefore, a working knowledge of computer interfacing for the acquisition and analysis of chemical data can be very valuable in research involving new instruments or repetitive chemical analyses. The development of this knowledge base should start at the undergraduate level, especially for students who have an interest in analytical or physical chemistry. Ideally, students should have the opportunity to obtain hands-on experience with computerassisted experimentation including computer basics, elementary electronics, data acquisition, serial communication, and finally, software control. Of all these topics, software is probably the most central, for it is the “glue” that holds a computer-assisted experiment together. The software must effectively control the experiment, acquire the data at the appropriate times, and reduce the data to a usable form. Recently National Instruments’ LabVIEW software system has evolved as the industry’s standard for control of instrumentation and acquisition of experimental data. Of LabVIEW’s many features, perhaps the most useful is the intuitive, graphical nature of the programming environment and user interface. From an educator’s point of view, the graphical nature of LabVIEW is ideal for students at all levels of the chemistry curriculum. LabVIEW allows students to draw a visual representation of a software process rather than writing a procedural code following an exact syntax. Another important pedagogical advantage of LabVIEW is its unequaled breadth and depth. Novices can begin programming and using LabVIEW to acquire data through an interface board with just a few class periods of practice, yet LabVIEW is extensive enough to fulfill the needs of experts who must acquire experimental data under the most demanding research conditions. At Carleton College we have taken advantage of LabVIEW’s graphical user interface to design computerassisted experiments for our lower-division laboratories. In our upper-division instrumentation laboratory we have taken advantage of the graphical nature of LabVIEW’s programming language to give chemistry

majors hands-on experience with the design and operation of computer-assisted experiments. LabVIEW has also become an important tool in facilitating student– faculty research. This paper provides an introduction to LabVIEW and some examples of how LabVIEW has been applied in Carleton’s chemistry curriculum and research program. LabVIEW: An Introduction LabVIEW is a graphical programming language with virtual instrument (VI) capability. A VI is a software version of an instrument that is built on two levels: a front panel and a diagram. The front panel contains the controls, buttons, dials, graphs, and displays through which the user can interact with an instrument or an experiment. The diagram is the code that controls the front panel and communicates with the instrument through the appropriate interface board. A LabVIEW diagram is unique in that the code is not procedural but rather graphical, consisting of structures, wires, and icons. VIs can be compiled into stand-alone executable applications. VIs are also designed to be portable between various computer platforms. Currently supported platforms include Macintosh, PC/Windows, HP-UX, Sun, and Power Macintosh. LabVIEW supports serial communications (RS-232), data acquisition (DAQ) boards, and general-purpose interface boards (GPIB). LabVIEW 3.1 was recently reviewed in Analytical Chemistry (1). An example of a LabVIEW VI front panel and diagram in action is shown in Figure 1. This VI monitors the output of a pH meter via a DAQ board. The pH reading is displayed numerically and in a strip chart graph on the front panel (Fig. 1A). The code that controls the front panel is shown in the diagram (Fig. 1B). The diagram executes in parallel, meaning that when all the inputs for an icon are satisfied the icon will execute its function. The icons are enclosed in a while loop structure. Thus, these icons will execute with each iteration of the while loop until a false boolean is received by the conditional terminal. The “Quit” button on the front panel generates the false boolean for this operation. Of course, LabVIEW has its share of problems. Perhaps the most intimidating one is cost. LabVIEW is expensive. The latest version of the full development system excluding the software needed to convert VIs into stand-alone executables lists for $1,995. However, National Instruments does offer sizable academic discounts of up to 70%. Additionally, LabVIEW requires a fairly top-of-the-line computer. For example, when we started with LabVIEW we purchased four Macintosh IIci’s to equip as data acquisition workstations. In three years our computers were essentially outdated. The version of LabVIEW that we currently use runs quite slowly on our “outdated” computers, requiring us to find funds for computer upgrades. LabVIEW is also a memory hog, requir-

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

1107

Information • Textbooks • Media • Resources

ing at least 6 MB of RAM and 20 MB of hard disk space. In spite of these financial and hardware constraints, we still believe that LabVIEW is a very worthwhile investment at the undergraduate level. Some Specific Applications of LabVIEW at Carleton We have integrated the use of LabVIEW at all levels of the chemistry curriculum. In lower-division courses, such as introductory chemistry and sophomore analytical chemistry, intuitive LabVIEW virtual instruments have been designed by the instructors to run specific instrumental tasks for the students. In contrast, upper-division courses for majors have focused on learning how to use LabVIEW to control experimental apparatus designed and built by students. Perhaps the two courses that have been most affected by the acquisition of LabVIEW-equipped data acquisition workstations are our sophomore-level analytical chemistry course and our senior-level chemical instrumentation course. Carleton’s sophomore analytical chemistry course has been totally redesigned in an attempt to teach more instrumentation suitable for sophomores interested in chemistry and biology. These changes have been possible largely because of our department’s acquisition of LabVIEW. Our revised sophomore analytical course now focuses on UV-visible spectrophotometry, statistics, fluorometry, liquid chromatography, potentiometry, acid/base chemistry, complex-ion chemistry, and electrochemistry. In addition, the approach to laboratory work in this course is now quite different. We have started to use a role-playing model in lab similar to the model developed by John Walters at St. Olaf College (2). Groups of four students are assembled. Each member of each group cycles through each of the roles (group leader, chemist, hardware specialist, and software specialist) over the span of four weeks. For more details on this interesting approach to lab work see John Walters’ excellent series of articles in Analytical Chemistry (2). One key to making a role-playing lab experience work is that each research group member must have a viable job to do in order to complete the assigned experimental problem. Thus the hardware specialist should have an extensive experimental apparatus to assemble and operate, the chemist should have an important set of chemical manipulations to perform, and the software specialist should have software to learn, program, and use. Therefore each group has its own set of equipment and glassware and a LabVIEW-equipped data acquisition workstation. Each group is assigned a full set of glassware and the equipment and supplies listed in Table 1. With these supplies each group can assemble several different apparatuses. For UV-visible spectrophotometry, a Hewlett Packard 8452A diode-array spectrophotometer can be configured in two different ways. To obtain a spectrum of a solution the students can fill the spectrophotometer’s flow cell with solution using a syringe, as seen in Figure 2A. This method eliminates the need for extensive cell handling, is fast, and requires only 1 to 2 mL of solution. In this case the diode-array spectrophotometer is controlled by the LabVIEW VI front panel shown in Figure 3, called “HP 8452A Spectra”. The HP 8452A Spectra VI in Figure 3 is shown in action as it collects a UV spectrum of an aspartame solution. For quantitative determinations we have our students use flow injection analysis (FIA). We like to use FIA because it is a good introduction to analytical detection in flowing streams, an important concept in chromatography.

1108

The supplies for each group contain sufficient equipment to set up the apparatus shown in Figure 2B. The syringe pump and diode-array spectrophotometer are each controlled by separate LabVIEW VIs. The front panel for the HP 8452A FIA VI is shown in Figure 4 as it collects FIA data on aspartame solutions. Note that all these VIs are designed to be modular, simple, and intuitive so that students can quickly learn the ropes of running a particular experiment, leaving valuable lab time for continuing open-ended investigation. Nearly the entire laboratory program in our sophomore analytical chemistry course has been affected by the acquisition of LabVIEW. Almost all the experiments are now controlled through intuitive LabVIEW VI front panels. As an example we have the students analyze artificial sweeteners such as Sweet ’n Low and Equal. After examining the contents listed on the artificial sweetener package each group designs an FIA experiment to determine the weight percent of sweetening agent present. For example, through some library work stu-

A.

B.

Figure 1. Example of a LabVIEW VI capable of monitoring the analog output of a Chemtrix pH meter. A. Front panel in action as it collects data for a pH measurement and displays it on the strip chart graph. B. Diagram that controls the front panel.

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

Information • Textbooks • Media • Resources

dents determine that aspartame is the sweet component of Equal sweetener. They then look up the structure of aspartame, determining that its structure indeed contains a chromophore suitable for UV spectrophotometry and FIA. Before the FIA determination can be made standard solutions of aspartame must be prepared by the group. Using the diode-array spectrophotometer and the appropriate LabVIEW VI the best wavelength for the FIA determination is found using one of the standard solutions. Next, each of the standard aspartame solutions is injected into the FIA apparatus, which has been assembled by the students and interfaced to the appropriate LabVIEW VI. These solutions appear as peaks on the absorbance vs. time trace displayed by the FIA LabVIEW VI. An Excel plot of some FIA data is shown in Figure 5. The sample of Equal dissolved in carrier solution is then injected into the FIA apparatus. Using an Excel spreadsheet the peak height of the standards vs. concentration data are plotted and statistically analyzed by the method of linear least squares. The replicate measurements made of the standards increase the statistical certainty in the best fit line that serves as a calibration curve. Using the regression statistics and the equation for the calibration line, the students then determine the weight percent of aspartame in Equal and a corresponding uncertainty at the 95% confidence level. After achieving the assigned experimental goal, student research groups are free to pursue their own openended investigations, such as investigating another artificial sweetener or preparing a sample with a known amount of aspartame to verify the accuracy of their experimental methods. Such an extensive analytical experiment including the open-ended investigation would not be possible within a four-hour lab period without the combination of LabVIEW-equipped data acquisition workstations and the role-playing lab setting. Some other examples of lab experiments in our sophomore analytical chemistry course that take advantage of LabVIEW VIs include the FIA determination of the amount of vanillin in imitation vanilla extract (3), the multicomponent spectrophotometric analysis of Dristan nasal spray (4), the pH titration of an unknown diprotic acid (5), and the FIA determination of the amount of iron in fortified breakfast cereal (6). The development of our senior level chemical instrumentation course has also been driven by our department’s acquisition of LabVIEW. This course emphasizes hands-on experience with electronics, instrument design, instrument–computer communications, and digital signal processing as applied to chemistry. The LabVIEW-equipped data acquisition workstations are programmed by students to control instrumentation and apparatus constructed as part of their course work. Class meetings occur in the lab to accommodate a course structure of very short introductory lectures (15–20 min) followed by hands-on student investigation with the computers, electronics, and instrumentation. The first five to six weeks of this course are spent introducing students to LabVIEW programming, analog electronics, digital electronics, DAQ principles, LabVIEW control of the DAQ board, and LabVIEW control of serial communications. The last half of the course is spent designing and constructing instrumentation for two assigned experiments and one experiment of the students’ own choosing. The assigned projects in this course include an ion selective electrode (ISE) experiment and a serial communications experiment. For the ISE experiment we ask students to construct a potentiometer circuit and an ISE

Table 1. Research Group Supplies for Sophomore Analytical Chemistry Course • Hewlett Packard 8452A diode-array spectrophotometer equipped with a GPIB cable and a 30 µL flow cell • Data acquisition computer workstation equipped with LabVIEW, GPIB board, and DAQ board • Syringe pump equipped with serial cable • pH meter equipped with DAQ cable • Tubing and fittings kit: assorted teflon tubing with fittings attached, 6-port injection valve, 100 µL and 250 µL injection loop, leur lock adapters • 1000–100-µL adjustable Eppendorf pipet • 10-mL gas-tight syringe • 60-mL and 5-mL plastic syringes

Figure 2. HP 8452A diode-array spectrophotometer experimental configurations. A. Configuration for obtaining UV-visible spectra of a solution. B. FIA configuration.

Figure 3. LabVIEW front panel titled “HP 8452A Spectra” for the acquisition of spectral data using a HP 8452A diode-array spectrophotometer. The VI is shown in the process of obtaining a spectrum of an aqueous aspartame (1.0 mg/mL) solution. Note the entry boxes for the wavelength range of the spectral measurement and the labeled buttons to set a blank (Reference) and obtain a spectrum (Measure). A cursor is available to display individual absorbance readings along the spectrum.

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

1109

Information • Textbooks • Media • Resources

Figure 4. LabVIEW front panel titled “HP 8452A FIA” for the acquisition of FIA data using a HP 8452A diode-array spectrophotometer. The VI is shown in the process of obtaining FIA data for a series of aspartame standards for the analysis of Equal sweetener. Experimental conditions are described in Figure 5. Note the slide bar to select a wavelength to monitor as a function of time. In addition, note the two cursors that can be used to determine the height of each peak for the construction of a calibration curve.

0.34 1.022 mg/mL

0.29 Equal

0.767 mg/mL

Absorbance

0.24 0.19

0.511 mg/mL

0.14 0.256 mg/mL

0.09 0.04

Conclusions

-0.01 0

100

200

300

400

500

600

700

800

Time (s)

Figure 5. FIA data for aspartame standard solutions and Equal solution. Detector: HP 8452A, λ = 258 nm; injection: 100 µL sample loop; carrier solution: 0.1 M dextrose; flow rate: 1 mL/min.

1110

flow cell/FIA apparatus suitable for the determination of potassium in serum (7). The entire instrument is monitored through the DAQ board of a workstation via a LabVIEW VI that the students program. The other assigned project asks students to write a LabVIEW VI to control an instrument through a serial connection. A syringe pump, peristaltic pump, balance, pH meter, and monochromator, each equipped with a RS-232 interface, are available for this project. Experiments planned for future offerings of this course that will take advantage of the LabVIEW-equipped workstations include a fast Fourier transform analysis of an IR interferrogram and the control of a student-built potentiostat in an anodic stripping voltammetry experiment (8). The LabVIEW-equipped data acquisition workstations have also been quite useful in other laboratories, apart from the applications discussed above for analytical chemistry courses. For example, at several levels of our curriculum we have instituted kinetics experiments that take advantage of LabVIEW and the HP 8452A diode-array spectrophotometer. The LabVIEW front panel for acquisition of spectrophotometric kinetics data allows students to select a wavelength, a time increment, and a delay, and to see an absorbance vs. time plot of the data as they are being acquired. We have taken advantage of this LabVIEW-controlled spectrophotometer for collection of kinetics data at the introductory level to investigate the reaction of ferrimyoglobin with fluoride ion (9), and at the junior level to investigate how pH affects the rates of ligand substitution reactions at cobalt coordination compounds. In addition, students in our junior-level laboratory course use this LabVIEWcontrolled instrument for an independent kinetics project of their design. The intuitive nature of the kinetics LabVIEW front panel again enables students to devote most of their valuable lab time to chemical investigation rather than instrument training and operation. The use of LabVIEW at Carleton has also become an important part of student–faculty research. This is a credit to the depth of the software, which allows it to handle the rather complex data acquisition and instrumental control problems that can be part of a research project. Three faculty members now use LabVIEW to control experiments that are part of their continuing research with undergraduates. LabVIEW VIs have been written by students for research purposes to acquire cyclic voltammetric data in one research group and time of flight mass spectrometry data in another. We find that the visual nature of LabVIEW makes dissemination of the program to new members of the research group quite easy. New group members seem to be able to quickly discern the nature of a particular VI and are soon tweaking various parts of the diagram to suit their individual experimental needs.

Modern analytical instruments controlled by computer workstations equipped with LabVIEW have been used to enhance the investigative nature of a student’s laboratory experience at Carleton. The overall aim of this continuing project has been to provide students with user-friendly analytical tools that will improve their ability to quickly perform chemical analyses, in turn leaving more laboratory time for experimental design and open-ended investigation. We have found that LabVIEW can be used as a central laboratory software system that can be customized by the instructor to fit specific experi-

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

Information • Textbooks • Media • Resources

mental needs and programmed by students with minimal training. In lower-division courses, such as introductory chemistry and sophomore analytical chemistry, intuitive LabVIEW VIs have been designed by the instructors to run specific instrumental tasks for the students. The time saved by providing students with intuitive LabVIEW VIs to control their instruments has generated more lab time for open-ended investigation. Upperdivision courses for majors have focused on learning how to program and use LabVIEW to control experimental apparatus designed and built by students. Finally, student–faculty research has also benefited from intuitive, student-designed LabVIEW VIs that operate research apparatus. The fact that we have found LabVIEW to be a useful tool in the education of undergraduates at all levels of our chemistry curriculum indicates the unusual depth and functionality of this software product. Acknowledgments The author wishes to acknowledge the generous support of the National Science Foundation Instrumentation and Laboratory Improvement Program (DUE9251226), the 3M Foundation, and Carleton College. Note 1. Presented as part of a symposium on NSF Catalyzed Innovations in the Undergraduate Laboratory at the 208th National ACS Meeting in Washington, DC, on 22 August 1994.

Literature Cited 1. 2. 3. 4. 5. 6. 7. 8. 9.

Walters, J. P. Anal. Chem. 1995, 67, 34A–35A. Walters, J. P. Anal. Chem. 1991, 63, 977A–985A, 1077A–1087A, 1179A–1191A. Ainscough, E. W.; Brodie, A. W. J. Chem. Educ. 1990, 67, 1070–1071. Williams, K. R.; Cole, S. R.; Boyette, S. G.; Schulman, S. G. J. Chem. Educ. 1990, 67, 535. Ramette, R. W. Chemical Equilibrium and Analysis; Addison–Wesley: Reading, 1981; p 658. Ref 5; p 635. Meyerhoff, M. E.; Kovach, P. M. J. Chem. Educ. 1983, 60, 766–768. Pomeroy, R. S.; Denton, M. B.; Armstrong, N. R. J. Chem. Educ. 1989, 66, 877– 880. Russo, S. O.; Hanania, G. I. H. J. Chem. Educ. 1990, 67, 352–355.

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

1111