Data Acquisition Toolbox™, in conjunction with the MATLAB® technical computing environment, gives you the ability to measure and analyze physical phenomena. The purpose of any data acquisition system is to provide you with the tools and resources necessary to do so.
You can think of a data acquisition system as a collection of software and hardware that connects you to the physical world. A typical data acquisition system consists of these components.
Data acquisition hardware
At the heart of any data acquisition system lies the data acquisition hardware. The main function of this hardware is to convert analog signals to digital signals, and to convert digital signals to analog signals.
Sensors and actuators can both be transducers. A transducer is a device that converts input energy of one form into output energy of another form. For example, a microphone is a sensor that converts sound energy (in the form of pressure) into electrical energy, while a loudspeaker is an actuator that converts electrical energy into sound energy.
Signal conditioning hardware
Sensor signals are often incompatible with data acquisition hardware. To overcome this incompatibility, the signal must be conditioned. For example, you might need to condition an input signal by amplifying it or by removing unwanted frequency components. Output signals might need conditioning as well. However, only input signal conditioning is discussed in this topic.
The computer provides a processor, a system clock, a bus to transfer data, and memory and disk space to store data.
Data acquisition software allows you to exchange information between the computer and the hardware. For example, typical software allows you to configure the sampling rate of your board, and acquire a predefined amount of data.
The following diagram illustrates the data acquisition components, and their relationships to each other.
The figure depicts the two important features of a data acquisition system:
Signals are input to a sensor, conditioned, converted into bits that a computer can read, and analyzed to extract meaningful information.
For example, sound level data is acquired from a microphone, amplified, digitized by a sound card, and stored in MATLAB workspace for subsequent analysis of frequency content.
Data from a computer is converted into an analog signal and output to an actuator.
For example, a vector of data in MATLAB workspace is converted to an analog signal by a sound card and output to a loudspeaker.
Data acquisition hardware is either internal and installed directly into an expansion slot inside your computer, or external and connected to your computer through an external cable, which is typically a USB cable.
At the simplest level, data acquisition hardware is characterized by the subsystems it possesses. A subsystem is a component of your data acquisition hardware that performs a specialized task. Common subsystems include
Analog input subsystems convert real-world analog input signals from a sensor into bits that can be read by your computer. Perhaps the most important of all the subsystems commonly available, they are typically multichannel devices offering 12 or 16 bits of resolution.
Analog input subsystems are also referred to as AI subsystems, A/D converters, or ADCs. Analog input subsystems are discussed in detail here.
Analog output subsystems convert digital data stored on your computer to a real-world analog signal. These subsystems perform the inverse conversion of analog input subsystems. Typical acquisition boards offer two output channels with 12 bits of resolution, with special hardware available to support multiple channel analog output operations.
Analog output subsystems are also referred to as AO subsystems, D/A converters, or DACs.
Digital input/output (DIO) subsystems are designed to input and output digital values (logic levels) to and from hardware. These values are typically handled either as single bits or lines, or as a port, which typically consists of eight lines.
While most popular data acquisition cards include some digital I/O capability, it is usually limited to simple operations, and special dedicated hardware is often necessary for performing advanced digital I/O operations.
Counter/timer (C/T) subsystems are used for event counting, frequency and period measurement, and pulse train generation. Use the session-based interface to work with the counter/timer subsystems.
A sensor converts the physical phenomena of interest into a signal that is input into your data acquisition hardware. There are two main types of sensors based on the output they produce: digital sensors and analog sensors.
Digital sensors produce an output signal that is a digital representation of the input signal, and has discrete values of magnitude measured at discrete times. A digital sensor must output logic levels that are compatible with the digital receiver. Some standard logic levels include transistor-transistor logic (TTL) and emitter-coupled logic (ECL). Examples of digital sensors include switches and position encoders.
Analog sensors produce an output signal that is directly proportional to the input signal, and is continuous in both magnitude and in time. Most physical variables such as temperature, pressure, and acceleration are continuous in nature and are readily measured with an analog sensor. For example, the temperature of an automobile cooling system and the acceleration produced by a child on a swing all vary continuously.
The sensor you use depends on the phenomena you are measuring. Some common analog sensors and the physical variables they measure are listed below.
Common Analog Sensors
Resistive temperature device (RTD)
When choosing the best analog sensor to use, you must match the characteristics of the physical variable you are measuring with the characteristics of the sensor. The two most important sensor characteristics are:
The sensor output
The sensor bandwidth
You can use thermocouples and accelerometers without performing linear conversions.
The output from a sensor can be an analog signal or a digital signal, and the output variable is usually a voltage although some sensors output current.
Current Signals. Current is often used to transmit signals in noisy environments because it is much less affected by environmental noise. The full scale range of the current signal is often either 4-20 mA or 0-20 mA. A 4-20 mA signal has the advantage that even at minimum signal value, there should be a detectable current flowing. The absence of this indicates a wiring problem.
Before conversion by the analog input subsystem, the current signals are usually turned into voltage signals by a current-sensing resistor. The resistor should be of high precision, perhaps 0.03% or 0.01% depending on the resolution of your hardware. Additionally, the voltage signal should match the signal to an input range of the analog input hardware. For 4-20 mA signals, a 50 ohm resistor will give a voltage of 1 V for a 20 mA signal by Ohm's law.
Voltage Signals. The most commonly interfaced signal is a voltage signal. For example, thermocouples, strain gauges, and accelerometers all produce voltage signals. There are three major aspects of a voltage signal that you need to consider:
If the signal is smaller than a few millivolts, you might need to amplify it. If it is larger than the maximum range of your analog input hardware (typically ±10 V), you will have to divide the signal down using a resistor network.
The amplitude is related to the sensitivity (resolution) of your hardware. Refer to Accuracy and Precision for more information about hardware sensitivity.
Whenever you acquire data, you should decide the highest frequency you want to measure.
The highest frequency component of the signal determines how often you should sample the input. If you have more than one input, but only one analog input subsystem, then the overall sampling rate goes up in proportion to the number of inputs. Higher frequencies might be present as noise, which you can remove by filtering the signal before it is digitized.
If you sample the input signal at least twice as fast as the highest frequency component, then that signal will be uniquely characterized. However, this rate might not mimic the waveform very closely. For a rapidly varying signal, you might need a sampling rate of roughly 10 to 20 times the highest frequency to get an accurate picture of the waveform. For slowly varying signals, you need only consider the minimum time for a significant change in the signal.
The frequency is related to the bandwidth of your measurement. Bandwidth is discussed in Sensor Bandwidth.
How long do you want to sample the signal for? If you are storing data to memory or to a disk file, then the duration determines the storage resources required. The format of the stored data also affects the amount of storage space required. For example, data stored in ASCII format takes more space than data stored in binary format.
In a real-world data acquisition experiment, the physical phenomena you are measuring has expected limits. For example, the temperature of your automobile's cooling system varies continuously between its low limit and high limit. The temperature limits, as well as how rapidly the temperature varies between the limits, depends on several factors including your driving habits, the weather, and the condition of the cooling system. The expected limits might be readily approximated, but there are an infinite number of possible temperatures that you can measure at a given time. As explained in Quantization, these unlimited possibilities are mapped to a finite set of values by your data acquisition hardware.
The bandwidth is given by the range of frequencies present in the signal being measured. You can also think of bandwidth as being related to the rate of change of the signal. A slowly varying signal has a low bandwidth, while a rapidly varying signal has a high bandwidth. To properly measure the physical phenomena of interest, the sensor bandwidth must be compatible with the measurement bandwidth.
You might want to use sensors with the widest possible bandwidth when making any physical measurement. This is the one way to ensure that the basic measurement system is capable of responding linearly over the full range of interest. However, the wider the bandwidth of the sensor, the more you must be concerned with eliminating sensor response to unwanted frequency components.
Sensor signals are often incompatible with data acquisition hardware. To overcome this incompatibility, the sensor signal must be conditioned. The type of signal conditioning required depends on the sensor you are using. For example, a signal might have a small amplitude and require amplification, or it might contain unwanted frequency components and require filtering. Common ways to condition signals include
Low-level – less than around 100 millivolts – usually need to be amplified. High-level signals might also require amplification depending on the input range of the analog input subsystem.
For example, the output signal from a thermocouple is small and must be amplified before it is digitized. Signal amplification allows you to reduce noise and to make use of the full range of your hardware thereby increasing the resolution of the measurement.
Filtering removes unwanted noise from the signal of interest. A noise filter is used on slowly varying signals such as temperature to attenuate higher frequency signals that can reduce the accuracy of your measurement.
Rapidly varying signals such as vibration often require a different type of filter known as an antialiasing filter. An antialiasing filter removes undesirable higher frequencies that might lead to erroneous measurements.
If the signal of interest contains high-voltage transients that could damage the computer, then the sensor signals should be electrically isolated from the computer for safety purposes.
You can also use electrical isolation to make sure that the readings from the data acquisition hardware are not affected by differences in ground potentials. For example, when the hardware device and the sensor signal are each referenced to ground, problems occur if there is a potential difference between the two grounds. This difference can lead to a ground loop, which might lead to erroneous measurements. Using electrically isolated signal conditioning modules eliminates the ground loop and ensures that the signals are accurately represented.
A common technique for measuring several signals with a single measuring device is multiplexing.
Signal conditioning devices for analog signals often provide multiplexing for use with slowly changing signals such as temperature. This is in addition to any built-in multiplexing on the DAQ board. The A/D converter samples one channel, switches to the next channel and samples it, switches to the next channel, and so on. Because the same A/D converter is sampling many channels, the effective sampling rate of each individual channel is inversely proportional to the number of channels sampled.
You must take care when using multiplexers so that the switched signal has sufficient time to settle. Refer to Noise for more information about settling time.
Some sensors require an excitation source to operate. For example, strain gauges, and resistive temperature devices (RTDs) require external voltage or current excitation. Signal conditioning modules for these sensors usually provide the necessary excitation. RTD measurements are usually made with a current source that converts the variation in resistance to a measurable voltage.
The computer provides a processor, a system clock, a bus to transfer data, and memory and disk space to store data.
The processor controls how fast data is accepted by the converter. The system clock provides time information about the acquired data. Knowing that you recorded a sensor reading is generally not enough. You also need to know when that measurement occurred.
Data is transferred from the hardware to system memory via dynamic memory access (DMA) or interrupts. DMA is hardware controlled and therefore extremely fast. Interrupts might be slow because of the latency time between when a board requests interrupt servicing and when the computer responds. The maximum acquisition rate is also determined by the computer's bus architecture. Refer to How Are Acquired Samples Clocked? for more information about DMA and interrupts.
Regardless of the hardware you are using, you must send information to the hardware and receive information from the hardware. You send configuration information to the hardware such as the sampling rate, and receive information from the hardware such as data, status messages, and error messages. You might also need to supply the hardware with information so that you can integrate it with other hardware and with computer resources. This information exchange is accomplished with software.
There are two kinds of software:
For example, suppose you are using Data Acquisition Toolbox software with a National Instruments® board and its associated driver. The following diagram shows the relationship between you, the driver software, the application software.
The diagram illustrates that you supply information to the hardware, and you receive information from the hardware.
For a data acquisition device, there is associated driver software that you must use. Driver software allows you to access and control your hardware. Among other things, basic driver software allows you to
Transfer data to and from the board
Control the rate at which data is acquired
Integrate the data acquisition hardware with computer resources such as processor interrupts, DMA, and memory
Integrate the data acquisition hardware with signal conditioning hardware
Access multiple subsystems on a given data acquisition board
Access multiple data acquisition boards
Application software provides a convenient front end to the driver software. Basic application software allows you to
Report relevant information such as the number of samples acquired
Manage the data stored in computer memory
Condition a signal
Plot acquired data
MATLAB and Data Acquisition Toolbox software provide you with these capabilities, and provide tools that let you perform analysis on the data.