Table of Contents
Data Acquisition Instrumentation
- TDS1012B oscilloscope is a 100 MHz input bandwith instrument with a 1 Gsps sampling rate at 8-bit resolution.
When a signal from the AFG3021B waveform generator is recorded by the TDS1012B, which instrument limits observables
such as signal to noise ratio, total harmonic distortion, etc.? Review the specifications of both devices:
TDS1000-Oscilloscope-Datasheet-3,
tektronix-tds1001b-users-manual,
tek afg3000 series arbitrary function generators reference manual.
- For a particular experiment, what combination of ADC precision, accuracy and conversion rate is required?
Eight bits at 1 GHz, 16 bits at 250 kHz or 24 bits at 7 Hz?
- What are the important attributes of ADCs? What are these parameters: analog bandwidth, conversion rate, effective number of bits,
linearity, total harmonic distortion, signal to noise ratio, spurious-free dynamic range,
signal to noise and distortion, channel isolation, aperture or acquisition time and aperture jitter?
- Review some good ADCs.
- From Analog Devices, a multiplexed 16-bit, 1 Msps, serial and parallel output
AD7655 specifications:
AD7655-EP,
AD7655,
EVAL-AD76XXEDZ evaluation board.
- From Analog Devices, an 18-bit, 1.25 Msps, serial and parallel output
AD7643 specifications:
AD7643 18-bit 1250ksps parallel serial,
EVAL-AD76XXEDZ evaluation board.
- From Texas Instruments, a multiplexed, dual channel, 16-bit, 1 Msps, serial output
ADS8363 and
evaluation module specifications:
ads8363,
ads8363evm.
- From TI, an 18-bit, 1 Msps, parallel output
ADS8482
and evaluation module specifications:
ads8482,
ads848xevm evaluation board.
- From TI, an 24-bit, 105 ksps, parallel output
ADS1271
and evaluation module specifications:
ads1271,
ads1271evm evaluation board.
- from TI, a 14-bit 250 Msps, LVDS and CMOS parallel output
ADS62949,
evaluation module
FMC adapter (for connection to the Opal Kelly LX-1) specifications:
ads62p49,
ads62pxxevm,
FMC-ADC-ADAPTER Physical Design Database (zip).
- For this course, the TI ADS8363 is a good choice. The plan was to use the ADS8363EVM board with the
chipKIT Max32, but there has been insufficient time to write and test the microcontroller program.
- For this part of the course, a PCI analog and digital IO card from National Instruments will be used.
Review the specifications of the NI M Series Multi-Function Data Acquisition Boards
and the 6221. Why was this board chosen?
Reading the NI DAQ M Series User Manual 371022k is an absolute
necessity for use of this board.
- To understand the higher precision Delta-Sigma ADC, read the lecture notes for
ECE 627 Oversampled Delta-Sigma Data Converters.
Data Acquisition with PCI(e) Analog and Digital I/O Boards
- Discuss communication schemes. Is direct communication possible? Usually, proprietary dynamic link libraries (dll or so)
are required. Communication with the board through the dll requires knowledge of the data structures, classes and
functions, information which should be available in a "C API" document. NI provides one global library, NI-DAQmx, for many boards.
This is good and bad. It provides a consistent interface for many boards, but when you are using only one board
this interface is more complicated than it needs to be.
- Help with the C API is not available as a pdf but only through the
help menu: programs > national instruments > NIDAQmx > C reference help. This was captured as a
NI-DAQmx Base 3.x C Function Reference Help PDF by Daniel Gruss.
This reference is incomplete, so communication
with anything other than LabView will encounter unresolvable issues at some point. This is a result of the profitability
of selling LabView. Other board makers provide a more complete C API and often modules for a variety of
high-level programming languages such as Python and MatLab.
- To find NI-DAQmx compatible devices, open LabView from the start menu, open a new project, go to the "Tools" menu and
click on "Measurement and Automation Explorer". Go to "Devices and Interfaces" and under NI-DAQmx, "Dev1" should be present.
- Can VISA be used? Not for the 6221 because there is no language, such as SCPI, to be communicated through the
VISA protocols, so you must communicate directly through the dll.
NI-VISA enables register-level communication with PCI (or PXI) DAQ cards which are bound to NI-DAQmx by
treating them as PXI resources. To view what can be done with a PXI card with NI-VISA, select something similar to
"PXI2::6::INSTR" that shows up under PXI System and press "Open VISA Test Panel". The accessible functionality
should be evident.The Python/ctypes program CallingVISADLL can connect to a pci-6221 board
but ends abruptly when, sadly, there is nothing to be said by either party.
- It is useful to glean information about the functions and data structures of the dll by scanning it. First,
locate the dll. Execute the DLL Export Viewer
found in dllexp.zip. Also execute
dependency walker found in
depends22_x86.zip.
- The discerning eye might notice that in nicaiu.dll and the programming API every constant and function has the "DAQmx_" or "DAQmx"
prefix.
The purpose of this was to drive programmers insane. NI's own programmers were probably written off as collateral
DAQmx_damage. Fortunately, it was easy to create a class of constants and a class of functions for which this prefix has
been removed. These classes are defined in nidaqmx_constants.py and
nidaqmx_functions.py, and these modules were created by
make_constants.py and
make_functions.py which parse the include file
NIDAQmx.h. Marina has a pci-6221 tab, and it is a DAQmx_-free environment.
Those with significant experience with nicaiu.dll might ask "Why DAQmx_would this DAQmx_be of any DAQmx_value?", but
we will just
DAQmxhumor(them).
Using the Ctypes Module of Python To Access NI-DAQmx
- Python provides a module called ctypes which enables your program to access the data structures and functions
of libraries created using C and C++.
- Use find_devices.py to find NI-DAQmx-compatible boards
present in your computer. The result should be "Dev1".
- To read a single analog input channel, download ain_nidaqmx.py
which uses the module nidaqmx.py. Together, they constitute
a modified version of the cookbook article.
Reading the C API reference was necessary too. These modules use the DAQmx_whatever convention for constants and functions.
- Set the function generator to produce a 2 Vpp sinewave at 1000 Hz and set the expected load impedance to high Z.
Run ain_nidaqmx.py with the default values of samples = 2000, sample_rate = 100000. Zoom in on the plot and observe
the density of data points. Save the data file with a suitably obscure name.
- Does your data have any offset? Note that line 37 of ain_nidaqmx.py is set to default. Change
"self.Cfg_Default" to "self.RSE" to remove the offset problem and use any AI GND pin.
- Download and unzip marina, and modify modules.txt to include
the pci6221 tab and supporting modules. From this point on, use Marina for all measurements.
- Increase the amplitude of the signal to 5 V and examine the peaks of the graph for evidence of ADC saturation.
Now increase Vpp slowly until evidence of saturation appears. You might want to refer to the specification
document to see just how large Vpp can be. Fortunately, the function generator max Vpp is 20 V.
Note the min and max values in the program. Lower the AD conversion range to -5 to 5. and set the function generator
Vpp to 11 V and beyond, as directed by the instructor.
- Set the ADC min max range to -10 to 10 V and experiment with digitization noise by observing the waveforms as you lower Vpp.
- Explore the effects of sampling each cycle of the waveform at fewer and fewer points. At what sampling rate
relative to the frequency does the waveform become seriously distorted? Save some interesting plots and data sets.
- Determine the maximum sampling rate of the 6221.
- Note that the program assumes that the data values are taken at a constant time interval. This might not be the
case. It would be better to have the board report the time at which each data point was taken.
Fast Fourier Transform and Power Spectrum of a Digitized Signal
- The Fast Fourier Transform (FFT) enables us
to compute power spectra of signals very quickly. Marina uses the
numpy.fft.fft()
and numpy.fft.fftfreq()
functions of the numpy or scipy fft module
to compute power spectra.
- Download the new version of pci_6221.py, to the
directory marina -> marina -> app -> pci6221.
- Begin by connecting the sine wave output of the function generator to both the scope and the pci-6221 card,
henceforth referred to as the adc. The scope can sample at a rate as high as 1 Gsps, while the adc runs up to 240 ksps.
The scope always produces 2500 data points per scan, while the adc has no limit. These are important differences, and there
are situations for which one or the other instrument provides superior data. In the work below, compare the data
from the scope to that of the adc. In particular, notice minimum and maximum frequencies that appear in the
power spectra. Use either the newest Marina™ supplied on a task page for data acquisition or your own version, if it
is sufficiently functional.
- Set the AFG3021B to produce a 10 Vpp sine wave at 10 kHz with 0 offset into a high impedance, and acquire data from the adc
at 105 sps for 104 samples. Note the peak power of the the fundamental signal and any harmonics. Also, note the
maximum frequency produces by the fft algorithm. Expand the graph around the peak at 10 kHz. What is the peak frequency?
What is the bandwith determined by the positions of the data points to either side of the peak? Now, vary the
samples parameters to 1000 and 100. Make the same observation and report the differences. Draw a conclusion concerning
the resolution and precision of the lineshapes as the number of data points decreases. Also, state a conclusion
concerning the ability to detect harmonics as the number of data points decreases. Finally, how does the high frequency
limit of the fft quantitatively depend upon the number of samples?
- Set the FG to produce a 10 kHz square wave, 10 Vpp, 105 sps and 104 samples.
Explain the observed the power spectrum.
Nyquist Frequency or Sampling Rate
- Set the FG to produce a 10 kHz, 10 Vpp sine wave that is amplitude-modulated (AM) at 9 kHz to a depth
of 50%. This produces sidebands at 1 and 19 kHz.
Run the program with samples = 104 and sampling rate = 100kHz. Explain the positions and sizes
of all peaks in the spectrum. Reduce the sampling rate through the sequence 100 kHz, 50 kHz, 40 kHz, 38 kHz,
37 kHz, 36 kHz and 30 kHz. Explain your observations. When the rate is 30 kHz, note that the 19 kHz peak appears
as a peak at a lower frequency, leading to the statement that the 19 kHz peak appears as an alias at a lower
frequency. Explain how this is possible using a mathematical or graphical argument.
- The Nyquist sampling rate is defined
as the minimum sampling rate required to reproduce a sine wave at a particular frequency, that is, twice the signal
frequency. Conversely, the Nyquist frequency is the highest frequency that can be reproduced at a particular
sampling rate, that is, one half the sampling rate. The association of
Harry Nyquist with sampling theory concepts is a bit obscure,
since his most notable work, Certain Topics in Telegraph Transmission Theory
(Trans. AIEE, vol. 47, pp. 617–644, Apr. 1928),
does not address that specifically.
- Set the sample rate to 25 ksps and samples to 104. Note that the 19 kHz sideband now appears at 6 kHz.
Record the power ratios of both sidebands relative to the power at 10 kHz. Try to reduce the pseudo-signal at
6 kHz signal by at least 3 dB by inserting a low-pass RC filter or by 20 dB using a notch filter at 19 MHz
(divider(parallel(3.3e5 nH, 2.2e5 pF), 6.8e5 pF)).
- Remove the RC filter and step the sample rate down through the sequence 23, 22, 21, 20.1, 20, 19.5, 19.1 and 19 ksps.
Note the position and magnitude of the alias signal. Then continue, trying 18.9 and 17 ksps. State a conclusion
concerning the efficacy of sub-Nyquist sampling.
- At 17 ksps, insert the low-pass filter once again and measure the change in the power ratios among the peaks.
- Explore the concept of sub-Nyquist sampling, that is, sampling well below the Nyquist sampling rate for a signal
of a certain frequency. Set the FG to deliver a pure sine wave at 10 Vpp and use a sampling rate of 100 kHz.
Calculate a set of frequencies beyond the Nyquist frequency for this sampling rate (50 kHz) which will appear with
an alias of 10 kHz. Sequentially set the FG to these frequencies and measure the power on the power spectrum at
10 kHz. Here are examples of the power spectra from the scope
and the adc when the applied frequency is 2.19 MHz. Notice that
the signals are comparable even though the adc is sampling only once every 10 cycles. Such a low sampling rate works
in this case because the coherence time of the input signal is much longer than the observation time. If time-dependent
random phase is introduced, the sub-Nyquist sampling would not be as effective.
Draw a conclusion about the usefulness of sub-Nyquist sampling.
- The concepts of the Nyquist frequency and aliasing have a firm mathematical basis in the
Nyquist-Shannon sampling theorem.
Read about Claude Shannon, whose signature work
is The Mathematical Theory of Communication .
Coherence of Signals and Autocorrelation
- Participate in the discussion of coherence of electronic signals and the concept of autocorrelation,
the convolution of a function or data set with itself.
Remember the Convolution Theorem: the Fourier transform (FT) of a convolution of two
functions is the product of the FT's of the two functions.
- The numpy correlate() function
can be used for autocorrelation. Computation is quick because, using the Convolution Theorem, Fast Fourier Transforms (FFTs)
are used. The Correlate() function of ain_nidaqmx.py or the autocorrelate button on Marina™
performs a causal autocorrelation of a sine wave from the waveform generator. This is achieved by keeping only
the second half of the array returned by numpy.correlate(A, A, mode='full'), where A is the data array.
Begin with ν = 10 kHz, sample rate = 240000, samples = 1000 and about 4 Vpp.
Vary the sample rate and the number of samples, and record the autocorrelation graphs. Explain why the graph
always has the same shape. Is there a drift in the relative coherence of the function generator and the pci-6221
data acquisition board, or is there another explanation?
- Delve deeper into the concept of coherence by setting the waveform generator to sweep the sinewave frequency
from 10 kHz to 13 kHz in 10 ms. Using Marina™, view the signal in the time and frequency domains as well as
observing the autocorrelation function. Be sure to take a sufficient number of data points.
Then, gradually increase the final frequency up to a maximum of 100 kHz. Explain
the rapid decay of the autocorrelation function and the recurrences of coherence.
Improving the Signal to Noise Ratio (SNR): Synchronous Detection and Fourier Transform
Concepts
- Noise is generally defined as any undesirable signal masking or interfering with a desired signal. If a single
frequency sinewave signal at ωo is sought, then noise could one or more of the following:
a coherent signal at another frequency;
a signal with randomly fluctuating amplitude, the classic amplitude noise;
a random phase fluctuation in the periodic signal at ωo, known as phase noise;
a sum of periodic signals over a finite bandwidth in frequency with either fixed or random relative phases.
Some examples of a periodic signal with noise:
- For the following discussion and experimentation, the noise will be random amplitude fluctuations.
In general, if the time periods during which the signal of interest is present are known, then data can be taken during such
a period, and noise data can be taken when the signal is not present. Subtracting the latter from the former is
the process known as background noise subtraction. When done many times, the SNR will improve.
- When acquiring data with an ADC, remember the Nyquist frequency! Given the sampling rate, be sure to use a
low-pass filter, with the steepest edge possible, which attenuates beyond the Nyquist frequency of half the
sampling rate. If no filter is used, then high frequency noise will appear at an alias frequency within the
range of observation.
- For this discussion, assume that the signal of interest is a sinewave of single frequency and no phase jitter.
- Using digitized data, the best way to detect a single frequency or small bandwidth signal buried in much larger random noise is to use the FFT to generate the power
spectrum. In the frequency domain, the noise signal is spread uniformly over the entire range of observation,
and a very weak signal can be detected.
- Example of a periodic signal at 10 kHz (amplitude 1.0) with normal distribution of random fluctuations with
a standard deviation of 104:
- In the past, SNRs were improved using purely analog electronics and the concept of synchronous or lock-in
detection which provides the ability to detect a small coherent signal amidst wide-band
random noise or other coherent signals at different frequencies.
- To perform synchronous detection with a digitized sinewave data stream, the idea will be to take
data at successive π/2 and 3π/2 points on the weak signal sine waveform of amplitude A and subtract the latter from the former.
When done N times, the sum of the data will be 2A + sum of differences of consecutive noise measurements. Hopefully, the noise
summation will tend toward zero as N becomes large. However, this process wastes most of the desired signal.
It would be better to sum several points
over the positive part of the sinewave and subtract from that the sum of several points over the negative part
of the waveform. This multi-point or integrating process will yield a better SNR.
Synchronous Detection Experiment
- To investigate synchronous detection, a very small amplitude sinewave burst will be added to a large random noise
signal, and the result will be analyzed with synchronous detection at several phase points. This is inefficient but
illustrative.
- To achieve coherent or synchronous detection with a digitized data stream, a fixed phase relationship must be
established between the DAC
board and the function generator. Look at the 6221 data sheet and the C help reference to determine how to
initiate data acquisition using the TTL output of the FG as a digital trigger input to the 6221.
- Read synchronous conditions, and set up
a dual function generator system as described therein.
- Down load and unzip the package of python programs to be used:
synchronous python package
- For examples of what to expect, download synchronous data
and unzip. View the graphs of half-cycle and one-cycle synchronous detection. Also, view the power spectra acquired
using Marina.
Read synchronous_conditions.txt. Peruse the instructor's data to understand what you will need to accomplish.
- Run ain_nidaqmx_synchronous.py and save the graph for a one-cycle acquistion. In a real experiment,
recorded data would be simply the time-average of the signal at the π/2 phase point. Also, run Marina and
acquire data as described in synchronous_conditions.txt. Since the sampling rate is 100 ksps, the input signal
should pass through a low-pass filter to remove noise frequencies above the Nyquist limit of 50 kHz.
Note that calculating the power spectrum produces a clear 10 kHz signal quickly.
Which technique is better: synchronous detection or a Fourier transform?
- Determine the limits of detectability for a single coherent signal buried in noise.
|
Site Navigation
Services
OSU Links
|