• No results found

DATA TRANSFER/INSTRUMENT INTERFACES

The Laboratory Use of Computers

IV. DATA TRANSFER/INSTRUMENT INTERFACES

Computers dwell exclusively in the digital realm. Quantum chemistry notwithstanding, normal chemical analyses and the responses measured by them are analog phenomena. In order for computers to be able to analyze and store analog data from a laboratory instrument, the data must be converted to a digital form. This is the basic task of the instrument interface(s). In order for the compu- ter to analyze and store the data from a given laboratory instrument, several processes must take place. In general terms they are: conversion of the physical signal to an analog signal, analog transmission, analog filtering, analog-to-digital conversion, digital transmission, and digital filtering. It may not be immediately obvious to the casual observer of the analytical instrument where these processes take place or even that they do. The trans- ducer and the analog signal filters normally occur within the enclosure of the detector. The analog-to-digital conver- sion and/or the digital filtering can also occur within the detector, in the computer or in a physically separate inter- face. In many cases, the analog-to-digital conversion takes place in the detector to minimize the efforts required to protect the analog signal from ambient noise. Digital filter- ing is typically performed in the computer as it can be very computationally intensive and to simplify optimizing the digital filtering parameters by the scientist if desired. A. Transducers

The first step is to convert the physical phenomena being studied into an electronic signal by the transducer. Typical transducers used in analytical instrumentation include: photomultiplier tube (PMT) in traditional scanning spectro- photometers using monochromators, charge-coupled devi- ces for photodiode array instruments, particle detectors for

X-ray diffraction equipment, and electrodes for measuring potentials in solutions. The transducer is obviously very specific to the instrument and will not be further discussed here except to caution that the properties of the transducer must be taken into account in the design of the analog-to- digital circuitry. For example, high impedance transducers such as electrodes likewise require that the amplifier circui- try be of high impedance.

B. Analog Signal Transmission

We will begin by examining signal transmission. Earlier this was almost always accomplished by transmitting the analog signal, usually in the form of varying voltage, from a detector such as a PMT or a transducer such as thermistor to the analog-to-digital converter installed on the PC.

Noise is everywhere but can be especially prevalent in the laboratory environment where it can weaken or worse yet alter the useful signal. Proper cable design and use is more import- ant as the distance that the analog signal must travel increases. Voltage (as opposed to current) based signals are especially prone to electromagnetic interferences.

A simple method of reducing interference from external noise is to simply twist the signal and ground wires around one another. Any noise induced in one wire is offset by an equal but opposite noise signal in the other. Coaxial cables are another effective means of protecting data from noise. A coaxial cable consists of a central conducting (positive) wire separated from an outer conducting cylinder by an insulator. They are not affected by external electric and magnetic fields.

Cables are often shielded by surrounding them with a layer of conductive metal such as aluminum or copper to prevent them from acting as antennas for radio and other electromag- netic noise sources. The shield is then grounded only at the detector end to protect from low frequency (e.g., 60 Hz) noise or at both ends to protect high frequency signals. If the shield is grounded at both ends, care must be taken to ensure that both grounds are identical or a ground loop will form resulting in current flowing through the shield, which will affect the signal being carried by the cable. The shield should also not be left ungrounded at both ends as this will enhance the noise one is trying to eliminate.

C. Analog Signal Filtering

The most important application of analog filtering is low- pass antialiasing filters that must be applied to the analog signal when periodic signals are being measured. Unless systematic noise and harmonics at higher frequencies are removed from the analog signal, the low sampling rate in comparison with the noise can result in the noise alias- ing down to the frequency of the signal itself. Aliasing will be discussed in the digital filtering section.

True analog filtering has become much less important in the digital age. Digital filters can easily simulate low- pass, band-pass, and high-pass filters and have two distinct advantages. They can be applied without permanently obscuring the original signal which is generally saved in an electronic file and they can use subsequent data points to filter the current data point such as in moving average schemes, something that is impossible in analog circuitry. All of this assumes, of course, that the analog signal was converted to a digital signal with sufficient resolution. This will be discussed in Section D.1.

D. Analog-to-Digital Conversion

There are several different methods of analog-to-digital con- version and although a comprehensive treatment of the analog-to-digital conversion is beyond the scope of this work, a basic discussion of their advantages and disadvan- tages is in order to ensure that the method chosen is compa- tible with the given application. Table 1 gives a brief summary of the various types of analog-to-digital converters along with approximate performance ranges. Most commer- cial devices employ some type of track and hold circuit so that the conversion can take place on a static value. Com- ponent manufacturers such as National Semiconductor, Analog Devices, and Texas Instruments among others provide detailed specification sheets for their products as There are two important attributes of the analog-to- digital converters: resolution and response time. Resolution is the smallest analog change resulting in an incremental change in the digital output. The resolution of an analog- to-digital converter is determined by the number of output bits it produces. An 8 bit analog-to-digital converter is

capable of separating a 1 V signal into 28 segments or 3.9 mV. This, for example, would be insufficient for chro- matographic UV detectors that often have rated noises of 0.03 mV. A 16 bit analog-to-digital converter is capable of resolving a 1 V signal into 65,536 segments or 0.015 mV, which would be sufficient. Resolution is also referred to as the least significant bit (LSB).

Another point to consider when using analog-to-digital converters is range matching. If an instrument detector is only capable of outputting from 0 to 50 mV, using an analog-to digital converter with a 1 V range is an expensive waste of 99.5% of the ADC’s range. Many commercial inter- faces allow the user to adjust the range of the ADC for this reason.

1. Sampling Interval (Rise-Time)

The sampling interval is a second important consideration. If the sampling rate is too low, important “fine features” may be lost while using excessively high sampling rates wastes both computing time and disk space.

shows the effect of sampling rate on the depiction of a modeled chromatographic peak with a partially eluting smaller peak with narrower peak width.

Note that the sampling interval problem also applies to experiments that at first glance do not appear to be time based. The use of the Fourier transform methodology for frequency vs. intensity experiments such as infrared and nuclear magnetic resonance spectroscopy (NMR) is an important example. Nyquist firmly established that the sampling frequency must be at least twice that of the highest frequency component in the signal. If the signal is sampled at less than the Nyquist frequency, those com- ponents above half the sampling frequency appear as com- ponents with frequencies less than half the sampling

Table 1 Analog-To-Digital Converters

Type Description

Response time

Resolution (bit) Parallel encoder The input signal is simultaneously compared to a series of reference voltages

and the digital output is based on the last highest voltage reference that was exceeded by the reference voltage

3 – 200 ns 4 – 10 Successive

approximation

The digital voltage value is derived by comparing input voltage to sequential series of reference voltages produced by a digital-to-analog converter

3 – 200 ms 8 – 12 Voltage-to-frequency

conversion

The input voltage is converted to a frequency that is proportional to the input voltage. The digital voltage value is derived from the frequency

6 – 33 ms 12 Single-slope integration The input voltage is compared to an internal voltage ramp of known slope.

The digital voltage value is derived from the time required for the voltage ramp to exceed the input voltage

3 – 40 ms 12 Dual-slope integration The digital voltage value is derived from the time for a capacitor to discharge

after being charged proportional to the input voltage

3 – 40 ms 10 – 18 Delta sigma converters The digital voltage value is derived from successive subtractions of known

voltages from the input voltage

10 – 100 ms 12 – 18

co-

2 Figure

well as useful application notes and guides (Fig. 1).

Figure 1 (a) Signal composed of multifrequency components in the time domain. (b) Signal composed of multifrequency components in the frequency domain. (c) Signal resolved into frequency components.

As it is quite possible that the value of the highest fre- quency component in the signal is not known, an analog low-pass filter is added before the analog-to-digital conver- ter to remove any signal with a frequency greater than half the sampling frequency. Since the filtering profile of analog filters resembles an exponential decay more than an ideal strict cut-off at the desired frequency, care must be taken to ensure filter reduces all the undesired higher frequencies to below the detection limit of the analog-to-digital conver- ter. All of this means that analog-to-digital converter must be able to sample the signal at over twice the frequency of the highest expected component in the signal to ensure that no alias artifacts are present in the analyzed data. E. Digital Signal Transmission

It is now much more prevalent to convert the signal to a digital one in an onboard computer on the instrument and transmit the digital signal to the computer. Digital signals are generally less susceptible to noise because they are discrete pulses, whereas analog signals are con- tinuous. In cases where the analysis of the raw data is com- putationally very intensive, the workload is also split between the two computers. The detector computer can also be optimized for performing its data reduction tasks without being concerned about user interfaces.

The transmission of digital data requires that a com- munication protocol be defined so that the computer understands the series of discrete binary pulses being received. A brief discussion of the most popular communi- 1. Point-to-Point Communication

(Serial, Parallel)

The simplest scenario is a direct connection between the computer and a single other device (the detector, terminal, or other computer). RS232 serial communication is one of the earliest communication protocols and is an example of such a point-to-point protocol. Both control and data signals are transmitted over eight distinct lines for hard- ware control or four lines when software control is used. The process of exchanging control signals to ensure proper signal transmission is also called handshaking.

As indicated by the name, serial communication seri- alizes the native 8 bit words used by the computer in order to transmit the data bit by bit:

In order to establish communication between the two devices, they both must use the same serial port settings: transmission rate, data bits (5 – 8), parity (even, odd, and none), stop bits (1,2), and flow control/handshaking (hard- ware, XON/XOFF). The transmission rate is the number of bits per second that can be transmitted and is dependent on the actual hardware serial port. The data bit setting indi- cates how many data bits are sent per transmission (typi- cally 8 bits for binary data). The parity bit is used for error checking. If set to odd, the transmitting device sets the parity bit such that the data bits plus the parity bit give an odd number of ones. If set to even, the transmitting device sets the parity bit such that the data bits plus the parity bit give an odd number of ones. For XON/XOFF (software) flow control, a device sends ASCII character 19 (Ctrl-S) in the data bits to stop transmission of data from the other device instead of using the hardware “clear to send” line. It then sends ASCII 17 (Ctrl-Q) to inform the other device that it can continue sending data. Parallel communication is also point-to-point but sends all 8 data bits at once and is thus faster than serial communication. Parallel communication was originally unidirectional—data were only sent from the computer to the device, usually a printer. Bidirectional parallel ports are now standard.

2. Short Distance—Multiple Device Communication

Often laboratory instrumentation consists of several dis- tinct modules that must interact with one another and the computer to function properly. The point-to-point scheme is insufficient in this case unless one dedicates one serial port for each device. Hewlett Packard developed a mulitple device interface and protocol to address this issue. The Hewlett Packard interface bus (HPIB) was adopted industry-wide and became known as the general purpose interface bus (GPIB) and the IEEE488. An active controller talks to up to 14 other devices over 8 data lines (parallel), 5 bus management lines, and 3 hand- shaking lines.

The SCSI described earlier to connect peripherals such as hard drives to the system bus of the computer can also be used to connect to external instruments. This is a relatively expensive solution, however, would only be used when extremely high data transfer rates are required.

The universal serial bus (USB) was developed for per- sonal computers to simplify the connection of external

Start bit (always 0) Data bit 1—LSB Data bit 2 Data bit 3 Data bit 4 Data bit 5 Data bit 6 Data bit 7 Data bit 8— the most significant bit Parity bit (odd, even, none) Stop bit (always 1) Stop bit (optional and always 1)

devices. The USB cable consists of a single twisted pair for transmitting data and two wires for supplying 5 V power to low power devices (maximum 500 mA) such as mouse. The host computer automatically polls all devices on the bus and assigns them an address. Data are transmitted in 1500-byte frames every millisecond. (A frame is a com- munication protocol which is standardized and the user only needs to plug the device into an available USB port in order to use it.) This relatively new protocol has not been used extensively for instrumentation but will prob- ably be adopted by instrumentation that transfers small amounts of data and currently uses the standard serial port. 3. Local Area Networks (LANs)

It is not uncommon to place instruments on an ethernet LAN with a variety of other devices and workstations all sharing the same transmission medium. A robust com- munication protocol is required if large numbers of devices are communicating with one another. Typically most large organizations use the TCP/IP network protocol on ethernet. Each device is assigned a unique IP address based on four 8 bit address segments corresponding to the network, subnet, and host/device, which is represented in the familiar decimal dot notation: 255.255.255.255.

A number of instrument vendors are taking advantage of the low cost of NICs and network hubs to establish small LANs to provide communications between the lab- oratory computer and the instrument. It is also a simple matter to configure a point-to-point network between a computer and an instrument with a cross-over cable and two NICs configured for TCP/IP.

F. Digital Data Filtering

One of the simplest noise filtering techniques is signal averaging. By repeating the experiment several times and averaging the results, the noise will tend to cancel itself out while the signal should remain constant. If the

noise is truly random, the signal-to-noise ratio of the signal increases by the square root of the number of times successive signals are averaged.

Experiments need not necessarily be repeated many times in order to achieve better signal-to-noise as a result of signal averaging. In cases where there are a suffi- cient number of data points defining the signal curve, adja- cent data points can be averaged to remove noise. This approach assumes that the analytical signal changes only slightly (and therefore linearly) within window of data points being averaged. In practice, 2 – 50 successive data points can be averaged in this way depending on the data being processed.

Several key analytical techniques use advanced math- ematical treatment to obtain a strong signal while discrimi- nating against noise. Examples include pulsed NMR and the Michelson interferometer-based infrared spectroscopy. In the case of NMR, the sample is irradiated with a short burst of RF radiation and then the amplitude of the decay- ing resonant frequencies of the excited sample is measured as a function of time. The Michelson interferometer mea- sures the shift in frequencies caused by a fast moving mirror in the light path. These techniques have several distinct advantages over their scanning monochromator counterparts: the experiments are much quicker, thus lending themselves to signal averaging and there is no requisite loss of the source radiation from restricting the passed energy to a narrow energy band. In both cases, the signal is transformed to a response (amplitude) based on frequency instead of time by the Fourier transform method. An in-depth discussion of the Fourier transform is beyond this work, but the amplitude response S at given frequency is represented by the Fourier transform as:

S^xx(f ) ¼ ð1

1

x(t)ei2pftdt (1) This requires the integral to be calculated over all time in a continuous manner. Out of practical necessity, however, one can only obtain the amplitude at discrete intervals for a finite period of time. Several approximations are

Table 2 Digital Communication Interfaces Maximum

transmission speed Maximum cable length Maximum number of devices

Serial 64 kbps 10 ft 2

Parallel 50 – 100 kbytes/s 9 – 12 ft 2 USB 2.0 480 mbits/s 5 m Segments with a maximum of six segments

between device and host

127 IEEE488 1 MByte/s 20 m (2 m per device) 15

Twisted pair ethernet 1000 Mbps 82 ft (329 ft at 100 Mbps) 254 per subnet using TCP/IP

SCSI 160 Mbytes/s 6 ma 16

a

made in order to calculate the transform digitally, yielding the discrete fourier transform:

S0^xx(kDf )  1 N X N1 n¼0 x(n)ei(2pnk=N) (2) where N is the number of points sampled. This allows the signal to be represented in the frequency domain as in The function assumes that every component of the input signal is periodic, that is, every component of the signal has an exact whole number of periods within the timeframe being studied. If not, discontinuities at the beginning and ending border conditions develop, resulting in a distortion of the frequency response known as leakage. In this phenomena, part of the response from the true fre-