Calculator-Based Instrumentation: The Design of a Digital Interface

Calculator-Based Instrumentation: The Design of a Digital Interface Based on I2C Technology. A. B. Hickman ... In this work, we describe the interfaci...
0 downloads 6 Views 2MB Size
In the Laboratory

Calculator-Based Instrumentation: The Design of a Digital Temperature Probe Based on I2C Technology A. B. Hickman and R. S. Helburn*† Department of Chemistry, Northern Arizona University, Flagstaff, AZ 86011 W. G. Delinger* Department of Physics and Astronomy; Northern Arizona University, Flagstaff AZ 86011; *[email protected]

The trend in scientific instrumentation is toward small, portable instruments that enable direct on-site analysis (1–2). The need for this type of measurement capability exists in numerous fields, including chemical and biological research, as well as in the environmental and health sciences (1–5). Such small units must be capable not only of acquiring data, but of storing and evaluating the acquired data. The everincreasing power and diminishing size of microprocessors is making such instrumentation possible. As an example, Texas Instruments1 (TI) and third party software/hardware companies have developed the CalculatorBased Laboratory (CBL) experiments in which devices such as temperature sensors, photometers, pH meters etc. exchange information with the TI series calculators. For teaching purposes, the equipment can be expensive. Moreover, such commercially produced equipment does not permit the user to comprehend the interfacing and data-acquisition process. An understanding of this process would open the door to other more creative instrument designs in this area. The purpose of this article is to describe the interfacing of a peripheral device to a TI-85 graphing calculator. The device we have chosen is a temperature sensor. However, the interface that we describe is amenable to the interfacing of other probes and sensing devices. In each case, the calculator provides the computational, storage, and display capabilities of a small computer. The combination of sensor, interface, and calculator provides a portable setup that may be used in a variety of field settings.

of the LM75 will allow one to understand the basic operation of the other devices. Figure 1a shows the TI-85 calculator connected to the LM75 temperature sensor through the calculator’s serial link port. As shown by Figure 1a, the serial port consists of three wires labeled A, B, and C. Wire A is the common ground. Wire B is used to send and receive serial data (SDA). Wire C is used to send serial clock (SCL) information to the LM75, as required by the I2C protocol.3 Both the serial data and the clock timing information are sent as a series of high (+5 V) and low (0 V) pulses. Individual clock pulses need not be identical in duration. In this manner, data transmission can be stopped at any point for an indefinite period of time without corruption of the data. Data validity is handled by the internal circuitry with the implementation of “start”, “acknowledge”, “no-acknowledge”, and “stop” conditions sent as serial control codes. Information transfers can be made at up to 400 kb per second, which is as fast as most ADC/DAC conversions. Each specific group of integrated circuits that employs the I2C system is given its own range of permissible addresses. For example, the LM75 can have one of eight possible addresses so that up to eight sensors can be connected to the same SCL and SDA wires. Figure 1a shows that the address Figure 1a. Schematic diagram of the LM75 temperature-sensing integrated circuit and associated circuitry connected through the serial link port to the TI-85 calculator.

Hardware The particular temperature sensor we have chosen is the LM75 integrated circuit manufactured by National Semiconductor.2 This device acts as (i) a temperature sensor, (ii) an analog-to-digital converter for the sensor, and (iii) a digital overtemperature detector. These three capabilities are integrated into a small (3 × 4 mm) electronic package. The LM75 also incorporates the convenient inter-integrated circuit (I2C) interface originally developed by Philips Semiconductors.3 This simple three-wire interface resembles a modified version of the standard RS-232 serial communications protocol used by personal computers. A number of semiconductor manufacturers2,3 now offer a complete line of I2C-based integrated circuits, such as analog-to-digital converters (ADC), digitalto-analog converters (DAC), clock-calendar chips, RAM and ROM storage chips, and 8-bit ports. All these devices are based on the same I2C interface. An understanding of the operation † Current address: Division of Analytical and Chemical Sciences, Research Triangle Institute, Research Triangle Park, NC 27709.

JChemEd.chem.wisc.edu • Vol. 77 No. 2 February 2000 • Journal of Chemical Education

255

In the Laboratory

Figure 2a. Magnified view of the actual temperature probe showing the 0.1-µF bypass capacitor soldered to pins 4 (ground) and 8 (+5 V), and the connecting wires soldered to the eight numbered pins of the LM75 integrated circuit.

Figure 1b. Block diagram showing the internal registers of the LM75 used to transfer serial data between the integrated circuit and the TI-85 calculator.

pins 5,6,7 of our device have all been set to logic “0” (ground). Thus this integrated circuit is identified by the address 000 plus the four most significant bits that have been hard-wired inside the LM75 to “1001.” To change the address, the individual pins (5,6,7) could either be set to logic “1” (+5 V) or logic “0” (ground) for the eight binary combinations. Other I2C integrated circuits, such as the Philips PCF8591 8-bit ADC/DAC (6 ), have separate address ranges and up to eight can be placed on the same lines as the LM75 without addressing problems. The fact that each device has its own address and responds to only that address alleviates the need for complex hardware and software to separate the data coming from each unit. The LM75 integrated circuit converts a temperature in the range of ᎑55 to +125 °C into a digital value with a resolution of 0.5 °C. The temperature can be read every 100 ms. Other features of the LM75 include programmable registers as illustrated in Figure 1b. The registers (Fig. 1b) allow the chip to act as a thermal sensing switch. When temperatures exceed or fall below the values placed in the Over-Temperature Shutdown register and the Temperature Hysteresis (THyst) register, output pin 3 (Fig. 1a) of the chip is activated or deactivated accordingly. As shown in Figure 1a, we have connected pin 3 to a piezo electric buzzer to serve as an audible alarm. This output pin could just as well be connected to other peripheral equipment such as a heating coil. Also, since our circuit is powered by a battery that is independent of the calculator battery, once the registers are set, the circuit can be disconnected from the calculator and still be used as a thermostat. The LM75 temperature sensor (Fig. 1a) was made into a probe by soldering eight wires to the LM75 integrated circuit along with a 0.1-µF electrical noise bypass capacitor (Fig. 2a). Since the chip was so small, it was necessary to do the soldering under a microscope; this task was done by Telonics.4 The probe can be coated with an epoxy to protect the individual components.

256

Figure 2b. Photograph of the completed portable temperature sensing instrument.

Software The TI-85 calculator is designed around the modern lowpower version of the Zilog5 Z80 microprocessor. Although the TI programming language that comes with the calculator is very powerful, there are no built-in functions that allow the user direct access to the Z80 and link port in a manner suitable for I2C communications. Subroutines that allow this type of communication, however, can be written and loaded

Journal of Chemical Education • Vol. 77 No. 2 February 2000 • JChemEd.chem.wisc.edu

In the Laboratory

into the calculator memory. For this task, we have used a pseudo-operating system called Zshell.6 This operating system shell provides a way in which the user can download subroutines to the TI-85 using Texas Instrument’s TI-GraphLink software and cable. The subroutines can be written in almost any common programming language (such as C or C++) so long as the source code can be compiled into Z80 machine code. We have written our routines in Z80 assembly language because of the availability of a freeware compiler located on the Internet.7 Recently, Texas Instruments announced their full support of assembly language programming for the new TI-86 calculator. They also have a supporting Public Domain Web site.7 A copy of the assembly language program that we have written for our system is available on request.8 Concluding Remarks In this article, we have described a general approach for interfacing a temperature sensor to a TI-85 calculator so as to produce a small portable instrument. A picture of the completed instrument is shown in Figure 2b. The techniques employed here can be extended to the development of other similar instruments using particular integrated circuits based on the same I2C interfacing protocol. Many of the PC-based interfacing and meter designs found in this Journal (7, 8) could be easily adapted to the TI-85 calculator, eliminating the bulky size of the personal computer. For example, other authors have used PCs to read a pH meter (8–10) and a monochromatic photometer (11). In using the TI-85 and associated I2C integrated circuits, these meters could be made portable. The general trend in analytical instrumentation is modularity, compatibility, and portability. The availability and technical capacity of today’s microprocessors such as those offered by Zilog5 and Motorola9 has provided a platform upon which instrumentation can achieve these goals. Calculators produced by Texas Instruments1 as well as Hewlett Packard10 are based on these units. Scientific instrumentation is increasingly calling upon the power of microprocessors instead of a dedicated personal computer (PC). Just as in the past we adapted to personal computers, students, instructors, and researchers alike must eventually become familiar with this technology.

Acknowledgment This work was supported by Grant #R-14 of the EPA Western Region Hazardous Substance Research Center, Stanford University, Stanford, CA. Notes 1. Texas Instruments, P.O. Box 650311, MS 3962, Dallas, TX 75215. 2. National Semiconductor, 1111 W. Bardin Rd. Arlington TX 76017. 3. Philips Semiconductor, Sunnyvale CA 94088. 4. Telonics, 932 E. Impala Ave., Mesa, AZ 85204. 5. Zilog Inc., 210 E. Hacienda Ave., Campbell, CA 95008. 6. http://www.ticalc.org. 7. http://www.ti.com/calc/docs/86assembly.htm. 8. W. G. Delinger, Department of Physics and Astronomy, Northern Arizona University, Box 6010 Flagstaff, AZ 86011-6010. 9. Motorola Inc., 1303 Algonquin Rd., Schaumburg, IL 60196. 10. Hewlett Packard, Palo Alto, CA 94304-1181.

Literature Cited 1. Gerlach, C. L. Environ. Sci. Technol. 1996, 30, 252. 2. Wong, P. S. H.; Cooks, R. G.; Cisper, M. E.; Hemberger, P. H. Environ. Sci. Technol. 1995, 29, 215A. 3. Murray, C. J. Design News 1996, 51, 85. 4. Yamomoto, K. Y.; Cremers, D. A.; Foster, L. E. Appl. Spectrosc. 1996, 50, 222. 5. Alarie, J. P.; Vo-Dinh, T.; Miller, G.; Ericson, M. N.; Maddox, S. R.; Watts, W.; Eastwood, D.; Lidberg, R.; Dominguez, M. Rev. Sci. Instrum. 1993, 64, 2541. 6. I 2C Peripherals 1997 Data Handbook IC12; Philips Semiconductors: Sunnyvale, CA, 1997; pp 45–68. 7. Li, C.; Zhuang, Q. J. Chem. Educ. 1988, 65, 344. 8. McMahon, J. J.; Braca, P. R. J. Chem. Educ. 1992, 69, A156. 9. Vitz, E.; Betts, T. A. J. Chem. Educ. 1994, 71, 412. 10. Sievers, D. J. Chem. Educ. 1981, 58, 281. 11. Pharr, C. M.; Malberg, B. J.; Jegla, J. D.; Gammon, S.D. J. Chem. Educ. 1996, 73, 238.

JChemEd.chem.wisc.edu • Vol. 77 No. 2 February 2000 • Journal of Chemical Education

257