Information • Textbooks • Media • Resources
Teaching Analytical Instrument Design with LabVIEW1 Rudy Gostowski* Department of Chemistry, Austin Peay State University, Clarksville, TN 37044
Chemists are frequently called upon to set up, troubleshoot, and repair—and sometimes construct—the instruments they use for analytical measurements. These challenges may occur in industrial settings or in graduate school. The first experience in “looking under the hood” of an analytical instrument can be quite intimidating. To reduce this fear of the unknown, it seemed reasonable to extend to students an introductory opportunity for hands-on experience with some examples of the essential components of modern instruments (signal transducers, electronic circuits, and computer hardware and software). This experience was offered in the Advanced Instrumental Methods course at Austin Peay State University. Within the chemistry curriculum, students are first introduced to modern analytical instrumentation in the second half of Quantitative Analysis. This introduction includes spectroscopy, separations, and analytical electrochemistry. Next in the sequence, the Instrumental Analysis course focuses on instrumentation from the aspects of the physical properties measured, the application of the instrument in analysis, and interpretation of the data acquired. For many students these two courses provide sufficient background in analytical instrumentation. However, some students will find this experience incomplete and require further understanding of instrument design. Students planning to work in analytical laboratories or intending to pursue advanced study involving physical measurements with instruments are encouraged to enroll in Advanced Instrumental Methods. A primary goal of the Advanced Instrumental Methods course was to provide students with the skills needed to construct a simple analytical instrument. These skills included the design and fabrication of electronic circuits and computer programming in a data acquisition language (LabVIEW, National Instruments, Austin, TX). LabVIEW was chosen as the data acquisition program for the course because it facilitates fast program development, provides many powerful built-in functions, and has universal acceptance in research and manufacturing settings. In this graphical language the program is written by placing and connecting icons that represent various built-in and user-developed functions on a block diagram. The connection of icons results in data flow execution of program nodes. This is ideally suited for the collection and distribution of data in analytical experiments. A voltammetry instrument (1) was selected for the course project because it required minimal sophistication in the transducers, circuits, and data manipulation. As seen in the outline in Table 1, the course integrates many different subject areas, such as electronics, programming, and electrochemistry. Any of these areas considered separately would be too narrow for an undergraduate course, but as a unit they will introduce students to some aspects of instrument design.
Electronic Circuit Design
Introductory Concepts The electronics portion of the course began with a review of the basics of electricity and the use of equivalent circuits for analysis. The material quickly moved to integrated circuits because these devices permit the construction of useful circuits without extensive consideration of design parameters. The concepts of circuit function were explained in lecture and in an appropriate text (2) and in supplemental references (3). This provided the basis for hands-on experience in each area of circuit design, as in the experiments found in Table 2. Electronic test equipment such as volt–ohm meters (VOMs), function generators, and oscilloscopes was introduced in lecture and used in the lab to examine circuit characteristics. These devices were also discussed in the text and in supplemental references (4). Electronic test equipment listed in Table 3 was provided at each laboratory station in a virtual form by means of a multiTable 1. Course Outline Basic Circuits Electronic Test Equipment Diodes, Transistors and Operational Amplifiers Digital Electronics, Analog-to-Digital Conversion, Digital-to Analog Conversion, and Digital Signal Processing LabVIEW Programming Concepts LabVIEW Waveform Input/Output LabVIEW Data Storage and Processing Electrochemical Theory Voltammetry
Table 2. Electronic Circuit Experiments Reading Resistance Values Equivalent Circuits and Ohm's Law RC Circuits and Passive Filters Half-wave Rectifier with Filter Capacitor Loading and a Voltage Follower Inverting Amplifiers and Active Filters Electrochemistry Function Generator Potentiostat and Current-to-Voltage Converter
Table 3. Virtual Instruments Provided by LabVIEW Software and DAQ board Logging Voltmeter Strip Chart Recorder Oscilloscope XY Recorder
*e-mail:
[email protected] Function Generator
Vol. 73 No. 12 December 1996 • Journal of Chemical Education
1103
Information • Textbooks • Media • Resources
function data acquisition (DAQ) board (Lab-PC+, National Instruments) and the graphical user interface (GUI) found in the LabVIEW program. In the strict sense, virtual instruments are computer programs. However, in a broader view, virtual instruments result from the combination of these programs with the appropriate DAQ board. These “virtual instruments” provide the same functions as their traditional counterparts. However, supplying instruments in this format is more costeffective than purchasing the individual instruments and provides greater functionality, since data are readily available in the computer.
Electrochemistry Function Generator A function generator circuit taken from the design of Albahadily and Mottola (5) was constructed (Fig. 1) to provide the stimulating waveform (havertriangle) for electrochemical experiments. The operation of the function generator was checked by means of a LabVIEW virtual stripchart recorder. The waveform supplied by this circuit was a triangle beginning at some starting value, ramping to a switching potential, and returning to the original value. This analog circuit was replaced in the later electrochemical experiments with the data acquisition board and an appropriate LabVIEW program. Digital waveform generation was compared to the traditional analog approach. Potentiostat and Current-to-Voltage Converter A typical (6) potentiostat and current-to-voltage converter were constructed (Figs. 2 and 3, respectively). The potentiostat insured that the potential applied to the cell was the value intended and was not perturbed by processes at the electrode. This was accomplished by a comparison to a reference electrode having a stable potential. The current-to-voltage converter produced a voltage proportional to the current resulting from the electrochemical process. A plot of current vs. applied potential was drawn by the virtual XY recorder using the voltage from the current-to-voltage converter and a monitor of the applied potential from the potentiostat. In later experiments, the waveform generator and XY recorder functions were both provided by a data acquisition board and the LabVIEW software.
Figure 1. Electrochemistry Function Generator.
Figure 2. Potentiostat.
Data Acquisition Programming
Fundamental Concepts Data acquisition programming allows a computer such as a desktop PC to record, manipulate, and display data; to produce stimulating signals; and in some cases, to control and manage the overall experiment. Computers, aside from providing the computations necessary for data manipulation, are reliable record keepers and reduce errors in repetitive tasks frequently encountered in analytical experiments. LabVIEW GUI LabVIEW provides a built-in graphical user interface (GUI) or front panel. The similarity of the front panel to real instruments allows the development of virtual instruments (VI’s), which may be given their own icons and dropped into future programs. Students appreciate the graphical nature of LabVIEW. They often remark that programming is fun and takes on the qualities of a video game. However, the program is quite serious, offering functions (e.g., fast Fourier transform) that extend beyond the present scope of this course.
1104
Figure 3. Current-to-voltage converter.
Table 4. Electrochemical Virtual Instruments Waveform Generation and Acquisition VI CV Waveform VI Update Rate VI Electrolysis VI Electrochemistry Instrument VI
Journal of Chemical Education • Vol. 73 No. 12 December 1996
Information • Textbooks • Media • Resources
LabVIEW Programming Students received instruction in LabVIEW programming by a combination of lectures and practice with the software. This began by working through the examples found in the tutorial manual (7) in the same sequence as these topics were covered in lecture. These topics included the front panel, the block diagram, building a VI, arrays and strings; loops; case and sequence structures; charts and graphs, file input and output, data acquisition, and debugging. Students then worked through the “Getting Started” and “Example VI’s” sections of the Data Acquisition VI Reference Manual (8) to gain experience in analog input and output, counter and timers, and digital input and Figure 4. Waveform Generation and Acquisition virtual instrument block diagram. output. Different strategies in data acquisition were discussed to determine which would be most appropriate for a particular analytical experiment. To better understand the procedure by which the processor of a computer handles multiple tasks, the operation of the priority scheduler was explained in terms of a queue and interleaving (9). Analytical instruments require the computer to manage multiple tasks and to utilize different schemes de- Figure 5. Cyclic Voltammetry Waveform virtual instrument block diagram. pending on the type of analysis desired. that would perform various electrochemistry experiA logical approach to design of LabVIEW applications ments. This assignment was stated as follows: is the canonical VI (10). The canonical VI represents methods of organizing tasks into modules that may be Write a VI which will take a starting potential combined to form the application. Some canonical VI’s and a switching potential and generate a 1000-point considered included the initialize, loop, and shutdown; array specifying a triangle wave for cyclic voltammeindependent loops; the client-server; menu-driven and try experiments. Use a Ramp Pattern VI to generate the state machine. These VI’s provide a framework from an array describing a ramp for linear scan experiwhich a particular application may be generated. VI’s ments. A third VI should be written which will take useful for electrochemical experiments were written and the starting potential, the switching potential, and the are listed in Table 4. voltammetry scan rate (V/s) and determine the upWaveform Generation and Acquisition for Electrochemistry VI After the students had sufficient experience with LabVIEW programming they were presented with the following assignment: Write a VI which outputs an array specifying the stimulating waveform and records two channels of data. The output and the input must start at the same time and continue until both are finished.
It soon became clear that by placing the start icons for both operations in one sequence structure the two tasks would begin at the same time. However, the data array must be loaded into the output buffer and both tasks configured before the start icons. A wait icon caused the program to pause until all of the points in the output buffer were written. Since two channels of input were multiplexed, the number of points acquired was twice the number generated. This scheme resulted in both tasks ending at the same time. The block diagram for this VI is shown in Figure␣ 4. An icon and a connector panel were created that allowed this VI to be used in an electrochemistry instrument program.
Computer-Controlled Electrochemistry Instrument VI The final programming assignment placed the Waveform Generation and Acquisition VI within a program
date rate for the Waveform Generation and Acquisition VI. Combine these VI’s to produce an instrument which can accomplish cyclic voltammetry, linear scan, and stripping analysis experiments. Stripping analysis requires a timed electrolysis prior to a linear scan.
Two Ramp Pattern VI’s were combined to produce the triangle wave. The block diagram of this VI is shown in Figure 5. The starting potential was the initial value for one ramp and the final value for another. The switching potential was the final value for the first ramp and the initial value for the second ramp. Each VI produced an array of 500 samples. The two ramps were combined with a Build Array VI that yielded an array of 1000 samples. A second Build Array VI was used to convert the array into a two dimension array. However, this array only has elements in one column. A Transpose 2D Array VI was used to convert the array from a row major to a column major configuration as required by the AO Write VI. The update rate was determined by multiplying the absolute value of the difference of the start potential and the switching potential times the reciprocal of the voltammetry scan rate (V/s). This yielded the time period of the experiment in seconds. Dividing the number of updates by the period gave the update rate (updates/s) for a linear scan experiment. Dividing the linear scan update rate by two resulted in the update rate for a cyclic voltammetry experiment. The block dia-
Vol. 73 No. 12 December 1996 • Journal of Chemical Education
1105
Information • Textbooks • Media • Resources
gram for the Update Rate VI is shown in Figure 6. The Electrolysis VI provided a timed electrolysis before any further voltammetry as required for stripping analysis. It consisted of an AO Write One Update VI and a Wait VI. The block diagram of the Electrochemistry Instrument VI is shown in Figure 7. An artificial data dependency was created to a case structure which was used to select the proper stimulating waveform array for cyclic voltammetry, linear scan, or stripping analysis. This array was feed to the Waveform Generation and Acquisition VI along with the update rate and the scan rate from the Voltammetry Scan Rate VI. The output was displayed by using an XY Graph front panel indicator or could be saved to a file. Voltammetry Experiments
Fundamental Concepts Voltammetry refers to a group of dynamic interfacial electrochemical experiments. These experiments involve the observation of current generated in response to a potential applied at a polarized working electrode. This current provides analytical information about the concentration of the analyte. It is also related to the diffusion coefficient of the analyte, to the scan rate, and to the radius of the working electrode chosen for the experiment. In a manner similar to spectroscopy, voltammetry is also useful for the qualitative identification of analytes owing to their often unique standard potential. While providing an abundance of data, voltammetry has relatively modest experimental requirements. These in-
Figure 6. Update Rate Virtual Instrument block diagram.
clude (i) a means of generating the stimulating waveform; (ii) a potentiostat and a reference electrode to maintain the desired potential; (iii) a working electrode where the electrochemical process of interest occurs; (iv) a current-to-voltage converter; (v) a means of recording the current response vs. the applied potential; and (vi) a counter electrode to avoid the passage of current through the reference electrode. Initially the stimulating waveform was generated by an analog circuit (Electrochemistry Function Generator). Later, this was accomplished digitally by the DAQ board and a LabVIEW program (Electrochemistry Instrument VI). The potentiostat shown in Figure 2 was used with a saturated calomel reference (Corning, Model 476002). Since all of the experiments were done in aqueous solution, a glassy carbon working electrode was selected (Bioanalytical Systems, Inc. Stock #MF-2012). The LabVIEW XY recorder was initially used with the current-to-voltage converter circuit shown in Figure 3 but was later replaced with the Electrochemistry Instrument VI. To reduce cost, a platinum-coated tungsten wire (Johnson Matthey, Stock #13630, 0.254 mm diameter) was used as a counter electrode instead of solid platinum wire.
Cyclic Voltammetry of Potassium Ferricyanide Ferricyanide was chosen for the cyclic voltammetry experiment (12) because it exhibits a reversible reduction in aqueous solution. An electrolyte solution (ca. 1 M KNO 3) was prepared. One-half liter of 10 mM K3Fe(CN)6 was made up using the 1 M KNO3 solution (sufficient for ten students). The potassium nitrate (Aldrich) and potassium ferricyanide (Aldrich) were used without further purification. The electrodes (reference, working, and counter) were immersed in the solution, and the experimental parameters were made to be 0.8 V starting potential, {0.2 V switching potential, and a scan rate of 0.5 V/s. The same parameters were used with the analog function generator (Electrochemistry Function Generator) and with the LabVIEW program (Electrochemistry Instrument VI). The E1/2 of the reduction was observed at approximately 0.2 V vs. the calomel electrode. Observation at various scan rates (10–1000 mV/s) found the peak current to be linearly related to the square root of the scan rate as predicted by the linear potential sweep equation (6). Peak heights (current) were measured by means of the cursors available in the LabVIEW XY plot.
Figure 7. Electrochemistry Instrument virtual instrument block diagram.
1106
Journal of Chemical Education • Vol. 73 No. 12 December 1996
Determination of Lead by Stripping Analysis This experiment (12, 13) was selected as a more practical application of the voltammetry instrument. It seemed to be satisfying for the student to pull together the various skills learned during the semester and to see them applied to a useful end. Stripping analysis involves the preconcentration of the analyte by reduction of the solution cation to the metallic form deposited on the electrode. Deposition is enhanced by the presence of a mercury film, formed in situ, on the electrode surface (14). However, care should be taken to produce a thin film rather than mercury droplets (15). Droplet formation can be prevented by stop-
Information • Textbooks • Media • Resources
ping the scan before the oxidation of mercury and avoiding chloride contamination during preparation of the solutions. A 1.0 mM Hg(NO3)2 solution and a 1.0 mM Pb(NO3)2 solution were prepared in 4% acetic acid. Five milliters of the mercury solution was added to 100 mL of 4% acetic acid and a blank scan taken. One-milliliter additions of the lead solutions were made and the peak height determined for each. A calibration curve was developed and used to determine the lead content of various unknowns. In the hands of the students, a linear relationship was observed from 0.33 to 1.6 ppm. The relative standard deviation for determination of unknowns ranged from 60 to 100 ppt. Chemical Hazards and Disposal of Waste The only chemicals presenting an unusual hazard were the mercury and lead nitrates. All other materials were handled in the typical manner. Students were advised to avoid ingestion or skin contact of the heavy metal solid or solution. Waste solutions had their volumes reduced by boiling before pickup for disposal. Recent Developments Since the completion of the Fall 1994 class, two new developments have occurred that will enhance the future effectiveness of the course (16). Prentice Hall is offering a student edition of LabVIEW with an accompanying user’s guide (17). This will permit students to have their own copy of the program to work with. A computer interfacing and LabVIEW programming textbook (18) has been developed. The guide and textbook will provide more formal routes to learning programming skills.
Acknowledgments I thank Harvey Blanck for his assistance in the course described and Lori Slavin, Ron Robertson, and John Foote for discussions of this manuscript. Note 1. Presented at the 25th Tennessee Higher Education EDP Symposium, April 1995, Cookeville, TN.
Literature Cited 1. Johnson, D. C. J. Chem. Educ. 1983, 60, 258–340; Mabbott, G. A. J. Chem. Educ. 1983, 60, 697-701; Kissinger, P. T.; Heineman, W. R. J. Chem. Educ. 1983, 60, 702–706; Van Benschoten, J. J.; Lewis, J. Y.; Heineman, W. R.; Roston, D. R.; Kissinger, P. T. J. Chem. Educ. 1983, 60, 772–776. 2. Diefenderfer, A. J.; Holton, B. E. Principles of Electronic Instrumentation; Saunders: Philadelphia, 1994. 3. Horowitz, P. The Art of Electronics; Cambridge: New York, 1980; Tooley, M. Electronic Circuits Handbook; Butterworth & Heinemann: Oxford, 1993. 4. Bartlett, E. Electronic Measurement & Testing; McGraw–Hill: New York, 1992; Perozzo, J. Practical Electronic Troubleshooting; Delmar: New York, 1992; Pease, R. Troubleshooting Analog Circuits; Butterworth & Heinemann: Boston, 1991. 5. Albahadily, F. N.; Mottola, H. A. J. Chem. Educ. 1986, 63, 271–273. 6. Bard, A. J.; Faulkner, L. R. Electrochemical Methods; Wiley: New York, 1980. 7. LabVIEW Tutorial; National Instruments: Austin, TX, 1993. 8. LabVIEW Data Acquisition VI Reference Manual; National Instruments: Austin, TX, 1993; pp 1-16–1-73, 13-1–13-7. 9. LabVIEW User Manual; National Instruments: Austin, TX, 1993; pp 19-5–19-8. 10. Johnson, G. LabVIEW Graphical Programming; McGraw–Hill: New York, 1993. 11. Nyholm, L.; Wikmark, G. Anal. Chim. Acta 1992, 257, 7–13. 12. Sawyer, D. T.; Heineman, W. R.; Beebe, J. M. Chemistry Experiments for Instrumental Methods; John Wiley: New York, 1984; pp 72–85. 13. Capsules: Anodic Stripping Voltammetry of Pb and Cd; BioAnalytical Systems: W. Lafayette, IN, 1988. 14. Baranski, A. S.; Quon, H. Anal. Chem. 1986, 58, 407–412; Pomeroy, R. S.; Denton, M. B.; Armstrong, N. R. J. Chem. Educ. 1989, 66, 877–880. 15. Ping Wu, H. Anal. Chem. 1994, 66, 3151–3157. 16. Instrumentation Newsletter; National Instruments: Austin, TX, Winter 1994/ 1995. 17. Wells, L. K. LabVIEW Student Edition; Prentice Hall: Englewood Cliffs, NJ, 1994. 18. Eaton, J. K., Eaton, L. LabTutor, A Friendly Guide to Computer Interfacing and LabVIEW Programming; Oxford University: New York, 1995.
Vol. 73 No. 12 December 1996 • Journal of Chemical Education
1107