Data Acquisition Systems
In questa pagina 8
DAQ modules: what they are
A DAQ (Data AcQuisition) module is a programmable instrument that acquires and stores portions of analog or digital signals of variable length in an easy and flexible way. In the laboratory it is essential for carrying out software-level post-processing of signals, so as to extract various types of information from them.
Example hardware shown on the slides: a USB module of the National Instruments family (grey case with a USB cable and screw terminals) and two Measurement Computing modules (one with a USB port, an Ethernet RJ45 socket and a mini-USB socket, one labelled USB-204).
Connection to the data-processing device (normally a PC):
- serial connection (USB, RS232);
- Ethernet;
- PCI (Peripheral Component Interconnect);
- Bluetooth or WiFi.
DAQs are equipped with one or more screw connection terminal blocks to connect the signal lines easily. The terminal block shown for one module is labelled, from left to right: GND, AI0, AI4, GND, AI1, AI5, GND, AI2, AI6, GND, AI3, AI7, GND, AO0, AO1, GND (AI = analog input, AO = analog output, GND = ground).
Block diagram of a DAQ
+-- control lines (blue) from uP to MUX, PGA, ADC, uP --+
| |
N_AI analog +-----+ +-----+ +-----+ +--------+ +----+----+ user interface
inputs ----> | MUX | --> | PGA | --> | ADC | ===> | BUFFER | <===> | uP | <===> (RS232, USB,
(AI0 ... ) +-----+ +-----+ +-----+ | M | +----+----+ ETHERNET,
gain K_g f_S,ADC, N_b +---^----+ ^ BLUETOOTH,
| | 802.11)
+---+-----------------+--+
trigger sources ---------------------------------->| TRIGGER |
+------------------------+The diagram on the slide marks the parameters (number of analog inputs), (gain of the PGA), and (conversion rate and number of bits of the ADC), (buffer size).
Blocks:
- Inputs: their number depends on the DAQ model. They allow the connection of signal sources (for example sensors).
- Multiplexer (MUX): selects one of the input lines.
- Programmable gain amplifier (PGA): adapts the signal at the MUX output to the input range of the analog-to-digital converter.
- Analog-to-digital converter (ADC): samples and converts the acquired signal into digital form (see Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →).
- Buffer (acquisition memory): a set of memory cells that stores up to samples of the signal.
- Microprocessor (uP): processes the acquired samples to obtain the measurement; alternatively the data can be transmitted in raw format. It also drives the other blocks and the trigger.
Sampling and A/D conversion
Key parameters of the ADC:
- maximum resolution, expressed as the number of bits with which the output samples are represented;
- input range between two voltage values, and ;
- conversion time .
Commercial DAQs normally have a single ADC shared among all analog input lines. Access to the ADC follows a time division multiple access (TDMA) logic: it is up to the multiplexer to scan the various input lines so as to reproduce the trends of the input signals at its output.
Hardware structure for the scan: the MUX receives an ADDRESS from the microprocessor; between the MUX and the ADC sits a sample-and-hold amplifier (SHA) controlled by a CONTROL line from the microprocessor; the ADC output goes to the microprocessor.
inputs --> [ MUX ] --> [ SHA ] --> [ ADC ] ==> [ MICROPROCESSOR ]
^ ^ | |
| ADDRESS | CONTROL | |
+-----------|--------------------------+ |
+-----------------------------+Timing of the scan. The microprocessor stores in its memory a table with the addresses of the active input channels that the multiplexer must scan.
- Every seconds a new address is sent to the multiplexer, selecting the next input of the scan.
- If is the time needed for one conversion, the sampling period of a single signal must satisfy
- The sampling frequency of each signal is
- The frequency with which the microprocessor sends channel addresses to the multiplexer is
The slide figure with three channels AI0, AI1, AI2 shows that the samples of the three signals are taken one after the other, shifted in time: each channel is sampled every , and consecutive conversions (of different channels) are separated by
AI0 is a slow-varying signal, AI1 a faster oscillating one and AI2 a very slowly varying one, all sampled with the same .
Simultaneous sampling. With the single-ADC scheme above the channels are sampled at different instants. If simultaneous sampling is desired, other configurations must be adopted: placing a SHA on each input, controlled by the microprocessor, makes it possible to synchronise the sampling phase and therefore the acquired data. The hold phase of the various SHAs must last at least (because the single ADC then converts the held values one after the other through the MUX).
in 1 --> [SHA] --\
in 2 --> [SHA] ---\
in 3 --> [SHA] ----> [ MUX ] --> [ ADC ] ==> [ microprocessor ]
... ^ | address + SHA control
in N --> [SHA] --/ +--------------------------+Hardware timing vs software timing
- Hardware timing: the timing of the various blocks is provided by the microprocessor inside the DAQ module.
- Software timing: the timing is managed by the user application, so sampling happens only when a reading command is received through the communication interface. This does not guarantee uniform sampling instants and introduces latencies due to the exchange of messages through the interface.
Acquisition modes
- Acquisition with predefined duration (also called on-demand): the process starts following an event called trigger and ends after a pre-established number of samples has been acquired. The number of samples to acquire may also be greater than the size of the acquisition buffer.
- Continuous acquisition: once started, it ends only when the system is deactivated or a reset command is sent, of hardware or software type. The software reset is sent to the DAQ module through the standard communication interface.
Acquisition timing and the buffer
The ADC output consists of binary words stored in the buffer (acquisition memory). The buffer is a temporary storage: from there the data must either be processed or transferred to a system memory. The transfer can occur when the buffer is completely full, or at regular time intervals regardless of its filling state.
The time interval between two successive readings must be less than
otherwise there is overflow, that is, data loss. (Meaning: is the number of samples per second entering the buffer; divided by that is the time needed to fill it.)
Post-trigger and pre-trigger
- Post-trigger: acquisition takes place only in conjunction with a trigger event that corresponds to the start of the acquisition process. Input signals are sampled only after the trigger event.
- Pre-trigger: in some applications it is useful to have information about the input signals also in the time intervals before the trigger event. The acquisition buffer is divided into two memory areas, pre-trigger and post-trigger.
- Pre-trigger memory: managed as a circular buffer: once all the locations are filled, the oldest samples are overwritten by the newly acquired ones. Before the trigger event, samples are stored in the pre-trigger memory.
- Post-trigger memory: handled like a normal acquisition buffer. When the trigger event occurs, storage in the pre-trigger memory ends and samples begin to be stored in the post-trigger memory.
The slide figure shows a signal starting at the origin, a horizontal red dashed line labelled "Livello di Trigger" (trigger level, in Italian on the slide) reached at the instant marked by a blue dashed vertical line, and a total interval delimited by two green dash-dot lines. The portion before the trigger is labelled , the portion after the trigger is labelled , and the trigger instant is marked on the axis. The slide gives no further text: the figure is read as "the samples before the trigger are , those after it are ".
Trigger
In the simplest case a start command, sent by the system and received by the DAQ module through the communication interface, makes the microprocessor start acquiring. Starting can also simply coincide with power-up: acquisition begins as soon as the module is powered and initialised. In many applications it is however useful to link the acquisition to a trigger event, defined and identified when certain conditions occur on signal input lines of the module used as trigger sources.
Trigger from a digital signal. A signal with two logical levels is the trigger source. Trigger events (that start a new acquisition) are generated at the rising edge or at the falling edge of the trigger signal. The figure shows a square wave with one trigger event (red arrow) at each rising edge.
Digital word trigger. Trigger events are defined on several digital sources: the event corresponds to the detection of a specific binary word (a pattern of bits), or to the conclusion of this word. The figure shows two examples with three digital sources: "pattern matches (pattern = 000)", where events occur at instants when all three lines are low; and "pattern does not match (pattern = 111)", where events appear at the instants when a line leaves the all-high state (the first when the top line falls, the second when the bottom line falls). The slide labels these as the pattern "matches" or "does not match" cases.
Trigger from an analog signal, level and slope. The most common criterion: a condition on the signal level and on the direction of the slope. The trigger is generated when the signal crosses the specified level with the desired slope (positive or negative). The figure shows a triangular wave and a horizontal LEVEL line; with "rising edge" selected there is one event at each upward crossing.
Trigger from an analog signal, window. The user sets a lower limit (bottom level) and an upper limit (top level).
- Entering window: an event is generated when the signal enters the range between the two levels (events at the crossings that go into the window).
- Leaving window: an event is generated when the signal leaves the window of interest (events at the crossings that go out of the window).
Configuration of the input channels
The signals applied to the analog inputs come from sensors, probes or electrodes of various types, which are in general considered simply as signal sources.
- Differential sources: the signal carrying the information is the potential difference between two terminals.
- Sources referred to ground: the signal is the potential difference between a terminal and the ground potential.
Two input configurations of the module:
- Differential input (DIFF). The source is connected directly to a pair of differential inputs (AI0+ and AI0-). The measured signal is exactly the potential difference between the two terminals:
The AGND terminal is connected to the ground of the module and not to the source.
- Input with potential referred to ground (RSE, referenced single-ended). One terminal of the source is connected to the ground (AGND) of the acquisition card. The measured signal is the potential difference between the analog input of the board and the analog ground reference:
In the figure, in both cases the measurement is the voltage at the input of an amplifier whose "+" input receives AI0 (or AI0+) and whose "-" input receives AI0- (DIFF) or AGND (RSE).
For the same configuration names as used in Matlab ('SingleEnded', 'Differential'...) see Lab 6 - Interaction with DAQ ModulesLaboratory on a National Instruments MyDAQ module driven from Matlab's Data Acquisition Toolbox: check the device with daq.getDevices, create a session, set Rate and duration, add analog input or output channels, acquire with startForeground, then generate a sine on AO0, feed an RC filter and acquire its output on AI0.Lab 6 - Interaction with DAQ Modules →.
Relations to other notes
The A/D conversion process (sampling, quantisation) is covered in Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →; the effect of sampling a signal at too low a rate is in Aliasing and Anti-Aliasing FiltersAliasing is the overlap of spectral replicas that occurs when the band-limited or Nyquist assumptions of the sampling theorem fail; an anti-aliasing low-pass filter with cut-off omega_s/2 applied before sampling removes it at the price of losing the high frequencies; two worked exercises.Aliasing and Anti-Aliasing Filters →.
Versione ripasso
- DAQ (Data AcQuisition) module: programmable instrument that acquires and stores portions of analog or digital signals of variable length; in the lab it supports software post-processing.
- Connection to the PC: serial (USB, RS232), Ethernet, PCI, Bluetooth or WiFi. Signal lines go to screw terminal blocks (AI = analog input, AO = analog output, GND).
- Block chain (with the parameters of the diagram):
- inputs, of them;
- MUX: selects one input line;
- PGA: gain , adapts the signal to the ADC input range;
- ADC: conversion rate, or bits, range to , conversion time ;
- buffer (acquisition memory): up to samples;
- microprocessor: processes the samples or sends them raw; it also drives the blocks and the trigger.
- Commercial DAQs have one ADC shared by all analog inputs, accessed with time division multiple access (TDMA): the MUX scans the channels. Between MUX and ADC sits a SHA controlled by the microprocessor; the microprocessor keeps a table of the active channel addresses.
- Timing of the scan:
- is the sampling period of each single signal; is the time between two consecutive conversions of different channels.
- Simultaneous sampling needs one SHA per input, controlled by the microprocessor; each hold phase lasts at least , because the single ADC converts the held values one after another.
- Hardware timing (clock inside the DAQ) gives uniform sampling; software timing (one sample per read command) gives non-uniform instants and latency.
- Acquisition modes:
- predefined duration (on demand): starts at a trigger and stops after a set number of samples, which may exceed ;
- continuous: runs until deactivation or a hardware or software reset.
- Buffer: temporary storage; data are read out either when full or at regular intervals. Readout must happen within
otherwise overflow (data loss).
- Post-trigger: samples are stored only after the trigger.
- Pre-trigger: the buffer has two areas. The pre-trigger area is a circular buffer (oldest samples overwritten); at the trigger, storage moves to the post-trigger area, which works as a normal buffer. Before the trigger the samples are , after it (figure labelled with the trigger level).
- Trigger sources:
- start command, or power-up;
- digital signal: rising or falling edge;
- digital word: a specific bit pattern matches (or does not match) on several lines;
- analog level and slope: crossing a level with positive or negative slope;
- analog window: entering or leaving the band between bottom and top level.
- Input configuration:
- differential (DIFF): ; AGND stays with the module;
- referenced to ground (RSE): , one terminal of the source at the card ground.
- Matlab names:
'SingleEnded','Differential', see Lab 6 - Interaction with DAQ ModulesLaboratory on a National Instruments MyDAQ module driven from Matlab's Data Acquisition Toolbox: check the device with daq.getDevices, create a session, set Rate and duration, add analog input or output channels, acquire with startForeground, then generate a sine on AO0, feed an RC filter and acquire its output on AI0.Lab 6 - Interaction with DAQ Modules →.
- Sampling theory behind the rates: Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →; sampling too slowly causes the effects of Aliasing and Anti-Aliasing FiltersAliasing is the overlap of spectral replicas that occurs when the band-limited or Nyquist assumptions of the sampling theorem fail; an anti-aliasing low-pass filter with cut-off omega_s/2 applied before sampling removes it at the price of losing the high frequencies; two worked exercises.Aliasing and Anti-Aliasing Filters →.
- Typical errors:
- reading the buffer too slowly, causing overflow;
- forgetting that channels are sampled at different instants;
- confusing the per-channel period with the conversion period ;
- choosing the referenced-to-ground input for a differential source instead of DIFF.