Salta al contenuto
Note per Studenti Data Acquisition Systems Report

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 NAIN_{AI} (number of analog inputs), KgK_g (gain of the PGA), fS,ADCf_{S,ADC} and NbN_b (conversion rate and number of bits of the ADC), MM (buffer size).

Blocks:

Sampling and A/D conversion

Key parameters of the ADC:

  • maximum resolution, expressed as the number of bits bb with which the output samples are represented;
  • input range between two voltage values, VFS−V_{FS}^- and VFS+V_{FS}^+;
  • conversion time TADCT_{ADC}.

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 TS,ADCT_{S,ADC} seconds a new address is sent to the multiplexer, selecting the next input of the scan.
  • If TADCT_{ADC} is the time needed for one conversion, the sampling period of a single signal TST_S must satisfy

TS>NAI⋅TADCT_S > N_{AI} \cdot T_{ADC}

  • The sampling frequency of each signal is

fS=1TSf_S = \frac{1}{T_S}

  • The frequency with which the microprocessor sends channel addresses to the multiplexer is

fMUX=NAI⋅fSf_{MUX} = N_{AI} \cdot f_S

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 TST_S, and consecutive conversions (of different channels) are separated by

TS,ADC=TSNAIT_{S,ADC} = \frac{T_S}{N_{AI}}

AI0 is a slow-varying signal, AI1 a faster oscillating one and AI2 a very slowly varying one, all sampled with the same TST_S.

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 TST_S (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 MM 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

TMAX=MNAI⋅fST_{MAX} = \frac{M}{N_{AI} \cdot f_S}

otherwise there is overflow, that is, data loss. (Meaning: NAIfSN_{AI} f_S is the number of samples per second entering the buffer; MM 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 V(t)V(t) 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 N−MN-M, the portion after the trigger is labelled MM, and the trigger instant is marked NN on the axis. The slide gives no further text: the figure is read as "the samples before the trigger are N−MN-M, those after it are MM".

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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:

ΔVMIS=VAI0+−VAI0−\Delta V_{MIS} = V_{AI0+} - V_{AI0-}

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:

ΔVMIS=VAI0−VAGND\Delta V_{MIS} = V_{AI0} - V_{AGND}

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, NAIN_{AI} of them;
    • MUX: selects one input line;
    • PGA: gain KgK_g, adapts the signal to the ADC input range;
    • ADC: fS,ADCf_{S,ADC} conversion rate, bb or NbN_b bits, range VFS−V_{FS}^- to VFS+V_{FS}^+, conversion time TADCT_{ADC};
    • buffer (acquisition memory): up to MM 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:

TS>NAI TADC,fS=1TS,fMUX=NAI fS,TS,ADC=TSNAIT_S > N_{AI}\,T_{ADC},\qquad f_S=\frac{1}{T_S},\qquad f_{MUX}=N_{AI}\,f_S,\qquad T_{S,ADC}=\frac{T_S}{N_{AI}}

  • TST_S is the sampling period of each single signal; TS,ADCT_{S,ADC} 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 TST_S, 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 MM;
    • 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

TMAX=MNAI fST_{MAX}=\frac{M}{N_{AI}\,f_S}

otherwise overflow (data loss).

Teoria collegata