PC based multi-channel data acquisition of sensor signals

PC based multi-channel data acquisition of sensor signals. Objective Understand the principles of operation and limitations of the data acquisition sy...
Author: Moses Barber
36 downloads 0 Views 166KB Size
PC based multi-channel data acquisition of sensor signals. Objective Understand the principles of operation and limitations of the data acquisition system. • Single channel data acquisition. • Multi channel data acquisition. • Data acquisition at different sampling rates. • Effect of quantization. Overview Traditionally, measurements are done on stand-alone instruments of various typesoscilloscopes, multi meters, counters etc. However, the need to record the measurements and process the collected data for 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 the instruments and a computer. Many instruments have a serial port, which can exchange data with a computer or other instruments. Use of GPIB (General purpose Instrumentation Bus) interface board allows instruments to transfer data in a parallel format. Another way to measure signals and transfer the data to a computer is by using a Data Acquisition (DAQ) board. A typical commercial DAQ card contains ADC and DAC that allows input and output of analog and digital signals in addition to digital input/output channels. 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 the following figure.

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 at least be 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.

Commercially available boards have different sampling frequencies. The DAQ board in the underwater lab has a 12 bit ADC. Most boards also have a multiplexer that acts like a switch between different channels and the ADC. Therefore with 1 ADC, it is possible to have a multichannel input DAQ board. The board available in the underwater lab has 8 channel analog input. This makes it possible to acquire up to 8 analog signals in parallel (however, the sampling frequency will be divided by the number of parallel channels). Precision of the analog input signal converted into digital format is dependent upon the number of bits the ADC uses. The resolution of the converted signal is a function of the number of bits the ADC uses to represent the digital data. 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. 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 than 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 DAQ board. Digital to Analog Converter The multifunction boards also have on-board digital to analog converters (DAC). A DAC can generate an analog output from a digital input. This allows the 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 and the number of bits that are used in converting the digital code into an analog signal. 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. It integrates different DAQ boards in a computer and uses various functions of a DAQ 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 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: • Device number • Channel that is being used • Sampling Rate

Lab Objectives Experiment 1 Familiarization with hardware and required software.  NI ---- card will be used to acquire the signal onto a PC. Functional generator and power amplifier should be used to generate and amplify the signal. Get familiar with the card and the Terminal Box (BNC-2110).  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.  ---- sensor will be used to acquire underwater signal. Get familiar with all the hardware and software to be used. Experiment 2 Generation of sine wave from functional generator and acquiring with DAQ using different sampling rates( 500Hz, 750Hz, 1kHz, 2kHz, 4kHz).

Functional Generator

DAQ

PC

Steps : 1. Generate sine wave of 1kHz using functional generator. • Choose the sine wave from the panel, • Fix the frequency of 1kHz. • Fix the amplitude of 10V. 2. Program the labview to acquire and store the signal in a note pad 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 is 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. 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 an 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 >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. Modifying the X-scale on both of 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 ScalesTime(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.

Changing some of the titles and values of some of the 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. Table 1. Changes to the values or text of various items Item Old Text or Value x-scale title of top Waveform Graph Time x-scale title of bottom Waveform Graph 2 Title of bottom Waveform Graph 2

New Text or Value Time (Seconds)

Time

Frequency (Hz)

Waveform Graph 2

Fast Fourier Transform

4. The Front Panel Diagram window should appear as in Fig. 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 the default values for this laboratory select Operate>>Make Current Values Default and press the left mouse button. 5. The work at this point should be saved.

Final arrangement of front panel controls and displays.

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