Before we delve completely into data acquisition, we want to talk a little about what you'll be acquiring. A signal is simply any physical quantity whose magnitude and variation with time (or occasionally some other variable) contain information. Timing Is EverythingAlthough it may not be obvious at first, time is usually the most critical aspect of almost any measurement. Whether we want to observe how an engine's temperature changes over time, see what a filtered audio signal looks like, or close some valves when a gas mixture reaches its optimum ratio, time is the deciding factor in data acquisition and control. We want to know not just what happens, but when. Even so-called "DC" signals are not really steady-state; if they never changed over time, we would always know their constant value, so why would we want to measure them? Timing is important in designing your data acquisition software for a couple of reasons. First, you need to figure out how to set the sampling rate, or how often your computer takes a measurement. Second, you need to be able to allocate processor time to other tasks such as file I/O. If you only need to read data once or twice a second or less and you don't need much timing accuracy between the sample points, you can probably use LabVIEW's timing functions to control the sampling rate "directly" from your program, by putting a Wait function in a VI that acquires one pointfor example, in a loop. For more precise applications or AC signals, you'll let the hardware and low-level software set the sampling rate by configuring your measurement on the DAQ device accordingly. We'll discuss these details along with some examples in Chapter 11. Signal ClassificationLet's say you want to take a measurement. For signal conditioning hardware to condition a signal, or for the DAQ device to measure it directly, you must first convert it to an electrical signal such as voltage or current. A transducer performs this conversion. For example, if you wish to measure temperature, you must somehow represent temperature as a voltage that the DAQ device can read. A variety of temperature transducers exist that use some physical properties of heat and materials to convert the temperature to an electrical signal. Once the physical quantity is in an electrical signal form, you can then measure the signals to extract some type of useful information conveyed through one or more of the following parameters: state, rate, level, shape, and frequency content (see Figure 10.2). Figure 10.2. A DAQ System converts signals into information that your software can use
Strictly speaking, all signals are analog time-varying signals. However, to discuss signal measurement methods, you should classify a given signal as one of five signal types. Classify the signal by the way it conveys the needed information. First, you can classify any signal as analog or digital. A digital, or binary, signal has only two possible discrete levelsa high (on) level or low (off) level. An analog signal, on the other hand, contains information in the continuous variation of the signal with respect to time. Figure 10.3 shows a hierarchy of signal classifications. Figure 10.3. Signal classification hierarchy
Engineers often classify digital signals into two more types and analog signals into three more types. The two digital signal types are the on-off signal and the pulse train signal. The three analog signal types are the DC signal, the time domain (or AC) signal, and the frequency domain signal. The two digital and three analog signal types are unique in the information each conveys. You will see that the five signal types closely parallel the five basic types of signal information: state, rate, level, shape, and frequency content. Digital SignalsThe first type of digital signal is the on-off, or state, signal. A state signal conveys information concerning the digital state of the signal. Therefore, the measurement hardware needed to measure this signal type is a simple digital state detector. The output of a transistor-transistor logic (TTL) switch is an example of a digital on-off signal. Another example is the state of an LED, as shown in Figure 10.4. Figure 10.4. State example
The second type of digital signal is the pulse train, or rate, signal. This signal consists of a series of state transitions. Information is contained in the number of state transitions occurring, the rate at which the transitions occur, or the time between one or more state transitions. The output signal of an optical encoder mounted on the shaft of a motor is an example of a digital pulse train signal, as shown in Figure 10.5. In some instances, devices require a digital input for operation. For example, a stepper motor requires a series of digital pulses as an input to control the motor position and speed. Figure 10.5. Rate example
Analog Level SignalsAnalog DC, or level, signals are static or slowly varying analog signals. The most important characteristic of the level signal is that the level, or amplitude, of the signal at a given instant conveys information of interest. Because the analog DC signal varies slowly, the accuracy of the measured level is of more concern than the time or rate at which you take the measurement. The plug-in DAQ device that measures DC signals operates as an analog-to-digital converter (ADC), which converts the analog electrical signal into a digital value for the computer to interpret. As shown in Figure 10.6, common examples of DC signals include temperature, battery voltage, pressure, and static loads. In each case, the DAQ system monitors the signal and returns a single value indicating the magnitude of the signal at that time. Therefore, these signals are often displayed through LabVIEW indicators such as meters, gauges, strip charts, and numerical readouts. Figure 10.6. Level examples
Your DAQ system should meet the following specifications when acquiring analog DC signals:
Analog Time Domain SignalsAnalog time domain, or shape, signals differ from other signals in that they convey useful information not only in the signal level, but also in how this level varies with time. When measuring a shape signal, often referred to as a waveform, you are interested in some characteristics of the waveform shape, such as slope, locations and shapes of peaks, and so on. To measure the shape of a time domain signal, you must take a precisely timed sequence of individual amplitude measurements, or points. These measurements must be taken at a rate that will adequately reproduce the shape of the waveform. Also, the series of measurements should start at the proper time, to guarantee that the useful part of the signal is acquired. Therefore, the plug-in DAQ device that measures time domain signals consists of an ADC, a sample clock, and a trigger. A sample clock accurately times the occurrence of each analog-to-digital (A/D) conversion. To ensure that the desired portion of the signal is acquired, the trigger starts the measurement at the proper time according to some external condition. There are an unlimited number of different time domain signals, a few of which are shown in Figure 10.7. What they all have in common is that the shape of the waveform (level versus time) is the main feature of interest. Figure 10.7. Shape examplesYour DAQ system should meet the following specifications when acquiring analog time domain signals:
Analog Frequency Domain SignalsAnalog frequency domain signals are similar to time domain signals because they also convey information on how the signals vary with time. However, the information extracted from a frequency domain signal is based on the signal frequency content, as opposed to the shape or time-varying characteristics of the waveform. Like the time domain signal, the DAQ device used to measure a frequency domain signal must include an ADC, a sample clock, and a trigger to accurately capture the waveform. You can perform this type of digital signal processing (DSP) using application software or special DSP hardware designed to analyze the signal quickly and efficiently. Your DAQ system should meet the following specifications when acquiring analog frequency domain signals:
Figure 10.8 shows a few examples of frequency domain signals. Although you can analyze any signal in the frequency domain, certain signals and application areas lend themselves especially to this type of analysis. Among these areas are speech, acoustics, geophysical signals, vibration, and system transfer functions. Figure 10.8. Frequency examplesOne SignalFive Measurement PerspectivesThe five classifications of signals presented in this section are not mutually exclusive. A particular signal may convey more than one type of information. Therefore, a signal can be classified as more than one type of signal, and thus you can measure it in more than one way. You can use simpler measurement techniques with the digital on-off, pulse train, and DC signals because they are just simpler cases of the analog time domain signals. You can measure the same signal with different types of systems, ranging from a simple digital input device to a sophisticated frequency analysis system. The measurement technique you choose depends on the information you want to extract from the signal. Look at Figure 10.9. It demonstrates how one signala series of voltage pulsescan provide information for all five signal classes. Figure 10.9. Five ways to measure the same signalActivity 10-1: Classifying SignalsClassify the following signals into one of the five signal types described earlierfrom the perspective of data acquisition. In some cases, a signal can have more than one classification. Choose the type that you think best matches the signal (the solutions are found at the end of this chapter, in the "Solutions to Activities" section). Circle the number on the left margin as follows:
TransducersWhen you're setting up your DAQ system, remember that ultimately everything you're going to measure will have to become an electrical voltage or current. The way you convert measurable phenomena such as temperature, force, sound, light, humidity, etc., to an electrical signal is by using a transducer. Table 10.1 lists some common transducers used to convert physical phenomena into measurable quantities.
Sensor Arrays: Imaging and Other Cool StuffA single sensor allows us to measure a physical quantity at a point in space. However, if we put lots of sensors, and sensors that measure different things, out in space, then we paint a much clearer picture (literally) of what is going on in the real world. This is called a sensor array. One sensor array that we are all familiar with is the digital camera. Cameras are truly incredible sensing devices. They have an array of photo sensors that measure the intensity and wavelength of light emanating from a source, as a function of spatial position over a field of viewnamely, they take a picture! And, a picture is worth a thousand words. Black and white cameras acquire an optical intensity signal as a function of X position and Y position. Color cameras acquire an optical intensity signal as a function of X position and Y position and spectral bin (color). Once we have image data, we can use image-processing algorithms to measure almost anything that the human eye and brain can detect, and more! You can take dimensional measurements, match patterns, read bar codes, read text, count objects, and a do variety of other useful things. Figure 10.10 shows some hardware and software used for vision and image processing. Figure 10.10. Vision hardware and image processingAnother useful sensor array is the microphone array, or acoustic camera. For example, Figure 10.11 shows a "picture" of the sound emanating from two SUVs, proving that those gas-guzzlers are noisy too! Figure 10.11. Acoustic camera images (photo courtesy of Sound View Instruments AB)
You can make sensor arrays from any type of sensor, including temperature sensors, pressure sensors, strain gaugesthe sky's the limit! Signal ConditioningAll right, so now that you've figured out what kind of signals you need to acquire, you can just plug the output of your transducers directly into the DAQ device, right? In perhaps 50% of the cases or more, NO! We may not always be aware of it, but we live in a very electrically noisy world60 Hz noise comes from AC power and lights; RF noise can come from fluorescent lights, cellphones, microwaves, electric motors, and so onit's everywhere. By the time your signal makes it to the DAQ device, it may have picked up so much noise or have so many other problems that it renders your measurement useless. You usually need to perform some type of signal conditioning on analog signals that represent physical phenomena. What is signal conditioning, anyway? Simply put, it is a manipulation of your signal to prepare it for digitizing at the DAQ device. Your signal has to arrive as clean as possible, within the voltage (usually ±5 or 0 to 10 V) and current (usually 20 mA) limits of your DAQ device, with enough precision for your application. It's hard to be more specific unless you can specify what kind of transducers you're going to use. For example, signal conditioning for audio data from a microphone may involve nothing more than grounding the system properly and perhaps using a lowpass filter. On the other hand, if you want to measure ionization levels in a plasma chamber sitting at 800 V and you don't want to fry your computer, you'd need to provide some more complex circuitry that includes isolation amplifiers with a step-down gain. For signals that need special conditioning, or for systems that have very many signals, National Instruments devised SCX1 (Signal Conditioning eXtensions for Instrumentation). SCXI systems, such as the ones shown in Figures 10.12 and 10.13, provide a chassis where modular units can be inserted to build a custom system. These modular units include analog input multiplexers, analog output devices, "blank" breadboards, signal conditioning modules for thermocouples, and so on. For more information on SCXI, see the National Instruments catalog. Remember that you don't necessarily need SCXI to do signal conditioning. Figure 10.12. An SCXI chassis with several signal conditioning modules can be connected to a PC with LabVIEW.
Figure 10.13. SCXI systems are often used in industrial rack-mount enclosures for high-channel count applications, as shown in this picture of "The Diadem Guy," hard at work. (photo courtesy of Daimler Chrysler Corporation)
Some common types of signal conditioning are the following:
Signal conditioning allows you to connect sensors and signals to your computer's DAQ device, as depicted in Figure 10.14. Figure 10.14. Signal conditioning for different types of transducers and signalsFinding a Common GroundSome physical properties are absolute: luminosity or mass, for example (I know, I know, the physicists won't agreethings act weird when you approach the speed of light, and then almost nothing is absolute [some physicists even speculate that the speed of light is not constant]). But in any case, voltage is decidedly not absolute; it always requires a reference to be meaningful. Voltage is always the measure of a potential difference between two bodies. One of these bodies is usually picked to be the reference and is assigned "0 V." So to talk about a 3.47 V signal really means nothing unless we know with respect to what reference. If you've noticed, though, often a reference isn't specified. That's because the 0 V reference is usually the famous ground. Herein lays the source of much confusion, because "ground" is used in different contexts to refer to different reference potentials. Earth ground refers to the potential of the earth below your feet. Most electrical outlets have a prong that connects to the earth ground, which is also usually wired into the building electrical system for safety. Many instruments also are "grounded" to this earth ground, so often you'll hear the term system ground. This is the ground that is usually tied to the third ground prong on electrical outlets. The main reason for this type of grounding is safety, and not because it is used as a reference potential. In fact, you can bet that no two sources that are connected to the earth ground are at the same reference level; the difference between them could easily be up to 10 volts. Conclusion: We're usually not talking about earth, or safety ground, when we need to specify a reference voltage. Reference ground, sometimes called a return path or signal common, is usually the reference potential of interest. The common ground may or may not be wired to earth ground. The point is that many instruments, devices, and signal sources provide a reference (the negative terminal, common terminal, etc.) that gives meaning to the voltages we are measuring. The ground symbols shown in Figure 10.15 are used in this book when you see wiring diagrams. Be aware, however, that you will find these same symbols used inconsistently among engineers. Figure 10.15. Ground symbols
The DAQ devices in your computer are also expecting to measure voltage with respect to some reference. What reference should the DAQ device use? You have your choice, which will depend on the kind of signal source you're connecting. Signals can be classified into two broad categories, as follows:
Let's examine these categories a bit further: Grounded Signal SourceA grounded source is one in which the voltage signals are referenced to a system ground, such as earth or building ground. Because they use the system ground, they share a common ground with the DAQ device. The most common examples of grounded sources are devices that plug into the building ground through wall outlets, such as signal generators and power supplies (see Figure 10.16). Figure 10.16. Grounded signal source
Floating Signal SourceA floating source is a source in which the voltage signal is not referenced to any common ground, such as earth or building ground. Some common examples of floating signal sources are batteries, thermocouples, transformers, and isolation amplifiers. Notice, as shown in Figure 10.17, that neither terminal of the source is connected to the electrical outlet ground. Thus, each terminal is independent of the system ground. Figure 10.17. Floating signal source
Measuring DifferencesTo measure your signal, you can almost always configure your DAQ device to make measurements that fall into one of these three categories:
Differential Measurement SystemIn a differential measurement system, neither input is connected to a fixed reference such as earth or building ground. Most DAQ devices with instrumentation amplifiers[1] can be configured as differential measurement systems. Figure 10.18 depicts the eight-channel differential measurement system used in the E-series DAQ devices. Analog multiplexers increase the number of measurement channels while still using a single instrumentation amplifier. For this device, the pin labeled AIGND (the analog input ground) is the measurement system ground, as shown in Figure 10.18.
Figure 10.18. Differential measurement system
Before we discuss single-ended systems, it is worth noting that SCXI systems always use the popular differential measurement system, while most plug-in DAQ devices give you a choice. For True Geeks OnlyAn ideal differential measurement system reads only the potential difference between its two terminalsthe (+) and (-) inputs (see Figure 10.19). Any voltage present at the instrumentation amplifier inputs with respect to the amplifier ground is referred to as a common-mode voltage. An ideal differential measurement system completely rejects (does not measure) common-mode voltage. Practical devices, however, limit this ability to reject the common-mode voltage. The common-mode voltage range limits the allowable voltage swing on each input with respect to the measurement system ground. Violating this constraint results not only in measurement error but also in possible damage to components on the DAQ device. The common-mode voltage rejection ratio quantifies the ability of a DAQ device, operating in differential mode, to reject the common-mode voltage signal. Figure 10.19. Ideal differential measurement system
You measure the common-mode voltage, Vcm, with respect to the DAQ device ground, and calculate it using the following formula:
where
You cannot have an arbitrarily high common-mode voltage when measuring with a DAQ device. All plug-in DAQ devices specify a maximum working voltage (MWV) that is the maximum common-mode voltage the DAQ device can tolerate and still make accurate measurements. Referenced Single-Ended Measurement SystemA referenced single-ended (RSE) measurement system, also called a grounded measurement system, is similar to a grounded signal source, in that the measurement is made with respect to earth ground. Figure 10.20 depicts a 16-channel RSE measurement system. Figure 10.20. Referenced single-ended (RSE) measurement system
Be careful when connecting a voltage or current source to your DAQ device. Make sure the signal source will not exceed the maximum voltage or current that the DAQ device can handle. Otherwise, you could damage both the DAQ device and your computer. NRSE Measurement SystemDAQ devices often use a variant of the RSE measurement technique, known as the nonreferenced single-ended (NRSE) measurement system. In an NRSE measurement system, all measurements are made with respect to a common reference ground, but the voltage at this reference can vary with respect to the measurement system ground. Figure 10.21 depicts an NRSE measurement system where AISENSE is the common reference for taking measurements and AIGND is the system ground. Figure 10.21. Nonreferenced single-ended (NRSE) measurement system
Incidentally, your measurement system is determined by how you configure your DAQ device. Most devices from National Instruments can be configured for differential, RSE, or NRSE from a software utility (called NI-MAX on Windows platforms). Some of their older devices also have to be configured at the board by placing jumpers in certain position. When you configure a particular DAQ device for a particular measurement system type, all your input channels will follow that measurement type. You should note that you can't change this from LabVIEWyou have to decide ahead of time what kind of measurement you're making. The general guideline for deciding which measurement system to pick is to measure grounded signal sources with a differential or NRSE system, and floating sources with an RSE system. The hazard of using an RSE system with a grounded signal source is the introduction of ground loops, a possible source of measurement error. Similarly, using a differential or NRSE system to measure a floating source will very likely be plagued by bias currents, which cause the input voltage to drift out of the range of the DAQ device (although you can correct this problem by placing bias resistors from the inputs to ground). Figure 10.22 summarizes the measurement configurations for each signal type.
Figure 10.22. Measurement configurations for each signal typeSampling, Aliasing, and Mr. NyquistThe last, and perhaps most important, part of signal theory we're going to cover here is sampling. Zeno's arrow[2] aside, real-world signals are continuous things. To represent these signals in your computer, the DAQ device has to check the level of the signal every so often and assign that level a discrete number that the computer will accept; this is called an analog-to-digital conversion. The computer then sort of "connects the dots" and, hopefully, gives you something that looks similar to the real-world signal (that's why we say it represents the signal).
The sampling rate of a system simply reflects how often an analog-to-digital conversion (ADC) takes place. Each data point (represented by a square) on the sampled signal in Figure 10.23 represents one analog-to-digital conversion. If the DAQ system is making one ADC every half a second, we say the sampling rate is 2 samples/second, or 2 Hz. Alternatively, we can specify the sampling period, which is the inverse of the sampling rate (in this example, 0.5 sec). It turns out that the sampling rate has a terribly important effect on whether your digitized signal looks anything like the real-world signal. Figure 10.23. An actual signal and a sampled signal with dots representing digitized/sampled values
When the sampling rate isn't high enough, a scary thing happens. Aliasing, while not intuitive, is easy to observe (see Figure 10.24). If we sample 8.5 times slower (the circles), our reconstructed signal looks nothing like the original. Figure 10.24. Signal alias caused by inadequate sampling
Aliasing has the effect of introducing frequencies into your data that didn't exist in the real-world signal (and removing some that did), thereby severely distorting your signal. Once you have aliased data, you can never go back: There is no way to remove the "aliases." That's why it's so important to sample at a high-enough rate. How do you determine what your sampling rate should be? A guy named Nyquist figured it out, and his principle, called Nyquist's Theorem,[3] is simple to state:
So, for example, if you know that the signal you are measuring is capable of varying as much as 1000 times per second (1000 Hz), you'd need to choose a sampling rate higher than 2 kHz. Notice that the whole Nyquist Sampling Theorem implies that you know what the highest frequency component will be. It is imperative that you find out if you don't know already; if you can't know ahead of time what the highest frequency component will be, you'll need to filter the signal to remove potential high-frequency components, as we describe next. The Nyquist Theorem only deals with accurately representing the frequency of the signal. It doesn't say anything about accurately representing the shape of your signal. To adequately preserve the shape of your signal, you should sample at a much higher rate than the Nyquist frequency, generally at least 5 or 10 times the maximum frequency component of your signal. Another reason for knowing the frequency range of your signal is anti-aliasing filters (lowpass filters). In many real-world applications, signals pick up a great deal of high-frequency noise, glitches, or spikes that will greatly exceed the theoretical frequency limit of the frequency measurement you are making. For example, a common biomedical signal is the electrocardiogram (ECG or EKG), a voltage that is related to heart activity. Although these signals rarely have components beyond 250 Hz, the electrode leads easily pick up RF (radio-frequency) noise in the 100 kHz and MHz range! Rather than sample at extremely high frequencies, these DAQ systems implement some low-pass filters that cut out waveforms above the 250 Hz. The DAQ device can then breathe easier and sample at only, say, 600 Hz. The only case where sampling rate is not important is in the so-called DC signals, such as temperature or pressure. The physical nature of these signals is such that they cannot vary by much in less than a second. In these cases, a low sampling rate like 10 Hz should do. In Conclusion . . .We've covered a lot of issues involving the path from the physical phenomena to the DAQ devices. If you didn't grasp many or even most of these concepts at first, don't worry. DAQ theory is a complex subject, and unless you've had some experience in this area of electrical engineering, it can take some practice before you understand it all. You've seen a summary of how signals are classified, what kind of transducers are often used, the importance of signal conditioning, the different measurement configurations for digitizing grounded or floating signal sources, and the necessity of using Nyquist's Sampling Theorem. You'd need to take a couple of electrical engineering courses to thoroughly cover the whole topic of data acquisition and instrumentation; we've just skimmed the surface in this section. Nonetheless, it should be enough to get you started with your measurements. |