Data Acquisition Using LabVIEW
Data Acquisition Using LabVIEW
Summary
Most research today is done with the aid of computers. The computer is used to control the
experiment, measure the data, and analyze the results. In this experiment, principles of data
acquisition and equipment control are introduced. Specifically, LabVIEW is used to interface
the computer with programmable measuring instruments such as the digital multimeter
(DMM), power supply, function generator and digital oscilloscope.
Objectives
Use the power supply, function generator, DMM, and oscilloscope LabVIEW instrument
drivers.
Background Information
Data acquisition consists of the elements shown in figure 1. The physical phenomenon may
be electrical (voltage, current or resistance), optical (light intensity), mechanical (strain, speed,
pressure, etc.), thermal (temperature), or anything else to be measured.
The sensor reacts to changes in the phenomenon and produces a relative signal that may be
transmitted, recorded, and analyzed.
Signal Conditioning involves amplifying and filtering the signal in order to prepare it for
analog-to-digital (A/D) conversion.
An A/D Converter samples the analog (continuous) signal and converts the amplitude at
each sample time to a digital value suitable to the computer. In the laboratory, the digital
multimeter and digital oscilloscope perform this operation.
Physical
Phenomenon
Sensor
Signal
Conditioning
Gain
Filter
Analog to Digital
Conversion
Computer
10110011
In order to automate the process of acquiring data, a computer program must be written to
control the hardware, collect the data, analyze the data, and present the results. Traditional
programming languages (like Basic and C) may be used to accomplish this task, but they
require a great deal of programming. Furthermore, traditional programming languages do not
provide an easy way to produce and display graphs.
LabVIEW
LabVIEW solves the limitations of the traditional programming languages. LabVIEW
(Laboratory Virtual Instrument Engineering Workbench) is a powerful and flexible
instrumentation and analysis software system. LabVIEW features a graphical programming
environment with tools necessary for data acquisition, analysis, and presentation.
2
Procedure
Build each of the following LabVIEW Virtual Instruments using the instrument drivers for the
power supply, digital multimeter, function generator and oscilloscope.
1
10
6
5
4
2
9
Figure 3: VI for setting either the positive or negative side of the power supply.
1.
Power Supply
The power supply driver controls the voltage and current limit settings of the power supply.
In this procedure, a LabVIEW VI is built to supply either positive or negative voltage from the
power supply. The case structure of the VI is used to choose either the positive or negative
terminals of the power supply in accordance to the entered voltage.
1.1.
Build the VI shown in figure 3. Note that there is only one case structure in the VI.
Figure 3 displays both the True and False options of the same case structure.
1.3. Run the VI and ensure it operates properly by completing the following table. Use the
DMM to measure the power supply output.
Power Supply
Setting (Volts)
-20
-10
0
10
20
Measured Output
(Volts)
Percent
Error
1.4. Connect the negative, neutral and positive terminals of the power supply to the L.E.D.
(Light-Emitting-Diode) board. Record the minimum required voltage to light each
L.E.D.
LED
Voltage
Right Light
Left Light
4
2
2.
Digital Multimeter
The input to the DMM instrument driver is an integer value specifying the type of
measurement: 0 for DC Volts, 1 for AC Volts, 2 for DC Amps, 3 for AC Amps, 4 for Ohms, 5
for frequency and 6 for period. The DMM driver first selects the type of measurement and
then reads the measurement.
In this procedure, a LabVIEW VI is built to measure the resistance of a potentiometer
(adjustable resistor).
2.1. Build the LabVIEW VI shown in figure 4. The DMM Function custom control is found
in the 'User Controls' section of the Control menu.
DMM
Reading
Percent
Error
2.5. Adjust the potentiometer knob and measure the maximum and minimum resistance
values.
Potentiometer
Resistance
Minimum
Maximum
3.
The function generator instrument driver is used to control the settings of the function
generator. Specifically, the driver controls the wave type, frequency, amplitude (peak to peak),
and offset voltage.
The digital oscilloscope has two instrument drivers. One driver captures the signal displayed
on the screen of the oscilloscope. The other driver takes measurements from the signal
displayed on the screen. For this procedure, use the oscilloscope capture driver to display the
function generator signal.
3.1. Build the LabVIEW VI shown in figure 5. Note that there is only one sequence structure
in the VI. Figure 5 displays two panels of the same structure.
3.2. Adjust the x-axis precision of the waveform graph to have two decimal places to
enhance the display of the waveform.
3.3. Record the purpose of each numbered icon in the VI.
3.4. Connect the output of the function generator to channel 1 on the oscilloscope using a
BNC to BNC cable.
3.5. Set the function generator to output a triangle wave with a 5 Volt amplitude (peak to
peak) and frequency of 25Hz.
3
4
1
5
2
6
Figure 5: VI to set the function generator output and display it using the digital oscilloscope.
3.6. Execute the VI and ensure it works properly by completing the following table.
In order to measure the signal parameters, display the waveform graph cursor and record
the appropriate values. Compare these measured values to the settings of the function
generator by computing the percent difference between them.
Parameter
Function Generator
Setting
Oscilloscope
Reading
Percent
Error
Period (ms)
Amplitude (VPP)
4.
The function generator instrument driver is used to control the settings of function generator.
Specifically, the driver controls the wave type, frequency, amplitude (peak to peak), and offset
voltage.
The digital oscilloscope has two instrument drivers. One driver captures the signal displayed
on the screen of the oscilloscope. The other driver takes measurements from the signal
displayed on the screen. For this procedure, use the oscilloscope measure driver to measure
parameters of the function generator signal.
4.1. Build the LabVIEW VI shown in figure 6. Note that there is only one sequence structure
in the VI. Figure 6 displays several panels of the same structure.
4.2. Record the purpose of each numbered icon in the VI.
4.3. Connect the output of the function generator to channel 1 on the oscilloscope using a
BNC to BNC cable.
4.4. Set the function generator to output a triangle wave with a 2 Volt amplitude (peak to
peak), 2 Volt DC offset, and frequency of 20Hz.
3
4
1
5
2
6
Figure 6: VI to set the function generator output and measure it using the digital oscilloscope.
4.5. Execute the VI and ensure it works properly by completing the following table.
Compare the measured values to the settings of the function generator by computing the
percent difference between them.
Parameter
Function Generator
Setting
Frequency (Hz)
Amplitude (VPP)
Offset (VDC)
Oscilloscope
Reading
Percent
Error
Presentation Question 1
An engineering company has contracted your group to write a LabVIEW VI to automatically
determine the current-voltage characteristic for a light bulb. Their plans are to use the VI
program to ensure the quality of newly manufactured light bulbs.
The current-voltage characteristic of the light bulb is to be determined from 0 to 10 Volts. For
quick analysis, the current-voltage characteristic is plotted on an XY graph with no less than
20 samples. Also, note that a time delay is often required between the setting of the power
supply and reading the measurement of the DMM.
The company wants your group to present the answers to the following questions about the
project.
How are the instruments and light bulb connected in order to measure the current-voltage
characteristic?
What are the details of the LabVIEW VI program? How does it work?
After the presentation, the company may have a few additional questions for you.
Presentation Question 2
An engineering company has contracted your group to write a LabVIEW VI to control the
brightness a light bulb. Their plans are to use the VI program in a larger program that controls
the light, temperature, and airflow of a high-rise building.
The light bulb to be controlled can have a maximum applied power of 3 Watts. The VI
program allows the user to adjust the light from off to maximum brightness without exceeding
the 3-Watt limit of the bulb. The VI program should continue to execute until it is terminated
by the user.
The company wants your group to present the answers to the following questions about the
project.
How are the instruments and light bulb connected together for use with the VI program?
What are the details of the LabVIEW VI program? How does it work? How does your
program ensure the bulb wattage is less than 3 Watts?
Could the VI program be modified to check if the light bulb is burned out?
After the presentation, the company may have a few additional questions for you.
Presentation Question 3
A research company has contracted your group to write a LabVIEW VI to control the lighting
of a light bulb for studying light effects on plant growth. Specifically, the company wants to
be able to set the amount of time the bulb is lit and the amount of time the light is off.
The light bulb must be powered by the power supply. The VI program allows the user to set
the light on time in seconds and light off time in seconds. The VI program continues turning
the bulb on and off until it is terminated by the user.
The company wants your group to present the answers to the following questions about the
project.
What is the purpose of writing a program to turn on and off the light bulb?
How are the instruments and light bulb connected together for use with the VI program?
What are the details of the LabVIEW VI program? How does it work?
After the presentation, the company may have a few additional questions for you.
10
Presentation Question 4
An engineering company has contracted your group to write a LabVIEW VI to control two
LEDs and output a light pattern. If this project is successful, they plan to contract you to build
a large LED screen for advertising products.
The VI program outputs the following light pattern: Left LED on for two seconds, both LEDs
off for two seconds, right LED on for two seconds, both LEDs off for two seconds, both LED
on for two seconds, and finally, both LEDs off for two seconds. The VI program operates
continually until it is terminated by the user.
The company wants your group to present the answers to the following questions about the
project.
How are the instruments and LED connected together for use with the VI program?
What are the details of the LabVIEW VI program? How does it work?
Could the VI program be modified to allow the user to adjust the timing? How?
After the presentation, the company may have a few additional questions for you.
11
Presentation Question 5
An engineering company has contracted your group to write a LabVIEW VI to monitor and
display the output of a potentiometer (variable resistor). Specifically, the VI displays the
potentiometer knob and indicator on the computer screen. As the knob is turned, the
corresponding indicator position is changed on the computer screen.
Additionally, the company wants the VI to display four lights indicating if the knob indicator
is in the first quarter, second quarter, third quarter, or fourth quarter of the knob range.
The company wants your group to present the answers to the following questions about the
project.
How are the instruments connected together for use with the VI program?
How did you determine when the knob indicator is in the first, second, third or fourth
quarter of the potentiometer range?
What are the details of the LabVIEW VI program? How does it work?
After the presentation, the company may have a few additional questions for you.
12