Labview Introduction
Labview Introduction
Objective
The experimental objective of this lab is to use LabVIEW to design a heating and cooling system and
a lighting system and to test both systems. Building these systems will demonstrate the potential for
using simulated instruments in a laboratory. These programs will also obtain data from outside the
computer and incorporate it into a program design.
Overview
The Laboratory Virtual Instrument Engineering Workbench (LabVIEW) is a development
environment designed by National Instruments that creates graphic-based programs called virtual
instruments (VIs) that simulate actual laboratory instruments. A VI consists of two parts: a front panel
and a back panel (Figure 1). The front panel allows the user to interact with the VI by displaying
outputs and allowing the user to supply the program with inputs. The back panel consists of the
code used by the VI to obtain inputs from the front panel, operate on the inputs, and display the
results.
Procedure
Note: Some tasks will be repeated and the same icons will be used. A LabVIEW digest of common
tasks at the bottom of the page contains references for faster navigation.
Setting up a Blank VI
1. Open LabVIEW and select Blank VI under Create Project.
2. Click Window > Tile Left and Right to display the front panel (left window) and back panel
(right window) side by side. This will make them visible at the same time, making it easier to
work.
3. With the back panel selected, click View > Tools Palette to open the Tools palette.
4. With the front panel selected, click View > Controls Palette. The workspace should look like
Figure 12. To open the Controls palette in the future, simply right click in the front panel.
Similarly, to open the Functions palette, simply right click in the back panel.
1. In the front panel, drag and drop three Round LEDs and three Slide Switches by going to the
Controls palette > Modern tab > Boolean (Figure 13). Each round LED and each slide switch
will represent the AC, heater, and manual mode. The round LEDs will indicate if the item is
on, and the slide switches will toggle the items on/off.
Figure 13: Slide Switches and Round LEDs in the Controls Palette
2. Rename the LEDs and their corresponding switches "Manual," "AC," and "Heater" to make
building the system clearer (Figure 14). This can be done by using the editing text tool in the
Tools palette.
Figure 14: Named Switches and LEDs in the Front Panel
3. Drag and drop a thermometer (Figure 15) into the front panel (Controls palette > Modern tab
> Numeric > Thermometer).
14.Have a TA check the VI. Once testing is complete, take a screenshot of the VI. Save the
heating and cooling system as a VI file (saving the file will save both the front panel and
back panel in one file). Send the VI file to you and your teammates via email.
3. In the automatic subdiagram, wire the output tunnel (green box along the border of the case
structure) of the less function to the input terminal of the Heat Control sub-VI labeled Heat.
Wire the output tunnel of the greater function to the input terminal of the Cool Control sub-VI
labeled Cooling.
4. Delete the orange wiring from the thermometer terminal to the upper input terminals of the
less and greater comparison functions. Wire the output terminal of the Temp Reading sub-VI
labeled Result to the upper input terminals of the comparison functions. The Temp Reading
sub-VI will effectively replace the thermometer control terminal.
5. Change the thermometer node to an indicator similarly to how it was earlier changed to a
control.
6. Wire the Result output terminal on the Temp Reading sub-VI to the thermometer indicator
terminal. The thermometer indicator terminal will be used to display the temperature being
read by the thermocouple in the heat cube.
7. A device constant must be defined for each of the pre-written sub-VIs. The device constant
selects the external device the sub-VIs transmit data to and receive data from, similar to
selecting a port for an Arduino program.
8. With the wiring tool selected, right click on the input terminal of the sub-VIs labeled Device
Name > Create > Constant.
9. Verify that all three device constants are equivalent. The device constant can be changed
using the operating tool in the Tools palette.
10.Ask the TA to check over the modifications to the VI. If correct, the TA will supply an NI
ELVIS board, a heat cube, two 100 kΩ resistors, and electrical wires.
11.Using two 100 kΩ resistors (Brown, Black, Yellow), insert one end of each resistor into
AIGND (row 18) of the NI ELVIS board.
12.Insert the other end of one of the resistors into the AI 7+ (row 15), and the end of the other
resistor into AI 7- (row 16).
13.Using a wire, connect the AI 7+ port (row 15) to the screw terminal 1 port (row 46).
14.Using a wire, connect the AI 7- port (row 16) to the screw terminal 2 port (row 47).
15.Insert the positive and negative wires from the fan into Variable Power Supplies SUPPLY+
(row 48) and Variable Power Supplies GROUND (row 49), respectively, at the lower-left-
hand corner of the NI ELVIS board.
16.Connect the positive wire from the heater to DC +5V (row 54) on the lower-right-hand corner
of the NI ELVIS board.
17.Connect the source of the MOSFET from the heat cube circuit to DC ground (row 53) on the
lower-right-hand corner of the NI ELVIS board.
18.Connect the gate of the MOSFET from the heat cube circuit to DIO 19 (row 20) on the upper-
right-hand corner of the NI ELVIS board.
19.Power the NI ELVIS board with the power cable and also connect it to the PC with the USB
cable. The device constants on the back panel of the VI should update to reference the NI
ELVIS board.
20.Run the VI. Observe how the fan and heater in the heat cube can be turned on manually and
automatically. Observe how the thermometer indicator in the front panel displays the actual
temperature of the room.
2. Lighting System
Build a VI that simulates a lighting system in a house with four rooms. The design must use four
lights (LEDs) and at least five switches — one switch per light and one master switch that will turn all
of the lights off simultaneously (think of this as a circuit breaker). The program should also interact
with real LEDs located on the NI ELVIS board.
1. The front panel of the program should use five switches and four LEDs.
2. The back panel requires a case structure for the master switch to turn off all the lights. Think
of the cases that will be required for the function of the master switch.
3. Create the program in the case structure using the appropriate functions and wiring. Use
knowledge acquired from creating the heating and cooling system, information from the
Overview, and the LabVIEW Digest at the bottom of the page.
4. After completing the program, the VI must be interfaced to the physical NI ELVIS board. The
VI is interfaced to the NI ELVIS board using a function called the Digital Writer, which writes
data to the DIO (Digital Input and Output) pins on the board, and can display outputs on the
board’s built-in LEDs from the VI. To access the Digital Writer node, go to the Functions
palette > Measurement I/O tab > NI ELVISmx > Digital Writer (Figure 27). Place the Digital
Writer node on the back panel.
6. Only two of the lines in the Digital Writer node will be used in this experiment. The Lines to
Write determine which group of eight DIO pins will be used in the VI. The Lines to Write
come in groups of eight (starting at 0) because the program works in 8-bit. The DO (Digital
Output) Lines input the Boolean values into the DIO pins.
7. For the purposes of this lab, DIO lines 0–7 will be utilized (Figure 29). To establish this
setting, right-click Lines to Write on the Digital Writer node > Create > Constant. By default,
the constant is set to 0–7. The operating tool in the Tools palette can be used to change this
value.
8. The DO Lines require an input for each of the eight DIO lines, indicating whether each one is
true or false (on or off), but the Digital Writer can only receive one input for the DO Lines (as
observed by the one input terminal for the DO Lines on the Digital Writer node). Therefore,
the eight Boolean values will be placed in an array, and the array will be input to the DO
Lines.
9. A Build Array function will be used by going to the Functions palette > Programming > Build
Array (Figure 30). The array should be eight indices long to represent each DIO line. When
first placing the array, it only appears as one index. Hover over the bottom of the array until
a two-sided arrow appears, then click and drag down until the array is eight indices long.
Figure 30: Array Function
10.Each LED should be wired to an individual index in the array, at the element terminal on the
left side of the array node. The remaining four indices in the array should be wired to false
constants, as those DIO lines should remain false at all times as they are not in use.
11.The resulting array should be wired to the Lines to Write of the Digital Writer node, from the
appended array terminal on the right side of the array node (Figure 31).
Figure 31: Completed Digital Writer Node
12.For the LEDs on the NI ELVIS board to light up, wires must be used to connect the DIO lines
(rows 0–7) directly to the LEDs on the NI ELVIS board (rows 35–42).
13.Test the VI. Double click the Digital Writer node. Ensure the correct Device and Lines to
Write are selected under Configuration of the NI ELVISmx dialog. Click OK. Run the VI in
LabVIEW. Ask a TA to check the program.
14.Take screenshots of the lighting system. Save the lighting system as a VI file.
15.Submit a ZIP file of both the heating and cooling system and the lighting system to the
EG1004 website before 11:59PM the night before the next lab.
The lab work is now complete. Please clean up the workstation. Return all unused materials to the
TA. Refer to the Assignment section for the instructions needed to prepare the lab report.
Assignment
A ZIP folder containing both LabVIEW programs (in VI format) must be submitted to
the EG1004 Website by 11:59PM the night before the next lab. There is no Team PowerPoint
Presentation for this lab.
Remember: Lab notes must be taken. Experimental details are easily forgotten unless written down.
EG1004 Lab Notes paper can be downloaded and printed from the EG1004 Website. Use the lab
notes to write the Procedure section of the lab report. At the end of each lab, a TA will scan the lab
notes and upload them to the Lab Documents section of the EG1004 Website. One point of extra
credit is awarded if the lab notes are attached at the end of the lab report. Keeping careful notes is
an essential component of all scientific practice.
Back Panel
How to define an arithmetic operation:
operation
o Click on the back panel to place the arithmetic function at a specific location
How to wire:
o Tools palette > Wiring tool
o Click the desired object output terminal (on the left side) to wire from
o Click the desired object input terminal (on the right side) to wire to
References
Introduction to LabVIEW, Six-Hour Course [Courseware]. (June 2003) Austin, TX: Worldwide
Technical Support and Product Information, National Instruments Corporation.
“LabVIEW Block Diagram Explained.” National Instruments, National Instruments, 4 Feb. 2020,
www.ni.com/en-us/support/documentation/supplemental/08/labview-block-diagram-explained.html.
“Case Structure.” National Instruments, National Instruments, 4 Feb. 2020,
www.zone.ni.com/reference/en-XX/help/371361R-01/glang/case_structure/.
“LabVIEW Front Panel Explained.” National Instruments, National Instruments, 4 Feb. 2020,
www.ni.com/en-us/support/documentation/supplemental/08/labview-front-panel-explained.html.