You are on page 1of 9

CARE, IIT Delhi

CRP718 – 2015-16/1st semester


Experiment on PC based multi-channel data acquisition.

1. Objectives

Understand the principles of operation and limitations of the data acquisition system
including:
1. Single channel data acquisition.
2. Multi-channel data acquisition.
3. Data acquisition at different sampling rates.
4. Effects of quantization.

2. Overview

Traditionally, measurements are done on stand-alone instruments of various types


such as oscilloscopes, multi-meters, counters etc. However, the need to record the
measurements and process the collected data for automatic analysis and visualization
has become increasingly important. It has become essential to design systems where
the computer acquires the signal directly from the transducer.

There are several ways in which the data can be exchanged between a computer and
electronic systems or instruments. Many electronic systems / instruments have a serial
port, which can exchange data with a computer or other electronic systems /
instruments. The use of GPIB (General Purpose Instrumentation Bus) interface board
allows electronic systems / instruments to transfer data in a parallel format to a
computer.

One way to interface computers with sensor signals is through Data Acquisition
(DAQ) system. A typical DAQ system can perform analog-to-digital conversion
(ADC) that allows the input of analog sensor signals to a computer in digital data
form, and digital-to-analog conversion (DAC) that allows the output of digital data by
converting it to analog signal. In addition, DAQ systems also contain several digital
input/output channels that provide digital interface between electronic systems.

3. Sampling

The data is acquired by an ADC using a process called sampling. Sampling an analog
signal involves taking a sample of the signal at discrete times. The rate at which the
signal is sampled is known as sampling frequency. The process of sampling generates
values of the signal at equal time intervals as shown in figure 1 below.

Figure 1: Illustration of sampling of a continuous time waveform.

1
The sampling frequency determines the quality of the conversion from analog to
digital. A higher sampling frequency achieves better conversion of the analog
signals. The minimum sampling frequency required to represent the signal should
be greater than twice the maximum frequency of the analog signal under test (this is
called the Nyquist rate). If the sampling frequency is equal to or less than twice the
frequency of the input signal, a signal of lower frequency is generated from such a
process (this is called aliasing). Once the signal has been sampled, one needs to
convert the analog samples into a digital code. This process is called analog-to-
digital conversion, as illustrated in figure 2 below.

Figure 2: Illustration of analog-to-digital conversion.

Commercially available DAQ systems allow the choice of different sampling


frequencies.

Most DAQ systems also have a multiplexer that acts like a switch between the
different channels of input and the ADC. Therefore with 1 ADC, it is possible to have
a multichannel input DAQ board. The system available in the lab can support up to 8
channels of analog input. This makes it possible to acquire up to 8 analog sensor
signals in parallel (however, the sampling frequency will be divided by the number of
parallel channels being used).

The resolution of the digital format signal (or data) converted from analog input
signal is dependent upon the number of bits the ADC uses. The higher the resolution,
the higher the number of divisions the voltage range is broken into, and therefore, the
smaller the detectable voltage change. An 8-bit ADC gives 256 levels (2^8) compared
to a 12-bit ADC that has 4096 levels (2^12). Hence, a 12-bit ADC will be able to
detect smaller increments of the input signals than an 8-bit ADC. The LSB or least
significant bit is defined as the minimum increment of the voltage that an ADC can
convert. If the full scale of the input signal is 10V, then the LSB for a 3-bit ADC
corresponds to 10/2^3=1.25V. However, for a 12-bit ADC, the least significant bit
will be 10/2^12=10/4096 = 2.44mV. If one needs to detect smaller changes, one has
to use a higher resolution ADC. Clearly, the resolution is an important characteristic
of the ADC.

4. Digital to Analog Converter

The multifunction DAQ systems also have on-board digital-to-analog converters


(DAC). A DAC can generate an analog output from a digital input. This allows the

2
board to generate analog signals, both dc and ac voltages. Like the ADC, the DAC's
performance is limited by the number of samples it can process per second and the
number of bits that are used in converting the digital data into an analog signal.

5. LabVIEW

LabVIEW programs are called Virtual Instruments, or VIs, because their appearance
and operation imitate physical instruments, such as oscilloscopes and multimeters.
LabVIEW delivers a powerful graphical development environment for signal
acquisition, measurement and analysis. It can acquire data at a specified sampling
rate. It acquires data in the background while processing in the foreground. A DAQ
system can comprise of several PCB boards that can be integrated according to user
requirements. LabVIEW integrates the different DAQ system boards in a computer
and uses various functions of a board from a single user interface. Refer to the
LabVIEW manual for more details. The driver software is a lower level driver that
interfaces the LabVIEW software with the DAQ boards. As a user of LabVIEW one
does not have to worry about configuration and control of components within the
DAQ boards. LabVIEW identifies each board by a device number and therefore one
can have as many devices (as many as the computer can accept on its expansion
slots). LabVIEW can also combine and display inputs from various sources like
inputs from serial and parallel port, data acquisition board(s), and GPIB boards on a
single interface. The user interface which is called a vi consists of two parts- a front
panel and a block diagram. This is similar to that of an instrument where a front
panel is used for input and output controls, and to display the data whereas the circuit
resides on the circuit board. Similarly, you can bring the buttons, indicators and
graphing, and display functions on the front panel. When data acquisition is
performed, the software needs to know the following information:
1. Device number
2. Channel that is being used
3. Sampling Rate.

5.1 Writing the LabVIEW Programs

First make sure that you can access the various palettes needed in the front panel and
block diagram as well as the areas to find the tools, controls, and functions. It should
be noted that the Controls pallet is only accessible in the Front Panel window and
the Functions Palette is only accessible in the Block Diagram window while the
Tools Palette can be used in both. The palettes can be selected while in the Front
Panel or Block Diagram window at anytime from the Window menu item. To start a
new program:
1. Open the labview software.
2. Press the New << Blank VI button with the left mouse button. Two windows
appear, one with the name Untitled 1 at the top, which is the Front Panel window,
and the other with Untitled 1 Diagram at the top, which is the Block Diagram
window. The Tools palette also appears when the program is started. To begin writing
the LabVIEW program the tasks in the Front Panel window should first be
completed followed by the tasks in the Block Diagram window.
3. If it is not already displayed, the Controls palette can be brought up by
selecting it from the Window menu item at the top of the Front Panel with
the left mouse button.

3
5.2 Writing a Waveform Acquisition Program

A. Programming the Front Panel


There are two items, which will be placed on the Front Panel for this program: the
two Waveform Graphs. After placing these items on the Front Panel their appearance,
position, titles and other attributes will be modified.
.
1. Create a waveform graph by selecting Graph Inds>>Waveform Graph on the
Controls palette with the left mouse button. Make sure you select the
Waveform Graph and not the Waveform Chart.
2. Position the Waveform Graph (titled Waveform Graph) in the Front Panel.
3. Create a second waveform graph by selecting Graph Inds>>Waveform Graph
on the Controls palette with the left mouse button.
4. Position the second waveform graph (titled Waveform Graph 2) in the Front
Panel and press the left mouse button.

B. Modifying the X-scale on both the Waveform Graphs


1. Move the cursor over the upper Waveform Graph and press the right mouse
button to bring up the graph properties menu. Select Scales<<Time (X-Axis)
and uncheck the Auto scaling feature for the X axis.
2. Select Format and Precision>>Time(X-Axis) and verify that the Floating
Point is selected. Change the Digits of Precision to 3 and press the OK button
at the bottom of the screen.
3. Select the Editing tool from the Tools Palette and using it, select the largest
number on the x-scale of the Upper Waveform graph (which should now read
100.000) and press the left mouse button. Type in the number (0.008) and press
the Enter key on the keyboard.
4. Again select the Editing tool from the Tool Box and using it select the largest
number on the x-scale of the Lower Waveform graph (which should now read
100) and press the left mouse button. Type in the number (4000) and press the
Enter key on the keyboard.

C. Changing some of the titles and values of some items on the Front Panel
1. Select the Edit Text tool from the Tools palette.
2. All of the following changes can be made in the same way as that used for
changing the maximum value of the x-scale with the waveform graphs above.
- Select the value or text to be changed
-Type in the new value or text and press the enter key on the keyboard,
or press the left mouse key on a blank region of the panel.
3. Change the text and values as indicated in Table 1.

4. The Front Panel Diagram window should appear as in figure 3 below. Items
can be moved by placing the cursor over the item holding down the left mouse
button and dragging the item to the new location. In order to make the current
values as the default values for this experiment, select Operate>>Make
Current Values Default and press the left mouse button.
5. The work at this point should be saved.

4
Table 1. Changes to the values or text of various items

Item Old Text or Value New Text or Value


x-scale title of top Waveform Graph Time Time (Seconds)

x-scale title of bottom Waveform Time Frequency (Hz)


Graph 2
Title of bottom Waveform Graph 2 Waveform Graph 2 Fast Fourier
Transform

 Figure  3:  Final  arrangement  of  front  panel  controls  and  displays.
                                                             
D. Programming the Block Diagram
Items in the Block Diagram window allow the program to control and access channels
on the multi-channel DAQ board, to conduct calculations on the data, and to save the
data to a text file.
1. Access the Block Diagram window.
2. Bring up the Functions palette by selecting “Show Functions Palette” from
the Window menu item at the top of the Block Diagram window.  
           3.   Create   a   While   Loop   by   selecting   Exec   Ctrl>>While   Loop   from   the  
Functions       palette   using   the   left   mouse   button.   Place   the   mouse   cursor   at   the  
position   on   the   block   diagram   where   you   want   to   anchor   the   top-­‐left   corner   of  
the   While   Loop   and   press   and   hold   down   the   left   mouse   button.   When   the  
button   is   released   it   will   define   the   lower   right   corner   of   the   While   Loop.  
Everything   inside   the   While   Loop   will   be   executed   continuously   until   stopped  
by  pressing  the  Stop  button.  Notice  that  a  Stop  button  now  appears  both  on  the  
Block  diagram  and  the  Front  panel.  
           4.      Use  the  Up  navigation  button  on  the  Functions  palette  to  navigate  back  to  
the  main  Functions  palette  using  the  left  mouse  button.  
5. Select Input<<DAQ Assist vi and drag it inside the While Loop. The DAQ
assistant menu will automatically appear to configure the DAQ Assist vi:
a. Select Measurement << Analog Input.
b. Select Measurement<< Voltage.

5
c. Select Physical Channel<< (the one you have chosen). Then select
Finish.
d. A window will then appear with information about the measurement
task. In the Task Timing menu select Acquire N Samples and set the
Samples to Read to 1,000. Also set the (sample) Rate at 10,000 Hz.
The click OK to end the DAQ configuration.
6. Use the Up navigation button on the Functions palette to navigate back to the
main Functions palette with the left mouse button.
7. Create an FFT analyzer by selecting Analysis>>Spectral from the Functions
palette and drag inside the While Loop. The Spectral Measurements menu
will automatically appear to configure the FFT vi:
a. Select Spectral Measurement<< Measurement (RMS), and Result
<<Linear.
b. Select Window<<None. Then click OK to end the FFT analyzer
configuration.
8. Use the Up navigation button on the Functions palette to navigate back to the
main Functions palette with the left mouse button.
9. Create a vi to save the data in a text file by selecting Output<<Write LVM
(Write LabVIEW Measurements) from the Functions palette and drag it onto
a position outside and to the right of the While Loop on the block diagram.
The Write LVM menu will automatically appear to configure the
Measurements File (if it does not right click on the Write LVM icon and
select Properties):
a. Note and (modify) the path of the File Name.
b. Check Action<<Ask user to choose file<< Ask only once.
c. Check one of the options as desired in If a file already exists.
d. Ckeck Segment Headers<<One header per segment or as desired.
e. Check X Value Columns<< One column per channel
f. Check Delimiter<<Tab and then OK to end Configuration
g. Look at Figure to see what the block diagram should look like at this
point.
10. Close the Functions palette by selecting the X in the upper right corner of the
palette with the left mouse button.
11. Select the Connect Wire tool (spool of wire) on the Tools palette (if the
Tools palette is not visible select Window>>Show Tools Palette.
12. Now the components can be wired.

6
Figure 2: Final arrangement of the block diagram

E.  Running  the  Waveform  Acquisition  Program    


The  program  can  now  be  run  using  as  inputs  sine  or  triangle  waves  at  different  
frequencies  and  saving  the  data.  (A  disk  should  be  in  the  A  drive).  The  program  
allows   viewing   the   waveform   and   when   the   Stop   Button   is   pressed   the   last  
waveform(s)   displayed   can   be   saved.   The   fast   Fourier   transform   will   display  
peaks   at   the   frequencies   needed   to   create   the   waveform   from   a   series   of   sine  
waves.  If  the  waveform  is  a  sine  wave  there  is  only  one  peak, which is associated
with the frequency of that sine wave.
1. Start the LabVIEW Program by selecting the run arrow at the top left of the Front
Panel window of your program.
2. A waveform should be displayed and will be continuously updated in both graphs
on the Front Panel.
3. Adjust the Amplitude Adjust knob on the FUNCTION GENERATOR until a
sine wave of amplitude of approximately ± 1 is displayed in the Waveform
Graph. You will notice that the Amplitude on the graph is automatically
updated.
4. Adjust the Frequency Adjust knob on the FUNCTION GENERATOR until the
peak in the Fast Fourier Transform graph is at 500 Hz indicating the frequency
of the sine wave that is being used.
5. The data should now be saved, so select the Stop Button in your program and press
the left mouse button. A file dialog box will open asking for a file name file
destination. Save the data appending the suffix .txt to the file name.
6. Repeat Steps 1, 4 and 5 for two higher wave frequencies (do not adjust the
amplitude). Notice as the frequency increases the sine wave distorts.
7. The sampling rate can be changed by right clicking on the DAQ Assistant icon and
selecting Properties. Note the change in FFT frequency with sampling rate.

7
6. Experiment Objectives

Objective 1: Familiarization with hardware and required software.


1. The ADC of the DAQ system will be used to acquire the signal onto a PC.
The function generator and power amplifier should be used to generate and
amplify the signal. Get familiar with the card and the Terminal Box (BNC-
2110).
2. LabVIEW software will be used to acquire and process the signal. Get
familiar with the software. Use the Getting started manual to try out some
examples.
3. B&K / Keltron underwater acoustic sensors (hydrophones) will be used to
acquire underwater acoustic signal. Get familiar with all the hardware and
software to be used in this process.

Objective 2: Generation of sine wave from function generator and acquiring with
DAQ using two different sampling rates (2 kHz, 8 kHz).

Function DAQ PC
Generator

Step 1: Generate sine wave of 1.3 kHz using a function generator.


1. Choose the sine wave from the panel.
2. Set the frequency at 1.3 kHz.
3. Set the amplitude at 10V.

Step 2: Program Labview to acquire and store the signal in a notepad at a specified
sampling frequency. The signal spectrum is also plotted. The steps to be followed are
given below.
1. Verify that there is a BNC cable connected to the analog input channels on
BNC 2110.
2. Verify that the switch below the channel BNC is all the way to the right in
GS position.

Step 3: Repeat the above steps again by using the input amplitude of 1V.
Step 4: Note down the clipping and noise level.
Step 5: Comment on the results.

Objective 3: Loop back test: Generation of signal on PC and acquiring the signal
from sensor at PC again with different sampling rate.

PC DAQ PC

Step 1:
1. Program Labview to generate a sine wave of 1.3 kHz at 10V.
2. Plot the spectrum of the generated signal.
3. Program Labview to output this sine wave using out port of DAQ

8
4. Also program to receive it back using in port of DAQ.
5. Use the previous programs to acquire it at different sampling rates.
6. Plot the spectrum of the acquired signal.
7. Note down the clipping and noise level.
8. Comment on the results.
9. Repeat the above steps at a lower input voltage of 1V.

Step 2:
1. Generate square waves of 30% duty cycle.
2. Repeat the above loop-back test with specified sampling frequencies.
3. Plot the spectrum.
4. Comment on the results.

Objective 4: Generation of sine wave from function generator and acquiring the
signal from the sensor with a DAQ onto a PC using different sampling rates.

Function Power
u Pre- DAQ PC
Generator amplifier
amplifier
Tx-Rx

Steps:
1. Generate sine wave of 25 kHz at 10V using function generator.
2. Propagate this signal to the transmitter using a power-amplifier and
amplify the received signal appropriately using a pre-amplifier.
3. Acquire the signal in the PC using DAQ with sampling rate of 30kHz, and
150kHz.
4. Plot the spectrum of the output. Label the x-axis in kHz.
5. Comment on the results.

Objective 5: Measure and plot the magnitude spectrum of the transducer, using the
above approach. Use sampling rate of 150 kHz. The band under test can be swept at
intervals of 10 kHz with finer sampling of 5 kHz near the peak of the spectrum.

Self-study Component

Topics: Sampling of continuous-time signals, Digital frequency, Discrete Fourier


Transform, Nyquist’s sampling theorem, Aliasing, Reconstruction of band-limited
signals from its samples, Bandpass sampling theorem.

References: 1) A. V. Oppenheim, R. W. Schafer, Discrete-time signal processing,


Third edition, Pearson, 2014.
2) S. K. Mitra, Digital signal processing – A computer based approach, Fourth
edition, McGraw Hill, 2013.

You might also like