Data acquisition
WCR 20131018
We will discuss how to collect analog data in the laboratory. We will not discuss here the collection of video or still images, nor will we discuss here the collection of position data that is determined by image processing.
A digital signal is a signal that can take on two possible values: true or false, on or off, 0 or 1. The voltage equivalents of those two values depends on the hardware and software in use. For example, one might define false/off/zero as zero volts, and true/on/one as +5V. An analog signal is any signal that is not digital Analog signals are signals that can take on a continuously variable range of values. Examples of analog data: force, torque, angle, pressure, temperature, electromyogram, electrocardiogram, electroencephalogram, position, velocity, acceleration, angle. Quantities such as force, torque, etc., are converted to voltage by a transducer of some kind. Small voltages such as EMG, EKG, and EEG are amplified, often by a factor of a thousand or more, to make a larger voltage than can be measured more accurately. The analog signal, a voltage, is converted to a whole number by an analog to digital converter (ADC). The ADC then forwards the whole number to the computer, where it may be displayed and/or saved.
National Instruments and other vendors make a variety of ADCs adapted for different purposes. We will consider a few of them here.
NI USB 9215A-BNC has 4 differential analog input channels. It has 4 BNC connectors for inputs. The device connects to the computer by a USB cable. It can convert up to 100 kilosamples per second per channel, with a voltage range of +-10V on each channel and 16 bit resolution.
Bit is short for binary digit. An ADC with 16 bits of resolution uses 16 binary digits to make the whole number equivalent to the voltage. Since binary digits can only take on the values 0 and 1, this means the integers than the ADC can generate range from sixteen zeros to sixteen ones. This corresponds to 2^{16}=65536 possible levels. If the full scale range is 20V (-10V to +10V) and there are 65536 levels, each level spans a range of 20V/65536= 0.3052 mV. One might therefore say the ADC has a voltage resolution of 0.305 mV (millivolts). Tets with the Measurement and Automation Explorer program show that the USB-9215A BNC offers only differential mode, andf that the resolution is about 0.35 mV at +-10V range, and that the resolution does not improve if a +-1V range is specified. This is consistent with the device specs, which say that the voltage range is fixed at +- 10V.
A differential input has two wires per channel: one labeled “+” and one labelled “-”. The ADC measures the voltage difference between the wires. A single ended input has one wire per channel. The ADC measures the difference between that one wire and ground. Differential inputs are often more resistant to corruption by noise, and are appropriate to use when the input source is “floating”, i.e. not grounded. If the input is from a battery-powered device, it is a floating source, and a differential input should be used.
NI USB-6008 has 4 differential analog inputs or 8 single-ended analog inputs (10 kSamples/sec/channel, 12 bit resolution in differential mode, 11 bit resolution in single ended mode). It has 2 analog outputs which can be used to generate outputs from 0 to +5V with 12 bit resolution. It has 12 digital input/output lines and a digital input which can be used as a 32 bit counter or as a trigger for starting data acquisition. The analog inputs in differential mode can be configured to have a full scale range of +-10V (i.e. 4.88 mV resolution) to +-1V (0.488 mV resolution). The Measurement and Automation Explorer (MAX) program from NI indicates that the USB-6008 can be configured with differential or referenced single-ended (RSE) inputs. The MAX program showed resolution of 5 mV when the voltage range was specififed to be +-10V, and 0.5 mV when a range of +-1V was specified. n referenced single-ended mode, the resolution is 10 mV over +-10V, which corresponds to 11 bits of resolution. The resolution was still 10 mV when the requested range was +-1V. This is consistent with device specs which say that in single ended mode, the only voltage range is +-10V.
Program dataacq_simpleexample.vi acquires analog voltages, displays the voltages after collecting them, and writes the numbers to disk.
When USB-9215A(BNC) is used (in differential mode, the only allowed mode), and unscaled U16 data is requested, it returns unsigned integer multiples ranging from 0 to 65535 in steps of 1, from minimum to maximum voltage. When I wire +10, -10 to maximum value, minimum value of AI Voltage.vi, the min and max voltages returned by Analog 2D DBL Nchan Nsamp.vi, when the inputs are about +17 or -17V, are +10.4625V and 10.4312V. This corresponds to 3.18817 mV/bit, and we predict a U16 output of +32718.4 when the input voltage is zero. When an input voltage of zero is connected, U16 values 32718, 32719 correspond to -0.11 mV and +0.21 mV, and step size =0.32 mV/bit: (+0.85mv(0.11mv))/3 bits. I don’t know why the min and max voltages are not -10.0 and +10.0V, since those are the values passed to Analog Voltage.vi.
When the USB-6008 is used in differential mode, and unscaled U16 data is requested, it returns unsigned integer multiple of 16 ranging from 0 to 65520 in steps of 16, from minimum to maximum voltage. In RSE mode the number returned are also in steps of 16 (which seems contrary to one of the USB-6008 data sheets which states 11 bit resolution in RSE mode). When I wire +10, 10V to maximum, minimum of AI Voltage.vi, and connect input voltage=0, Analog 2D DBL Nchan Nsamp.vi returns +1.4 mV (scaled DBL) = 32768 (U16). Rare steps to 3.7 mV = 32752 are seen, indicating stepsize=5.1 mV. Input voltages of +17, -17V yield outputs of +10.4334V=65521 and 10.4350V=+1 (scaled DBL=U16). This implies stepsize=20.8684/4095=5.096068 mV and it predicts that when input=zero, U16 output = 32763. Closest multiple of 16 is 32768, which is observed when input = zero volts.
The results above show that the conversion factor used by Analog 2D DBL differs depending on the device in use. |