Sie sind auf Seite 1von 252

Engineering Projects with

NI LabVIEW

and
Vernier






















Vernier Software & Technology
13979 S.W. Millikan Way Beaverton, OR 97005-2886
Toll Free (888) 837-6437 (503) 277-2299 FAX (503) 277-2440
info@vernier.com www.vernier.com




Engineering Projects with
NI LabVIEW

and
Vernier




Michele Perrin
Steve Decker
Sam Swartley
Dave Vernier


Proper safety precautions must be taken to protect teachers and students during the
activities described herein. Neither the authors nor the publisher assumes
responsibility or liability for the use of material described in this publication. It
cannot be assumed that all safety warnings and precautions are included.









Copyright 2013 by Vernier Software & Technology. All rights reserved. Purchase
of this book and accompanying CD includes a site license entitling the teachers at
one school to modify and reproduce student activities for use by students at that one
school only. No part of this book or its accompanying CD may be used or
reproduced in any other manner without written permission of the authors except in
the case of brief quotations embodied in critical articles or reviews.

Vernier, SensorDAQ, LabQuest 2, LabQuest, and LabQuest Mini are registered
trademarks of Vernier Software & Technology in the United States. National
Instruments, NI, ni.com, and LabVIEW are trademarks of National Instruments
Corporation. Microsoft, Windows, and Microsoft Word are registered trademarks of
Microsoft Corporation in the United States and/or other countries. All other marks
not owned by us that appear herein are the property of the respective owners, who
may or may not be affiliated with, connected to, or sponsored by us.



Published by
Vernier Software & Technology
13979 S.W. Millikan Way
Beaverton, OR 97005-2886
Toll free (888) 837-6437
(503) 277-2299
FAX (503) 277-2440
info@vernier.com
www.vernier.com


ISBN 978-1-929075-98-0

Second Edition
First Printing
Printed in the United States of America

v
Contents
Preface ............................................................................................................................................ vii
Getting Started .............................................................................................................................. 1-1

Projects
1. Build a Temperature Sensor ................................................................................................ P1-1
2. Digital Control Systems ........................................................................................................ P2-1
3. LED Color Mixer ................................................................................................................... P3-1
4. Hot Wire Anemometer .......................................................................................................... P4-1
5. DC Motor Control ................................................................................................................. P5-1
6. Light Intensity & Stepper Motors .......................................................................................... P6-1
7. Servo Motors ........................................................................................................................ P7-1
8. Analyzing the Heart with EKG .............................................................................................. P8-1
9. Blood Pressure ..................................................................................................................... P9-1
10. Strain Gage Measurements ................................................................................................ P10-1
11. Propeller-Powered Pendulum ............................................................................................. P11-1
12. PID Ping-Pong

Ball Levitation .......................................................................................... P12-1



Appendices

A. Using the CD .......................................................................................................................... A-1
B. Installing the Vernier Toolkit ................................................................................................... B-1
C. Vernier Functions Palette ....................................................................................................... C-1
D. Vernier Interfaces ................................................................................................................... D-1
E. Vernier Sensors & Accessories .............................................................................................. E-1
F. SensorDAQ and the DAQ Assistant....................................................................................... F-1
G. Equipment and Supplies ....................................................................................................... G-1

vi
vii
Preface
This book is the second in a series designed to introduce students to engineering concepts and the
LabVIEW programming environment. For students new to LabVIEW, we recommend our Hands-
On Introduction to NI LabVIEW with Vernier book be used before doing the projects in this book.
In 2003, we started conducting workshops with National Instruments using LabVIEW and Vernier
sensors. In these training courses, we introduced the basics of LabVIEW programming, followed by
exercises that showed how to use Vernier interfaces, and sensors for measurement and control. The
training culminated with hands-on projects. We take the same approach in our two books.
This book is designed to provide some interesting and educational challenges to someone who has a
little experience with LabVIEW and wants to learn engineering concepts like sensor construction,
control systems, analog and digital input and output, motor control, closed-loop systems, pulse-width
modulation, and PID control. A secondary goal of this book is to show students that even though
engineering and science projects can be difficult, they can also be interesting, challenging, and even
fun.
In each chapter, we present Project Design Requirements to the student. These usually involve
constructing a simple device and then writing a LabVIEW VI to do a task. Background information,
tips, and troubleshooting hints are provided. Each chapter also includes Challenge Design
Requirements. These Challenges are somewhat more difficult, but build on the work done for the
Project. In some chapters, you will also find an Extreme Challenge.
For each chapter, teacher information follows the students section. The teacher information includes
ideas about how to present this material to students, suggestions about how to make the projects go
smoothly, additional background information, and photos of working hardware we have built. The
teacher information also includes valuable tips on programming and pitfalls to avoid when working
with LabVIEW VIs. These LabVIEW VIs are included on the CD in the back of the book. Instructors
can choose to give these VIs, or parts of them, to their students to simplify the Projects and
Challenges.
This book is designed for use with the Vernier SensorDAQ and LabQuest interfaces (LabQuest,
LabQuest Mini, or LabQuest 2). There are some differences in how a Project or Challenge is
described, based on which interface is being used.
This book assumes that you are using LabVIEW 2009 or newer. We have installers for both
Windows and Macintosh computers These installers add the Vernier Toolkit to your version of
LabVIEW. See Appendix B for installation instructions.
We feel it is important for teachers to look over the information presented in the appendices. The
appendices include valuable information that can help you become more comfortable with your
initial use of the Vernier sensors and LabVIEW software. Appendix C may also be a good reference
for students as they work on LabVIEW VIs using the Vernier functions palette. Appendix G will
help you find the material you need to do the Projects and Challenges in this book.

viii
Here is a list of all the information available in each appendix:
Appendix A provides instructions on how to use the files found on the CD.
Appendix B explains how to install the Vernier Toolkit so it can be used with your version of
LabVIEW.
Appendix C provides information on the Vernier function palettes.
Appendix D provides information on Vernier interfaces.
Appendix E provides information on other Vernier products for Engineering Education.
Appendix F describes the use of the DAQ Assistant Express VI with the SensorDAQ screw
terminal.
Appendix G describes the equipment and supplies you need to do the Projects and
Challenges in this book.

Videos of some of the Projects, Challenges, and Extreme Challenges in this book can be found at
www.vernier.com/epv.
The material for this book was developed based on extensive experimentation at Vernier Software
& Technology and in schools over many years. The principle author of this book is Michele Perrin,
a former engineering, math, and science teacher in Saint Louis. Steve Decker, a high school
engineering teacher in Portland, developed and wrote programs for several projects. Dave Vernier,
who has been encouraging students to do projects like this for 40 years, also contributed. Sam
Swartley created the Express VIs for both SensorDAQ and LabQuest that make this book possible.
Thanks to David Lim for help with some of the photos. We are also thankful to all those who helped
with the testing of these projects, including John Melville, Mathew Anthes-Washburn, Andrew
Heymann, and Brian Russell. We offer our thanks to those who helped in the editing, including
John Wheeler and Gretchen Stahmer DeMoss.



Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology 1 - 1
Getting Started
The Vernier Toolkit adds support for Vernier SensorDAQ and LabQuest interfaces to LabVIEW.
This section was designed to give you a brief tutorial on some of the special programming
features available in the Vernier Toolkit. You will practice graphing data with an analog sensor,
learn to control a digital device, and then combine the two activities into a single application. At
the end of this section, you will find a list of the projects in this book along with their required
Vernier sensors and/or accessories. These projects require a basic knowledge of LabVIEW
programming. If you need a refresher, check out our first book, Hands-On Introduction to NI
LabVIEW with Vernier.

PART 1 LABVIEW AND THE VERNIER TOOLKIT
About LabVIEW
LabVIEW is a graphical programming language used by millions of engineers and scientists to
develop sophisticated measurement, test, and control programs. LabVIEW offers integration
with thousands of hardware devices, and provides hundreds of built-in libraries for advanced
analysis and data visualization. The LabVIEW platform is scalable across multiple targets and
operating systems, and since its introduction in 1986, has become an industry leader.
Educators use LabVIEW for teaching engineering concepts, controlling student design projects,
and researching advanced topics. LabVIEW allows hands-on investigation of sensor-based
systems by acquiring a signal, performing analysis, and visualizing the data.
LabVIEW is a graphical programming language that uses icons instead of lines of text to create
programs. In contrast to text-based programming languages, where instructions determine
program execution, LabVIEW uses dataflow programming, where the flow of data determines
execution order.
LabVIEW programs and subroutines are called virtual instruments (VIs). A LabVIEW VI
represents a fundamental shift from traditional hardware-centered instrumentation systems to
software-centered systems that exploit the computing power, productivity, display, and
connectivity capabilities of popular computers and workstations. With LabVIEW VIs, engineers
and scientists build measurement and automation programs that suit their needs exactly (user-
defined) instead of being limited by traditional fixed-function instruments (vendor-defined).
The LabVIEW Education Edition software helps teachers bring Science, Technology,
Engineering, and Math (STEM) to life through hands-on learning. With LabVIEW, you can
quickly build a program to log data, power a motor, or analyze information. LabVIEW
Education Edition was designed in conjunction with Tufts Center for Engineering Education and
Outreach to meet the needs of engineering educators, and works seamlessly with products such
as Vernier SensorDAQ, Vernier LabQuest technology, and the LEGO NXT Intelligent Brick.
About the Vernier Toolkit
The Vernier Toolkit is a library of functions, Express VIs, examples, utilities, and documentation
designed to simplify the development process when building projects with Vernier technology.

1 - 2
Engineering Projects with NI LabVIEW and Vernier

The toolkit is optimized for specific applications ranging from auto-identification and calibration
of sensors to output voltage control. You can download the latest installer directly from the
Vernier website (www.vernier.com/labview/downloads). We provide versions for Windows and
Macintosh. See Appendix B for installation instructions.
Once the Vernier Toolkit is added to LabVIEW, you will have new palettes of VIs to use for
writing programs. Due to subtle differences in the capabilities of the Vernier interfaces, there are
two separate versions of palettesone for the SensorDAQ and one for LabQuest interfaces. The
palettes look and act almost identically, but you must match the proper ones to your interface to
avoid a programming error. If you are using a Vernier SensorDAQ and you use a LabQuest VI in
your program, you will see an error message.

Figure 1 Vernier functions palettes for LabQuest and SensorDAQ
These palettes include Express VIs and subVIs. The two most common functions that you will
use when building your projects are the Analog Express VI and the Digital Express VI. The
Analog Express VI will allow you to collect data from an analog sensor. The Digital Express VI
will allow you to collect data from a digital sensor or control a digital output device. A third
Express VI that is included is used to control a Vernier Power Amplifier.
You may find that the screenshots for this book do not exactly match what you see on your
screen. Minor differences in the screenshot may be due to differences between the SensorDAQ
and LabQuest interfaces, or between different versions of LabVIEW. Be flexible with the minor
differences; however, make sure that your Vernier functions palette contains the Express VIs
shown above.

PART 2 COLLECTING DATA FROM AN ANALOG SENSOR
The Analog Express VI will collect data from any Vernier analog sensor. Examples include
Temperature, Force, and Light Sensors. Analog sensors that are connected to any of the BTA
channels are automatically detected, and their readings are displayed. The Analog Express VI is
configured with a default Sample Rate of 10 samples/second and a default Length of 10 seconds.
The Sampling Rate and Length can be adjusted by clicking the Set Timing button in the
configuration window. Sampling Rates less than 200 samples/second will configure the VI for
Single Point Sampling, which means that data values will be delivered point-by-point in real
time as they are collected. With this configuration, the Express VI must be placed within a loop.
Getting Started
Engineering Projects with NI LabVIEW and Vernier 1 - 3
With each iteration of the loop, a single data point (the most recent) will be available to be read
and displayed or plotted. To collect all of the data, the Express VI must be called as many times
as the total number of data points.
Tip: Avoid adding code that requires a lot of processing time to the loop because the loop must
be able to repeat fast enough to keep up with your sampling rate.
Specifying a Sampling Rate greater than 200 samples/second will configure the Analog Express
VI for Multi-Point Sampling, and data values will be delivered as a set after the collection
period. This configuration does not require the Analog Express VI be placed within a loop,
because, unlike single point data collection, the Express VI only requires a single call to retrieve
all of the data. When the Express VI is called, the program must wait until all readings have been
taken and are available before the program can move forward.
It is also possible to configure the Analog Express VI for continuous multi-point collection. Do
this by specifying a Sampling Rate greater than 200 samples/second and selecting the Repeat
option in the Set Timing window. With this configuration, the Express VI must be placed within
a loop. With each iteration of the loop, the most recent data set is available.
Tip: The Repeat option can also be selected for Single Point Sampling. This selection creates an
indefinite length of experiment time.
Part 2 Practice Exercise: Plot Data from a Light Sensor
Connect Equipment
1. Set the switch on the Vernier Light Sensor to the 0600 lux range.
2. Connect a Light Sensor to Channel 1 of the interface.
3. Connect the interface to the computer. If you are using a LabQuest with a power button, turn
it on.
Write a LabVIEW program to collect light intensity data
1. Start LabVIEW and open a Blank VI.
2. Place a Waveform Chart (found in the Modern Graph control palette) on the front panel.
3. View the block diagram by choosing Show Block Diagram from the Window menu or use
the <Ctrl-E> (<Command-E> on a Macintosh) shortcut.
4. Click and drag the Analog Express VI (found in the Vernier function palette) to the block
diagram workspace. Note: there may be a pause while initializing the Analog Express VI,
depending on your computer.
Tip: Be sure to choose the Analog Express VI from the function palette that matches your
interface (SensorDAQ or LabQuest).

1 - 4
Engineering Projects with NI LabVIEW and Vernier

5. When the configuration window of the Express VI opens, click the Set Timing button, which
is located in the upper-left corner of the configuration window (see Figure 2).

Figure 2 Analog Express VI configuration window
6. Notice that on the Data Collection configuration window you can set the Sampling Rate and
data collection Length. For now, you can leave Length and Sampling Rate at their default
settings. Note: Do not be concerned if you are using a LabQuest interface and you do not see
the Averaging function. Averaging is not an option for LabQuest, because it is done
automatically in the firmware.

Figure 3 Data Collection configuration window
7. Click Done to close the Data Collection window, and then click OK to close the Analog
Express VI configuration window.
8. Wire the Analog Express VIs CH 1 Auto-ID terminal to the icon for the Waveform Chart.
Getting Started
Engineering Projects with NI LabVIEW and Vernier 1 - 5
9. Drag a While Loop (found in the Programming Structures function palette) around the
Analog Express VI and the Waveform Chart.
10. Wire the stop (F) and stopped terminals on the Analog Express VI as shown in the figure
below.

Figure 4 Sample program for graphing with the Light Sensor
Tip: The stop (F) and stopped terminals should always be wired as shown in the figure
above to ensure that you will not leave your program and the hardware in an ambiguous state by
having the loop terminate before data collection ends. You will certainly receive errors in your
programs if you do not follow this convention.
11. To return to the front panel, choose Show Front Panel from the Window menu or use the
<Ctrl-E> (<Command-E> on a Macintosh) shortcut.
12. Run your program. Point the Light Sensor at various objects in the room and notice how the
chart plot changes with different amounts of reflected light. Try to reproduce a W shape on
the graph, like the one shown below.

Figure 5 Sample graph using the Light Sensor

1 - 6
Engineering Projects with NI LabVIEW and Vernier

Tip: A Waveform Chart has a default X-Axis Maximum of 100 and a Scaling Factor Multiplier
of 1. It is your job as the programmer to modify these values to match your timing. Right-click
the Waveform Chart and select Properties to view the Chart Properties configuration window.
On the Scales tab, set the Multiplier for the Time axis to 0.1 and the X-Axis Maximum to 10.

Figure 6 Chart Properties configuration window


PART 3 CONTROL A DIGITAL DEVICE
The Digital Express VI will collect data from the Vernier Motion Detector, Photogate, and
Rotary Motion Sensor. You can also use this VI to control motors, LEDs, fans, and other simple
electronic components with the Vernier Digital Control Unit (DCU). Unlike the Analog Express
VI, the settings in the configuration window of the Digital Express VI depend upon the hardware
being used. In this tutorial, we will turn on one or more digital lines inside the DCU. For more
information on the other digital applications, refer to the Background Information in each Project
or to Appendix C in the back of this book.
The DCU can control up to six DC electrical devices. There are six red LEDs and one green
LED visible through the transparent top of the DCU. The red LEDs indicate the status of the six
digital output lines (D1, D2, D3, D4, D5, and D6). The green LED should be on when a program
is running and the DCU is properly connected. The DCU is powered by a separate DC power
supply.

Figure 7 Vernier Digital Control Unit
Getting Started
Engineering Projects with NI LabVIEW and Vernier 1 - 7
In the following Practice Exercise, you will turn on one or more of the LEDs inside the DCU.
You do not need to wire anything to the DCU. To turn on an LED, you must send a numeric
output pattern to the DCU with the Digital Express VI. There are 16 different pattern
combinations as shown in the table below. Note that for the first 12 outputs, there is a binary
pattern on lines D1 through D4.
Output Binary D1 D2 D3 D4 D5 D6
0 0000

X X
1 0001
+
X X
2 0010
+
X X
3 0011
+ +
X X
4 0100
+
X X
5 0101
+ +
X X
6 0110
+ +
X X
7 0111
+ + +
X X
8 1000
+ X X
9 1001
+ + X X
10 1010
+ + X X
11 1011
+ + + X X
12 1100
X X X X
13 1101
X X X X +
14 1110
X X X X +
15 1111
X X X X + +
Table 1 Digital output patterns for the DCU
You can think of the DCU as a number of digital switches. Assuming you wire an electrical
device between one of the digital lines and ground, if the switch is in the + position, current will
flow and that device will be on. If the switch is in the or X position, the device will be turned
off. Notice that a pattern of 1 will turn on DCU line D1 and a pattern of 2 will turn on line
D2, but a pattern of 3 will turn on lines D1 and D2 simultaneously. You must send a pattern of
4 to turn on line D3. You can sample all 16 combinations in the configuration window when
you place the Digital Express VI on the block diagram.
Part 3 Practice Exercise: Turn on a DCU Line for 3 Seconds
Connect Equipment
1. Connect a Vernier DCU to DIG 1 on the interface.
2. Connect a power supply to the DCU.
3. Connect the interface to the computer. If you are using a LabQuest with a power button, turn
it on.
Write a LabVIEW program to turn on one or more DCU lines for 3 seconds
1. Start LabVIEW and open a Blank VI.

1 - 8
Engineering Projects with NI LabVIEW and Vernier

2. View the block diagram by choosing Show Block Diagram from the Window menu or use
the keyboard shortcut.
3. Click and drag the Digital Express VI (found in the Vernier function palette) to the block
diagram workspace.
Tip: Be sure to choose the Digital Express VI from the function palette that matches your
interface (SensorDAQ or LabQuest).
4. When the Express VIs configuration window first opens, select DCU Output Lines 16
from the Device Selection panel.

Figure 8 Digital Express VI configuration window
5. Select Lines On for Specified Time as the Configure DCU Timing option and keep the
default value of 3 seconds. Click OK.
6. Right-click the DCU Pattern input terminal of the Digital Express VI and select Create
Control.

Figure 9 Sample program for turning on one or more DCU lines for 3 seconds
7. Return to the front panel by choosing Show Front Panel from the Window menu or use the
keyboard shortcut.
8. Enter a value between 0 to 15 in your DCU Pattern control, and then run your program. One
or more LEDs inside the DCU will light up for 3 seconds and then turn off. Note: Patterns
0 and 12 will turn all lines off.

Getting Started
Engineering Projects with NI LabVIEW and Vernier 1 - 9
PART 4 CREATE A SENSOR-BASED CONTROL SYSTEM
Frequently when building your projects, you will use data from an analog sensor to trigger a
digital device. Sensor-based systems are much more efficient than time-based systems because
the device is not activated until an appropriate target value is reached. In the following exercise,
you will turn on DCU line D1 when the reading from a Light Sensor is greater than 300 lux. This
type of sensor-based system could have many practical applications in a home environment, such
as signaling the start of a new day when the sun rises. The DCU could be used to activate a
wake-up alarm, open the curtains, and/or turn on lights.
Part 4 Practice Exercise: Control a DCU Line with the Light Sensor
Connect Equipment
1. Connect a Vernier Light Sensor to Channel 1 on the interface. Set the switch to the 0600 lux
range.
2. Connect a Vernier DCU to DIG 1 on the interface.
3. Connect a power supply to the DCU.
4. Connect the interface to the computer. If you are using a LabQuest with a power button, turn
it on.
Write a LabVIEW program for the control system
1. Start LabVIEW and open a Blank VI.
2. Place a Waveform Chart (found in the Modern Graph control palette) on the front panel.
3. View the block diagram by choosing Show Block Diagram from the Window menu or using
the <Ctrl-E> (<Command-E> on a Macintosh) shortcut.
4. Click and drag the Digital Express VI (found in the Vernier function palette) to the block
diagram workspace. Be sure to choose the Digital Express VI from the function palette that
matches your interface.
5. When the Express VIs configuration window first opens, select DCU Output Lines 16
from the Device Selection panel. Note that under Configure DCU timing, the option for
Lines Stay On Indefinitely is selected by default. Leave it this way. Click OK.

Figure 10 DCU option for lines to stay on indefinitely

1 - 10
Engineering Projects with NI LabVIEW and Vernier

6. Click and drag the Analog Express VI to the left of the Digital Express VI. Again be sure to
choose the Analog Express VI from the function palette that matches your interface.
7. When the Analog Express VIs configuration window opens, click the Set Timing button.
Keep the default settings for Length and Sampling Rate, select Repeat in order to make the
data collection length indefinite.
8. Click Done to close the Data Collection window, and then click OK to close the
configuration window.
9. Wire the Analog Express VIs CH 1 Auto-ID terminal to the icon for the Waveform Chart.
10. Wire the Error Out terminal on the Analog Express VI to the Error In terminal on the Digital
Express VI.
Tip: LabVIEW is a data flow programming language. The Error Out line is sometimes used to
control the order in which things happen. In this case, data collection with the Analog Express
VI will occur first, followed by DCU control with the Digital Express VI.
11. Drag a While Loop around the Analog and Digital Express VIs and the Waveform Chart.
12. Wire the stop (F) and stopped terminals on the Analog Express VI and Digital Express
VI, as shown in the figure below.

Figure 11 Connecting the Analog Express VI to the Digital Express VI
Tip: Notice that the Digital Express VI is now showing stop (F) and stopped terminals just
like the Analog Express VI. The stop (F)/stopped terminals will appear on the Digital Express
VI whenever the response to an input is immediate. If the stop (F)/stopped terminals are not
visible, it means the current action must complete before the VI can move on to the next action
(as was the case with the 3 second wait in the previous exercise). Make sure you understand the
presence or absence of the stop (F)/stopped terminals when controlling devices with the
Digital Express VI. As a general rule, if the stop (F) and stopped terminals are present, they
should be wired to control the flow of the program.
13. Place a Greater? function (found in the Programming Comparison function palette) to the
right of the Analog Express VI.
Getting Started
Engineering Projects with NI LabVIEW and Vernier 1 - 11
14. Wire the CH 1 Auto-ID terminal on the Analog Express VI to the upper terminal on the
Greater? function.
15. Right-click the lower terminal of the Greater? function and select Create Constant. Enter
300 as the value of the constant.

Figure 12 Creating a comparison for the light intensity
16. Place a Select function (found in the Programming Comparison function palette) to the
right of the Greater? function.
17. Right-click the upper terminal of the Select function and choose Create Constant. Enter 1
as the value of the constant.
18. Right-click the lower terminal of the Select function and choose Create Constant. Enter 0
as the value of the constant.
19. Wire the output terminal of the Greater? function to the middle terminal on the Select
function.
20. Wire the output terminal on the Select function to the DCU Pattern terminal on the Digital
Express VI. The final program is shown below.

Figure 13 Final program for controlling the DCU with the Light Sensor
21. Return to the front panel and run your program.

1 - 12
Engineering Projects with NI LabVIEW and Vernier

22. Shine the Light Sensor out the window or at a bright light source. The LED in the top of the
DCU should turn on when the sensor reading goes above 300. Shine the Light Sensor at a
dark object or cover it with your hand. The LED should turn off as the reading goes below
300. Repeat this process several times.

Figure 14 Sample graph for light intensity with DCU indefinite setting

PART 5 PICK A PROJECT
Now it is time to test your skills. This book describes 12 sensor-based projects that you can build
and program. Each project starts with a set of Design Requirements devoted to a specific
engineering application. After you have successfully mastered the goals set forth in the Project,
you are offered a Challenge to further test your construction and/or programming skills. Some
activities offer an Extreme Challenge involving more complex logic or mathematics. The
activities are loosely ranked in order of increasing difficulty (Project 1 is easier than Project 12).
A table of projects and their corresponding Vernier equipment requirements can be found below.
Getting Started
Engineering Projects with NI LabVIEW and Vernier 1 - 13

Table 2 Vernier Equipment used in Engineering Projects
Topic A
n
a
l
o
g

P
r
o
t
o

B
o
a
r
d

C
o
n
n
e
c
t
o
r

B
l
o
o
d

P
r
e
s
s
u
r
e

B
r
e
a
d
b
o
a
r
d

C
a
b
l
e

D
C
U

D
i
g
i
t
a
l

P
r
o
t
o

B
o
a
r
d

C
o
n
n
e
c
t
o
r

E
K
G

I
n
s
t
r
u
m
e
n
t
a
t
i
o
n

A
m
p
l
i
f
i
e
r

L
i
g
h
t

M
o
t
i
o
n

D
e
t
e
c
t
o
r

P
h
o
t
o
g
a
t
e

P
o
w
e
r

A
m
p
l
i
f
i
e
r



R
o
t
a
r
y

M
o
t
i
o
n

S
u
r
f
a
c
e

T
e
m
p
e
r
a
t
u
r
e

1 Build a Temperature Sensor x x

x
2 Digital Control Systems x

x
3 LED Color Mixer x


4 Hot Wire Anemometer x

x
5 DC Motor Control x S
x

6 Light Intensity & Stepper Motors x x


7 Servo Motors x S
#

8 Analyzing the Heart with EKG # x


9 Blood Pressure x #


10 Strain Gage Measurements L x


11 Propeller-Powered Pendulum S # S
S x

12 PID Ping Pong Ball Levitation S L
# S


x - Used for most of the Project and Challenges
# - Used in some parts of the Projects and Challenges
S - Required if using a SensorDAQ interface
L - Required if using a LabQuest interface

Project
1
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P1 - 1
Build a Temperature Sensor

A sensor is a device that measures a physical quantity and converts it into an electrical signal.
Some sensors measure physical properties directly, while other sensors use conversions or
calculations to determine the value. Sensors are usually categorized by the type of property that
they measure. A good sensor is sensitive to the property under investigation, but should have
limited influence on the property being measured. For example, a temperature sensor should be
small in size and made from a material with good response. Inserting a very large or very cold
thermometer into a hot liquid will cool the liquid somewhat as heat is transferred to the
measuring device. Sensors usually need to be calibrated. Sometimes the calibration relationship
is a simple linear one and other times it is more complex.
Temperature sensors are often built from electronic components called thermistors. A thermistor
is a device whose resistance varies with temperature (the name comes from a combination of the
terms thermal and resistor). Typical thermistors are made from ceramic semiconductors or
from platinum wires wrapped around ceramic spindles. Thermistors usually have a negative
temperature coefficients (NTC), meaning the resistance of the thermistor decreases as the
temperature increases. Depending on the material and fabrication process, the typical operating
range for thermistors is 50C to 150C. The small size of most thermistors results in a rapid
response to temperature changes, which makes them very useful for control systems requiring
quick feedback. Themistors are very rugged and better able to handle mechanical vibration or
thermal shock than other types of temperature sensors. They also have excellent
interchangeability due to their low cost, precision, and tolerance over a temperature range.
Thermistors are used extensively in many applications, including automobile engines, digital
thermostats, rechargeable battery packs, circadian rhythm devices, and fluid-flow measurements.
Using a thermistor to measure temperature is an excellent example of an indirect measurement.
The actual quantity being measured is the voltage across the thermistor. First the voltage is used
to calculate the resistance of the thermistor, and then this resistance is used to determine the
temperature.
Project 1
P1 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT DESIGN REQUIREMENTS
In this Project, you will build and calibrate a temperature sensor. First, you will construct a
voltage divider circuit using a thermistor. Then you will write a LabVIEW program to convert
the raw voltage reading across the thermistor into the resistance of the thermistor. This resistance
will then allow you to calculate the temperature. Your program should simultaneously collect
data from a commercial sensor to verify the readings from your homemade sensor. The
temperature values from your homemade sensor and the commercial sensor, as well as the
thermistor voltage readings, should be displayed on the front panel.

MATERIALS
SensorDAQ or LabQuest interface Vernier Breadboard Cable
LabVIEW thermistor
computer 15 kO resistor
USB cable breadboard
Vernier Surface Temperature Sensor


PROJECT SETUP
Construct a voltage divider circuit
1. Wire the resistor and thermistor to the Breadboard Cable (see Figure 1).

Figure 1 Wiring diagram for temperature sensor
2. Insert the BTA connector on the Breadboard Cable into Channel 1 on the interface.
Connect the commercial sensor to the interface
1. Connect the Surface Temperature Sensor to Channel 2 on the interface.
2. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.

PROJECT BACKGROUND INFORMATION
You can find the temperature of a thermistor if the resistance of the thermistor is known. The
resistance-temperature relationship of a thermistor is nonlinear, but can be approximated using
either the Steinhart-Hart or the |-parameter model. Both models give the absolute temperature of
a thermistor in Kelvin as a function of resistance.
Build a Temperature Sensor
Engineering Projects with NI LabVIEW and Vernier P1 - 3
The resistance of the thermistor (R
T
) can be measured indirectly by placing it in a voltage divider
circuit with a known resistor (R
1
) as shown in the diagram below.

Figure 2 Voltage divider circuit
This is a common circuit design used to measure resistance. The output voltage, V
out
, is related to
V
in
as follows:

|
|
.
|

\
|
+
=
1
R R
R
V V
T
T
in out
where V
in
is the voltage supplied by the interface. In this Project, V
in
, comes from the pin labeled
+5V on the breadboard connector. To start with, use the typical value for your interface
(SensorDAQ=5.08 volts, LabQuest and LabQuest 2=5.31 volts, and LabQuest Mini=5.29 volts).
V
out
is the measured voltage from your homemade sensor, and R
1
is the value of the resistor
placed in series with the thermistor (R
T
).
From the equation above, you can algebraically solve for the thermistor resistance.

|
|
.
|

\
|

=
out in
out
T
V V
R V
R
1

This equation can be simplified because the circuit resistance is known (R
1
= 15,000 O). Since
your resistor may have a slightly different value, for best accuracy you should measure it with an
ohmmeter. In the following, we used 15,000 ohms when discussing this resistor. You should use
the value you calculated based on your materials. The thermistor resistance, R
T
then becomes
out in
out
T
V V
V
R

=
15000

You can measure the voltage supplied by the interface (V
in
) using a digital multimeter or a
Vernier Voltage Probe. (This voltage should be somewhat over 5 volts and depends on the
interface.) Take your time with this measurement as it has a strong influence on your calculated
resistance.
In your LabVIEW program, the Vernier Analog Express VI will be used to read your homemade
sensor and the commercial sensor. You will need to configure the Vernier Analog Express VI to
read the raw voltage (V
out
) directly from your homemade sensor. When the Analog Express VI is
placed on the block diagram, a configuration window appears. The commercial sensor connected
to Channel 2 is automatically identified; however, since you are building a custom sensor in
Channel 1, you will need to manually configure this channel. Under Configured Channels, select
the Manual option and then click the Add Channel button at the top of the window. Choose 0 to
5 V under CHANNEL 1 in the Activate Channel window.
Project 1
P1 - 4
Engineering Projects with NI LabVIEW and Vernier

Note: Do not change the values for the K
0
, K
1
, and K
2
coefficients in the configuration window
of the Analog Express VI.

Figure 3 Configuration window for manual setup of a custom sensor
The Analog Express VI can be used in your program to measure the raw voltage of your
homemade sensor after it has been configured and the configuration window has been closed.
After reading the raw voltage, you can solve for the resistance of the thermistor using the
equation for R
T
above.
The next step is to use the resistance of the thermistor to calculate the temperature. There are two
different equations that can be used. If you know the Steinhart-Hart coefficients, K
0
, K
1
and K
2
,
for your thermistor use that method. If not, use the simpler |-parameter method.
Both equations calculate temperatures in Kelvin. To convert your final answer to display the
temperature in Celcius you must subtract 273.15. Celsius units are more common and will allow
for an easier comparison to the commercial sensor.

Steinhart-Hart Model
The Steinhart-Hart equation is a third order polynomial that provides a good approximation for
temperature measurements within a limited range (about -80C to 130C)

( ) ( )
3
ln
2
ln
1 0
1
T
R K
T
R K K
T
+ +
=

where T is the temperature in Kelvin and R
T
is the resistance of your thermistor. K
0
, K
1
, and K
2

are known as the Steinhart-Hart coefficients and can often be found from documentation that
came with your thermistor.
Build a Temperature Sensor
Engineering Projects with NI LabVIEW and Vernier P1 - 5
Write LabVIEW code to do this math and convert the resistance of your thermistor to a
temperature reading. We recommend using the Formula Express VI. Finally, add code to change
the Kelvin temperature to Celcius degrees.

|-parameter Model
The |-parameter equation is an alternative equation sometimes used in calibrating thermistors.

1
0 0
ln
1 1

(
(

|
|
.
|

\
|
+ =
R
R
B T
T
T

In this equation, R
T
is the resistance of your thermistor, R
o
is the resistance of thermistor at
Kelvin temperature T
0.
R
o
and T
0
are provided by the thermistor manufacturer. Note that all
temperatures used in this equation are in Kelvin.
Write LabVIEW code to do this math and convert the resistance of your thermistor to a
temperature reading. We recommend using the Formula Express VI. Finally, add code to change
the Kelvin temperature to Celcius degrees.


PROJECT TIPS
1. After you have taken the raw voltage readings from your sensor with the Vernier Analog
Express VI, convert these readings to temperature in two steps using an instance of the
Formula Express VI for each step. First, calculate the resistance, and then pass that result into
the next instance that calculates the temperature, based on the particular model you are using
(Steinhart Hart or parameter).
2. The Steinhart coefficients (K
0
, K
1
and K
2
) or the Beta Equation coefficients for your
thermistor can be found from your manufacturers published data. For one thermistor we
recommend, the Steinhart-Hart coefficients coefficients are: K
0
= 0.00102119, K
1
=
0.000222468, and K
2
= 1.33342E-7. For another thermistor we use, the B or parameter is
4089 and R
0
is 25,000 ohms when T
0
is 298 K (25 degrees C).
3. A good data-collection rate for the Surface Temperature Sensor is 10 samples per second.
4. The Analog Express VI collects data for a fixed amount of time. For an indefinite data
collection length, check the Repeat option in the Analog Express VIs Set Timing
configuration window.
5. We recommend using the Vernier Surface Temperature Sensor for this Project; the Vernier
Stainless Steel Temperature Probe will also work. Be aware that its response will be much
slower due to the stainless steel casing on the probe. The steel acts as a heat sink, causing the
sensor to gain and lose heat more slowly. After a short period of time, however, the Vernier
Stainless Steel Temperature Probe should read approximately the same temperature as your
homemade sensor.
6. Refer to Appendix C for additional information on programming the Analog Express VI.
7. Refer to Appendix E for additional information about the Vernier Surface Temperature
Sensor and Breadboard Cable.

Project 1
P1 - 6
Engineering Projects with NI LabVIEW and Vernier

PROJECT TROUBLESHOOTING
If the thermistor value does not match the temperature reading of the commercial temperature
sensor in Channel 2, consider the following options.
a. Measure the voltage supplied by the interface (V
in
). You can measure the voltage using a
digital multimeter or a Vernier Differential Voltage Probe. Substitute the actual voltage
into your equation and see if that improves the calibration.
b. Make sure the calculations in the program are correct. Run these calculations as a stand-
alone VI with some test values for the Raw Voltage. For the thermistor we recommend, a
Raw Voltage of 3.3 should give a Temperature Out value around 0C; a voltage of 1.7
should give a temperature around 30C; and a voltage of 0.2 should give a temperature
around 100C. Different thermistors will have different test values.
c. Measure the resistance (R
1
). You can measure the resistance using a digital multimeter.
Substitute the actual values into your equation and see if it improves your calibration.
d. Check the Steinhart coefficients (K
0
, K
1
and K
2
) or the the formula parameter for your
thermistor against your manufacturers published data.
e. You may find it useful to create controls in your VI that let you adjust the values of
coefficients used in your resistance to temperature conversion. This will allow you to
adjust your thermistors readings to better match your commercial sensor. Fairly fine
adjustments will be required so you will need to adjust the properties of your controls to
accept a smaller Data Increment than the default.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Write a LabVIEW subVI to give the user the ability to display temperature values in Kelvin, or
in degrees Celsius or degrees Fahrenheit. Modify your original Project program to change the
units simultaneously on both your homemade sensor and on the Vernier Surface Temperature
Sensor. The user should be able to switch between units while the program is running.

CHALLENGE BACKGROUND INFORMATION
One way to make a subVI is to convert an existing section of code. Add the equations for unit
conversions to your original Project program. To convert Celsius temperature units to Kelvin,
add 273.15. To convert Celsius degrees to Fahrenheit degrees, use the following equation.
T
Fahrenheit
= 1.8T
Celsius
+ 32
Use the Positioning tool to select the section of the block diagram you want to turn into a subVI,
and then choose Create SubVI from the Edit menu. The selected code is automatically turned
into a functional subVI that can be saved and reused.
Project
1
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P1 - 1T
TEACHER INFORMATION
Build a Temperature Sensor
Encourage your students to work towards creating a simple concise program for the Project
Design Requirements before attempting the Challenge. The front panel should provide the user
with clear indicators for temperatures from both the homemade and the commercial sensors. In
the Challenge, the user should be able to quickly switch back and forth between Celsius,
Fahrenheit, or Kelvin units.
Using a thermistor to measure temperature is an excellent example of an indirect measurement.
The actual quantity being measured is the voltage across the thermistor. First this voltage is used
to calculate the resistance of the thermistor, and then this resistance is used to determine the
temperature.

BACKGROUND
You can find the temperature of a thermistor if the resistance of the thermistor is known. The
resistance-temperature relationship of a thermistor is nonlinear, but can be approximated using
either the Steinhart-Hart or the |-parameter model. Both models give the absolute temperature of
a thermistor in Kelvin as a function of resistance. Sometimes the Steinhart Hart coefficients are
available from the manufacturer and sometimes the |parameter specifications are provided.
Details of both models and how they should be treated may be found in the student section of
this chapter.

PROJECT CONSTRUCTION TIPS
In this Project, the students will be constructing a simple circuit. Precision resistors with
tolerances of 1% or less are recommended, because they will yield better calibrations. The
thermistor we used had a resistance of about 20 k at room temperature.
Before assigning this Project to students, you should decide whether the electronic components
will be treated as consumables or non-consumables. In our prototype shown below, we used a
breadboard to construct our homemade temperature sensor so that the parts (especially the
thermistor) could be reused. The Vernier Breadboard Cable simplifies the construction process
by creating a direct link between the breadboard and an analog port on the interface. The power,
signal, and ground lines are clearly marked on the cable. For a more permanent device, you can
wire the thermistor and resistor directly to the end of the cable.
Project 1 Teacher Information
P1 - 2T
Engineering Projects with NI LabVIEW and Vernier


Figure 1 Close-up of thermistor circuit using a
Vernier Breadboard Cable and breadboard
Choosing a thermistor can be overwhelming because there are so many choices. Mouser
Electronics sells an inexpensive 20 kO NTC thermistor with a temperature range of -40C to
+125C (catalog #81-NTSA0WB203EE1B0). The data sheet for this thermistor can be found
online at http://www.murata.com/products/catalog/pdf/r44e.pdf

PROJECT PROGRAMMING TIPS
As is the case with all of the Projects and Challenges in this book, examples of working VIs are
included on the CD that accompanies this book. It would be beneficial to open the VI as you go
through this section to compare and contrast with what follows.
There are a number of ways the Project can be tackled. One suggestion is to divide the Project
into a number of steps.
Part I Read raw voltage
First, build a program to read the raw voltage from your homemade sensor. This same code can
also be used to read temperature values from the Vernier SurfaceTemperature Sensor. This is
most easily done using the Analog Express VI (found on the Vernier functions palette). Since
students will be designing a custom sensor, they will need to manually setup the Express VI.
When the Analog Express VIs configuration window is opened, select Manual as the
Configured Channels option. Then click Add Channel.
Build a Temperature Sensor
Engineering Projects with NI LabVIEW and Vernier P1 - 3T

Figure 2 Add Channel button for manually configuring a channel
Check that the Vernier Breadboard Cable is connected to Channel 1 on the interface, and then
select 0 to 5 V under CHANNEL 1 in the Activate Channel window. Notice that if you have the
Vernier Surface Temperature Sensor connected to Channel 2, it will be automatically identified
by the interface.

Figure 3 Activate Channel configuration window
When you click OK, you are automatically returned to the Analog Express VIs configuration
window. In the upper-left corner, default values for Sampling Rate and Length of Experiment are
shown. These values can be modified if desired by clicking the Set Timing button.
Project 1 Teacher Information
P1 - 4T
Engineering Projects with NI LabVIEW and Vernier


Figure 4 Analog Express VI configuration window
When you click the Set Timing button, a Data Collection configuration window appears. In our
sample program, we wanted the temperature data to have an infinite experiment length.
Checking the Repeat option specifies data collection to continue beyond the 10 second length
and will not end until the user presses the Stop button. Note: The Averaging function should
remain checked if you are using the SensorDAQ interface. Averaging is not an option with the
LabQuest interface, because it is done automatically in the interface firmware.

Figure 5 Data Collection configuration window
Students are asked in the Design Requirements to display raw voltage readings from the
thermistor on the front panel. We used a Waveform Chart in our sample program because the
data can be displayed in real time as it is collected. Remind students that when using an NTC
thermistor (negative temperature coefficients), the voltage readings should go down as the
thermistor warms up.
Build a Temperature Sensor
Engineering Projects with NI LabVIEW and Vernier P1 - 5T
Part II Use the raw voltage to determine thermistor resistance
Modify the LabVIEW program to determine the resistance of the thermistor from the raw
voltage readings. There are many ways to build equations in a LabVIEW program. One way is to
use the individual mathematical operators from the Numeric functions palette. In the example
shown below, the calculations use mathematical operators from the Numeric functions palette to
convert the raw voltage reading (V
out
) to the thermistor resistance (R
T
):
out in
out
T
V V
V
R

=
15000


Figure 6 Building the equation for thermistor resistance with numeric functions
Another way to build equations in LabVIEW is to use a Formula Express VI. An example of
using the Formula Express VI is shown in the next part.
For V
in
, students can use the typical values listed for the interface (for SensorDAQ, 5.08 volts,
for LabQuest and LabQuest 2, 5.31 volts, and for LabQuest Mini, 5.29 volts). Another option,
which is mentioned in the Troubleshooting section, is that they can measure this voltage at the
terminal labeled +5V on the breadboard connector. To measure this value they can either use
an inexpensive multimeter, set for voltage measurements, or a Vernier Differential Voltage
Probe (DVP-BTA) connected to the interface being used. Note that using the simple Vernier
Voltage Probe (VP-BTA) is not recommended for this measurement because its black lead is
already connected to the ground of the interface.
Part III Calculate the temperature from the thermistor resistance
Next, add code to convert the thermistor resistance to temperature using either the Steinhart-Hart
equation or the |-parameter equation.
Steinhart-Hart Calculation
If you know the Steinhart-Hart coefficients for your thermistor, the calculation of temperature
from the thermistor resistance is given by
( ) ( )
15 273
3
ln
2
ln
1 0
1
.
T
R K
T
R K K
T
+ +
=

This calculation can be done using using individual mathematical operators from the Numeric
functions palette. There are positive and negative aspects (ease of reading the code, speed of
creating code, etc.) as well as personal preferences that factor into which method is chosen; but
Project 1 Teacher Information
P1 - 6T
Engineering Projects with NI LabVIEW and Vernier

the Formula Express VI is the preferred method when using sophisticated mathematical
operations, like natural log and trigonometric functions. The Formula Express VI is found in the
Express Arithmetic & Comparison palette. When the Formula Express VI is placed on the
block diagram, a configuration window appears. Variable names, such as K0, K1, K2, and
RT, are entered into the Formulas Label controls. You build the actual formula by pressing
the calculator buttons and by pressing the X1, X2, X3, and X4 buttons to insert K0, K1, K2, and
RT into the formula. Note that LabVIEW uses ** to indicate raising to a power. Click OK
when you have finished entering the formula to close the configuration window.

Figure 7 Formula Express VI configuration window

The |-parameter equation
If you know the |-parameter coefficients of your thermistor, or if you do not have any
calibration information on your thermistor, use the |-parameter equation for converting
thermistor resistance to temperature.
If you know |-parameter coefficients of your thermistor, use the equation below to do the
conversion

1
0 0
ln
1 1

(
(

|
|
.
|

\
|
+ =
R
R
B T
T
T

R
0
is the specified resistance of the thermistor at a known temperature, T
0
. For most thermistors
we recommend for this project, the values are 20,000 ohms and 298.15 K (25 C). This
calculation is best done using the Formula Express VI.
If you do not have the |-parameter coefficients (|, R
0
, and T
0
), you can have your students
determine them by measuring the thermistor of resistance for a known temperature. For example,
they could put the thermistor in ice water or room temperature water, and then use the code they
have created to read the thermistor resistance. They can then use the resistance and temperature
measurements they make as R
0
and T
0
. The -parameter or B can be found experimentally by
Build a Temperature Sensor
Engineering Projects with NI LabVIEW and Vernier P1 - 7T
measuring the resistance at several temperatures and plotting ln (R) vs 1/T and performing a
linear fit. is then the slope of the resulting line.
Putting it all together
Here is one complete program. In this case, we used a Formula Express VI for the thermistor
resistance, as well as the Steinhart-Hart temperature equation. We also added a History property
node at the beginning of the program to clear the Waveform Chart each time we run the program.
You can create this property node by right-clicking on the Waveform Chart and selecting Create
Property Node History Data. Since the default configuration for the History Data Property
Node is a Read output terminal, you must right-click on the property node after you place it on
the block diagram and select Change All To Write. Right-click on the property node a second
time and create a constant to send an empty array as the input (effectively erasing any previous
data). The History property node should be placed outside the While Loop.

Figure 8 Sample program to convert thermistor voltage to temperature

CHALLENGE CONSTRUCTION TIPS
The Challenge does not require any additional materials. Instead, students will focus on building
a subVI to enhance the user interface.

CHALLENGE PROGRAMMING TIPS
Allow the user to select the temperature unit
The Challenge design requirements require that students build a subVI. If they are not familiar
with the process of setting up a subVI, you may want to go over that with them, or refer them to
Chapter 7 of our book, Hands-On Introduction to NI LabVIEW with Vernier.
It is always a good practice when programming in LabVIEW to encourage your students to
consider the user friendliness of the front panel. Allowing the user to switch between units is a
desirable feature to have when using a temperature sensor. Another consideration is the
readability of your program. Since you will need to make unit conversions twice for both your
homemade sensor and the commercial sensor, it is more efficient to store this code in a subVI.
Project 1 Teacher Information
P1 - 8T
Engineering Projects with NI LabVIEW and Vernier

One way to make a subVI is to highlight a section of existing code and then choose Create
SubVI from the Edit menu. Another way is to build a subVI from a new Blank VI. We will
describe the latter option in this section.
After opening a new Blank VI, the first step is to build the code for unit conversions. The
Challenge asks you to display temperature units in three ways: Kelvin, degrees Celsius, or
degrees Fahrenheit. One suggestion for housing the different equations for unit conversions is to
use a Case Structure and an Enum control. An Enum, or enumerated type control, contains a list
of strings through which you can cycle (in this exercise, Kelvin, Celsius, and Fahrenheit).
When you wire an Enum to the selector terminal of a Case Structure, LabVIEW matches the
cases to the strings in the control.

Figure 9 Case Structure to convert temperature units
When you place an Enum control (found in Controls Modern Ring & Enum) on the front
panel, you must right-click it and select Edit Items to enter the three temperature choices. Storing
Celsius at the top of the list (Digital Display 0) ensures that it will be the default unit. When
you wire the Enum control to the Case Structure on the block diagram, only two cases will be
displayed. Right-click the Selector Label and choose Add Case for Every Value.

Figure 10 Enum configuration window
To convert a VI into a subVI, you should first design a custom icon. From the front panel, right-
click on the icon in the upper-right corner and choose Edit Icon. The icon design does not need
to be complicated (the words Temp Units are sufficient).
Build a Temperature Sensor
Engineering Projects with NI LabVIEW and Vernier P1 - 9T

Figure 11 Custom icon for unit conversion subVI
Next you must build the connector pane. Right-click the icon in the upper-right corner again and
choose Show Connector. When you bring up the connector pane, a three-connector pattern
similar to the one shown below should be selected. Each square or rectangle in the connector
pane represents an input or output terminal in your subVI. Click the upper-left terminal in the
connector pane (upper-left square) and then bring your mouse to the front panel and click the
Temperature In control to connect the terminal to the control. (The upper-left terminal will
change color to match the data type of the control.) In a similar manner, connect the lower-left
terminal to the Units control and the right terminal to the Temperature Out indicator. Once this
process is finished, the VI can be saved and used as a subVI.

Figure 12 Temperature sensor front panel display
To insert a subVI into the block diagram, click Select a VI from the functions palette. A dialog
box will appear allowing you to browse to your subVI. Place it on the block diagram and then
wire the input/output terminals like any other LabVIEW function (see figure below). Since the
Enum control was already created in the subVI, simply right-click on the Units terminal and
select Create Control to place it on the block diagram. If you save any future changes to your
subVI, they will automatically be reflected in your top-level program.
Project 1 Teacher Information
P1 - 10T
Engineering Projects with NI LabVIEW and Vernier


Figure 13 Sample program for converting temperature units

TROUBLESHOOTING
SensorDAQ
If you are using the SensorDAQ to do this Project, you may notice that the temperature readings
are slightly off (too low) when you are working with temperatures near 0C or lower. The
Steinhart-Hart equation breaks down slightly at voltages above 3.3 volts due to the low input
impedance of the SensorDAQ analog-to-digital converter. To do a good calibration at these
temperatures, you need to study the raw voltage and design a secondary equation.

EXTENSIONS
1. Modify your VI to display the data in a table. The data should only be sent to the table if the
user presses a button. To do this you can add an Express Table (found in the Express Text
Indicators controls palette) to the front panel. In the block diagram use a Merge Signals
function (found in Express Signal Manipulation) to merge the homemade temperature,
verification temperature, and voltage data. The Merge Signals function converts the data into
a proper data type for the Build Table Express function. Use a Boolean control to input a
True or False into the Enable input of the Build Table Express function.
2. Use your homemade temperature sensor to build a sensor-based control system. Place
colored Boolean indicators on the front panel to reflect different temperature readings (such
as a blue indicator for cold, a green indicator for normal, and a red indicator for hot).
3. Modify your program to save the temperature data in a text file which can be opened into a
spreadsheet or word processor.
Project
2
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P2 - 1
Digital Control Systems

A digital control system provides real-time control of a dynamic system. Smart systems
usually incorporate one or more sensors to provide feedback on the current state of the system
and direction for the next action. One situation that lends itself well to a digital control system is
indoor air temperature. Air temperature can be controlled either actively or passively through
heating, ventilation, and air conditioning (HVAC) methods. Greenhouses, food production
chambers, libraries, and others all require a climate-controlled environment to ensure comfort,
safety, and performance. Good HVAC systems provide thermal comfort, acceptable air quality,
and reasonable operating and maintenance costs. Simple on-off control systems are an
inexpensive option, but they tend to shorten the life of the equipment due to excessive activation
of control valves when only a single set point is used. A more practical, long-term alternative is
to provide a small amount of hysteresis, or a deadband region, around the set point in which no
change to the current action occurs. The width of this deadband can be adjusted to save wear and
tear on parts without compromising the overall integrity of the system.
The photo above shows a version of the Challenge for this chapter.

PROJECT DESIGN REQUIREMENTS
Write a LabVIEW program that monitors a Vernier Surface Temperature Sensor and activates
line D1 of a Vernier Digital Control Unit (DCU) when the sensor reading exceeds a user-defined
temperature limit. Your program should display the temperature reading in a digital display, with
appropriate units, on the front panel.

MATERIALS
SensorDAQ or LabQuest interface Vernier Surface Temperature Sensor
LabVIEW Vernier Digital Control Unit (DCU)
computer LabQuest or LabPro power supply
USB cable
Project 2
P2 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT SETUP
Connect the DCU and sensor to the interface
1. Connect the DCU to the DIG port of the interface.
2. Connect a power supply to the DCU.
3. Connect the Surface Temperature Sensor to Channel 1 on the interface.
4. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
Tip: You will not be using the DCU 9-pin cable in this Project because you will not be
connecting any electronic devices to the DCU. You can tell which lines are on or off by looking
at the red LEDs in the top of the DCU.

PROJECT BACKGROUND INFORMATION
In this Project, you will be using the DCU as a threshold indicator for a Surface Temperature
Sensor. The DCU is an electronic device that can be used to manage a digital control system for
on/off control of DC electrical components. The top of the DCU is transparent with one green
and six red LEDs visible inside the unit. The green LED illuminates when the DCU is properly
connected and running a DCU program. Learn to check the green LED, as it can warn you if
things are not set up correctly, and it will keep you from wasting time when they are not. The red
LEDs indicate the status of the six output lines of the DCU (D1D6). The DCU connects to the
DIG port on the interface and is powered by a separate DC power supply.
The Digital Express VI found in the Vernier functions palette can be used to control the DCU. In
order to activate the DCU, you must send an output pattern to this Express VI indicating which
line(s) are to be turned on. When you place the Digital Express VI on the block diagram, a
configuration window appears. If you select Output Lines 16 as the Device Selection you will
see a picture of the DCU. Change values from 0 to 15 in the DCU Pattern control for feedback
on what lines are activated. As shown in the diagram below, a pattern of 1 will turn on DCU
line D1.

Figure 1 Digital Express VI configuration window for the DCU
Digital Control Systems
Engineering Projects with NI LabVIEW and Vernier P2 - 3
PROJECT PROGRAMMING TIPS
1. Avoid using the Abort Execution button to stop your VI because some of the DCU lines may
remain on.
2. A good data-collection rate for the Surface Temperature Sensor is 10 samples/second.
3. The Analog Express VI collects data for a fixed amount of time. For an indefinite data
collection length, check the Repeat option in the Analog Express VIs Set Timing
configuration window.
4. Both the stop (F) and stopped terminals on the Vernier Analog and Digital Express VIs
must be wired in order for the program to execute properly. The sequence should be to stop
the Analog Express VI, use the stopped output from the Analog Express VI to stop the
Digital Express VI, and use the stopped output from the Digital Express VI to stop the
loop.
5. You can make your program much more flexible and user-friendly by using a front panel
control for the DCU output pattern. This allows you to experiment with different values for
the output pattern and observe which lines are being turned on or off.
6. The Select function is a great way to choose one of two possible values.
7. Refer to Appendix C for additional information on programming the DCU, and the Digital
and Analog Express VIs.
8. Refer to Appendix E for additional information on the Vernier Surface Temperature Sensor
and DCU.

PROJECT TROUBLESHOOTING
1. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on.
2. Make sure you are sending the proper output pattern to turn on the desired DCU line. When
the Digital Express VI is placed on the block diagram, a configuration window appears.
When Output Lines 16 is selected from the Device Selection tree control, an interactive
picture of the DCU appears. Select your desired output pattern and the picture of the DCU
will change. An output pattern of 3 (shown below) indicates that digital lines D1 and D2 are
on simultaneously. Clicking the Run button in the upper-left corner of the window will
activate these lines on the DCU if the DCU is connected to the interface.
Project 2
P2 - 4
Engineering Projects with NI LabVIEW and Vernier




CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Write a LabVIEW program to operate as a thermostat for a temperature-controlled system. Your
thermostat should maintain the temperature of the system by activating a heating or cooling
device. For this Challenge, you will build a small enclosure that uses a miniature light bulb as a
heat source and a small DC fan as a cooling source. You should provide two digital controls on
the front panel to allow the user to define a high and a low temperature threshold. The fan should
turn on if the temperature is above the high threshold, and the light bulb should turn on if the
temperature is below the low threshold. Use a Vernier Surface Temperature Sensor and DCU to
control the bulb and fan.

ADDITIONAL MATERIALS
small light bulb and bulb socket small container for housing
small fan


CHALLENGE SETUP
Build the temperature-controlled apparatus
1. Build a small structure to house the fan, light bulb, and Vernier Surface Temperature Sensor.
The tip of the sensor should be positioned close to the light bulb because it probably will not
provide much heat. Cut a few small holes or vents in your structure for air circulation.
2. Plug the 9-pin cable into the socket on the side of the DCU.
Digital Control Systems
Engineering Projects with NI LabVIEW and Vernier P2 - 5
3. Wire the fan and light bulb to the DCU cable as shown in the diagram below.
Tip: The light bulb does not have polarity, so you can connect the leads in any order.

Figure 2 Wiring diagram for the fan and light bulb to the DCU cable


CHALLENGE BACKGROUND INFORMATION
In the Challenge, you will be using the DCU to control a light bulb and a fan. Always keep the
power limitations of the DCU in mind. You should not exceed 1000 mA total.
A 9-pin D-sub socket cable is supplied with the DCU, with bare wires on one end, for use in
building projects. There are connections for all six digital lines, plus a power connection and two
ground connections. The color code of the wires is identified on a label attached to the cable.
You will need to send several different output patterns to the Digital Express VI to run these
components. A pattern of 1 will turn on DCU line D1 and a pattern of 2 will turn on line D2.
Be aware that you must send a pattern of 3 to turn on both lines simultaneously.

CHALLENGE TROUBLESHOOTING
1. Double-check the DCU cable connections against the color-coded label attached to the cable.
2. Make sure you are sending the proper output pattern to turn on one or more digital lines. Use
the Digital Express VI configuration window to test your pattern and hardware.
3. If your temperature-controlled system does not appear to be heating properly, consider
changing to a better heater or adding a second heater. You may need to use a different power
supply.
Project
2
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P2 - 1T
TEACHER INFORMATION
Digital Control Systems
PROJECT CONSTRUCTION TIPS
The Project involves connecting the Vernier Surface Temperature Sensor and DCU to analog
and digital channels, respectively, on the interface. Students will not be using the 9-pin cable
with the DCU because they can tell which lines are on or off by looking at the red LEDs through
the transparent top. However, if you wish to give your students some practical, hands-on
experience, you can have them wire an LED and resistor in series with digital line D1 and
ground. Remind your students that LEDs have polarity. The short wire or the flat side of the
LED should be connected to GND.

Figure 1 Wiring diagram for connecting an LED to DCU line D1
When you first connect the DCU to the interface you may notice an LED or LEDs that are lit.
This depends on the interface, the model of your DCU, whether you have power connected, and
the current state of the digital channel. Running your VI or opening the configuration window of
the Digital Express VI will reinitialize all DCU lines to the off position.

PROJECT PROGRAMMING TIPS
Encourage your students to develop and test a good working program for the Project Design
Requirements in order to investigate the way a sensor can be used to control a digital line on the
DCU before attempting the Challenge. It is not necessary for the front panel to contain anything
more than a control for the temperature threshold and an indicator for the sensor value because
the student can tell the status of the DCU lines by looking at the red LEDs in the top of the DCU
case. However, it would not require much additional programming to place Boolean indicators
on the front panel to reflect the status of the DCU lines.
There are a number of ways the Project can be tackled. One suggestion is to divide the Project
Design Requirements into two parts. First, write a LabVIEW program to turn on a DCU line.
Writing this portion of the program allows you to check that your DCU is setup and working
properly first. Next, modify the program to read data from the Vernier Surface Temperature
Sensor. The sensor value should be displayed on the front panel, and then used in a comparison
to determine if the digital line should be turned on or off.
Part I Turn on a DCU line
The Digital Express VI found in the Vernier functions palette can be used to control the digital
lines of the DCU. When the Digital Express VI is placed on the block diagram, a configuration
window appears. When Output Lines 16 is selected from the Device Selection tree control, an
interactive picture of the DCU appears. Students can sample the 16 different output patterns to
see which combination of digital lines will be active for any given number. An output pattern
Project 2 Teacher Information
P2 - 2T
Engineering Projects with NI LabVIEW and Vernier

of 3 (shown below) indicates that digital lines D1 and D2 are on simultaneously. Clicking the
Run button in the upper-left corner of the window will activate these lines on the DCU if the
DCU is connected to the interface.

Figure 2 Digital Express VI configuration window for the DCU
In the example program shown below, a constant was used for the DCU Pattern input indicating
that digital line D1 will be active when the program is run. Substituting a front panel control for
the constant would make this program much more flexible because it would give the user the
opportunity to experiment with different values for the output pattern and observe which lines
are being turned on or off. No actual devices need to be wired to the DCU to run this program
because you can see which lines are active by checking the six LEDs visible through the clear
plastic top of the DCU. Be aware that the stop (F) terminal of the Digital Express VI should be
wired as shown below to ensure that all DCU lines are turned off before program execution ends.

Figure 3 Sample program turning on DCU line D1
Part II Control a DCU line with sensor data
One way to modifying the program so that the DCU can be controlled by a sensor is to add an
Analog Express VI, a comparison, and a Select function to the block diagram as shown below.
Wiring the Error In/Out and stop (F)/stopped terminals between the Express VIs ensures
proper data flow of the program and also ensures that the Express VIs will be stopped prior to
terminating the program.
Digital Control Systems
Engineering Projects with NI LabVIEW and Vernier P2 - 3T

Figure 4 Sample program for a temperature-controlled system
The Analog Express VI normally collects data for a fixed amount of time; however, a
temperature monitoring system usually runs continuously. When configuring the Analog Express
VIs Set Timing options, select the Repeat option to allow data collection to keep going until the
user clicks the Stop button. Note: The Averaging function should remain checked if you are
using the SensorDAQ interface. Averaging is not an option with a LabQuest interface, because it
is done automatically in the interface firmware.

Figure 5 Data Collection configuration window
Project 2 Teacher Information
P2 - 4T
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE CONSTRUCTION TIPS
One of the biggest challenges when designing your temperature control device is finding a light
bulb to serve as an acceptable heat source. We recommend using a 1/2 watt bulb or wiring two
light bulbs in a parallel circuit. You might be able to find 6 V light bulbs at Radio Shack

or auto
supply stores that specialize in older model cars.
Smaller containers work better for minimizing heat transfer. We used a clear plastic box for our
container so that the fan and light bulb would be visible. We punched a few small holes near the
top and bottom to provide air circulation. A 6 V power supply was not able to power our
apparatus, so we substituted a 9 V power supply that we purchased at a hobby store.

Figure 6 Close-up of temperature control system

Figure 7 Photos of other temperature control systems students have built

Digital Control Systems
Engineering Projects with NI LabVIEW and Vernier P2 - 5T
CHALLENGE PROGRAMMING TIPS
Monitor a temperature-controlled environment
One suggestion for tackling the Challenge is to add an additional Select function to reflect a
second temperature threshold. The example program shown below assumes a fan (cooling
source) is connected to line D1 and a light bulb (heat source) is connected to line D2.

Figure 8 Sample program for a temperature control system
The fan will turn on if the temperature is above the Hi setpoint (a pattern of 1 is sent to the
DCU). The light bulb will turn on if the temperature is below the Lo setpoint (a pattern of 2 is
sent to the DCU). If the temperature is between the two threshold values, nothing is turned on (a
pattern of 0 is sent to the DCU).

EXTENSIONS
1. Write a LabVIEW program to allow the user to turn on any combination of the six DCU lines
(D1D6) from a front panel control. Refer to Appendix E or the configuration window of the
Digital Express VI to see the 16 possible output patterns required to activate each
combination. For additional challenge, create a graphical representation on your front panel
using Round LEDs (found in the Modern Boolean controls palette) that looks like the top
of the DCU. When an LED lights up in the top of your DCU, the corresponding virtual LED
should light up on the front panel of your VI.
2. You will probably notice that the system you built to control the temperature involves the
heater (light bulb) going on and off frequently. If this were a real heating system, it would
not last very long. A real world heating system has to keep the temperature within an
acceptable range without having the heater go on and off too often. Modify your temperature
control system to allow for a small amount of hysteresis, or a deadband region, around the set
point in which no change to the current action occurs.
Project 2 Teacher Information
P2 - 6T
Engineering Projects with NI LabVIEW and Vernier

3. Design a control system for an exhaust fan. The operator should have the ability to run the
fan in both the forward and reverse directions. You will need a small, non-polarized DC fan
or a small DC motor with a propeller blade attached to the motor shaft for this exercise. You
can change the fan direction by wiring the fan to the DCU as shown in the diagram below.

Figure 9 Wiring diagram for DC fan turning in two directions
4. A traffic light uses a series of three lights to control the flow of vehicles through an
intersection. When the green light is on, traffic should flow. When the red light is on, traffic
should stop. The yellow light represents a wait period for all vehicles to clear the
intersection. Only one light is on at a time, but the duration of illumination is determined in a
preprogrammed sequence. In a basic open-loop control system, the traffic light timing
sequence would continuously repeat. However some intersections, especially those where
traffic on the side street is significantly lighter than on the main street, contain sensors to
detect the presence of a vehicle before initiating the timing sequence. In this extension, try
wiring three LEDs to lines D1, D2, and D3 on the DCU to make a traffic light. Then write a
LabVIEW program to make the LEDs go through the standard traffic light pattern: green
yellow red. Your green light should stay on until a signal from a Vernier analog sensor
(connected to Channel 1 on the interface) detects the presence of a vehicle. In real life, the
traffic light will not immediately turn yellow the instant a vehicle triggers the sensor, but will
remain green for a few seconds before initiating the timing sequence. Vary the duration each
LED is on to resemble a real traffic light.

Project
3
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P3 - 1
LED Color Mixer

LEDs (Light Emitting Diodes) are long-lasting light sources made from a special semiconductor
material that converts electrical current directly into light. Unlike incandescent lamps that emit
broad-spectrum white light (all the colors of the rainbow), LEDs emit a small wavelength range
that appear as a single color.
In the human eye, the receptors that interpret hues of color are called cones. Cones can be
classified into three basic types based on their responsiveness to long, medium, and short
wavelengths, or red, green, and blue color. A 3-color LED (sometimes called an RGB LED)
emits the three colors of light (red, green, and blue) that trigger the cones in the eye. An RGB
LED actually contains three individual LEDs encased in one shell. It looks like a single LED
with four leads or wiresone for each color and a fourth lead for the common ground. Additional
colors can be perceived by the human eye when the individual LEDs are illuminated
simultaneously in different combinations.

PROJECT DESIGN REQUIREMENTS
In this Project, you will build a circuit and write a LabVIEW program to illuminate the three
different colors of light (red, green, or blue) in an RGB LED. The user should be able to select
any one of the three colors by name from a front panel control and be able to turn off all three
colors while the program is running. Since LEDs can be destroyed if too much current flows
through them, you should wire each of the three leads in series with three current-limiting
resistors.

MATERIALS
SensorDAQ or LabQuest interface 3-color RGB LED, common cathode
LabVIEW three 220 resistors
computer breadboard
USB cable jumper wires
Vernier Digital Control Unit (DCU) ping-pong ball
Vernier LabQuest or LabPro power supply

Project 3
P3 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT SETUP
Construct a 3-color RGB LED circuit
1. Connect the 9-pin cable to the side of the DCU.
2. Insert the RGB LED and resistors into a breadboard, and then wire the components to the
DCU cable as shown in the figure below. You can find the color-coded pin-out for the DCU
cable on the label attached to the cord.
Tip: There are four leads or wires on an RGB LED. Normally, with a single-color LED, you
would connect the shorter wire to the ground connection. However, you should not assume that
the shortest wire on a RGB LED is the ground wire. Refer to your manufacturers specifications
for the proper wiring connections.

Figure 1 Wiring diagram for connecting an RGB LED to the DCU cable
Connect the DCU to the interface
1. Connect the DCU to the DIG port on the interface.
2. Connect a power supply to the DCU.
3. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.

PROJECT BACKGROUND INFORMATION
In this Project, you are asked to illuminate each of the three colors (red, green, and blue) in the
3-color RGB LED individually. The Digital Control Unit (DCU) gives you this functionality.
The DCU is an electronic device that allows you to control up to six digital output lines for
on/off control of LEDs and other DC electrical components. The DCU connects to the DIG port
on the interface and is powered by a separate DC power supply. A 9-pin, D-sub socket cable is
supplied with the DCU, with bare wires on one end, for use in building projects. There are
connections for all six digital lines, plus a power connection and two ground connections. The
color code of the wires is identified on a label attached to the cable.
Each of the three color leads or wires on the LED should be connected in series with a current-
limiting resistor to the first three DCU lines D1, D2, and D3; the fourth lead should be connected
to one of the ground (GND) lines. To illuminate each color, you must send a numeric output
pattern to the DCU to turn the digital line on. When you place the Digital Express VI on the
block diagram, a configuration window appears. If you select Output Lines 16 from the Device
Selection tree you will see a picture of the DCU. Change the DCU Pattern values from 0 to 15
for feedback on what lines are activated. As shown in the diagram below, a pattern of 1 will
LED Color Mixer
Engineering Projects with NI LabVIEW and Vernier P3 - 3
turn on DCU line D1. Please be aware that a pattern of 2 will turn on line D2, but a pattern of
3 will turn on lines D1 and D2 simultaneously.

Figure 2 Configuration window for the Vernier Digital Express VI

PROJECT TIPS
1. A diffuser is recommended when using a RGB LED, because the human eye tends to see the
individual colors rather than the merged color. A diffuser blends and scatters the three
individual light sources making them appear softer and more muted. A ping-pong ball serves
as a good diffuser. Cut a small hole through one end of the ball and place it over the lens of
the LED.
2. Refer to Appendix C for additional information on programming the DCU and the Digital
Express VI.
3. Refer to Appendix E for additional information on the Vernier DCU.

PROJECT TROUBLESHOOTING
If the third color does not appear to be the appropriate hue, check that you are sending the right
value into the Digital Express VI to set the DCU output properly.
Project 3
P3 - 4
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Make four additional colors (magenta, cyan, yellow, and white) with your RGB LED by turning
on the three digital lines in pairs or as a triple (refer to the table of DCU output patterns below).
Do some initial testing with your LED and your ambient room light to determine which
combination of digital lines turns on the four color hues. Modify your LabVIEW program from
the Project to allow the user to illuminate one of the seven different colors.

CHALLENGE BACKGROUND INFORMATION
To turn on two or more DCU lines simultaneously, you must send a unique numeric output
pattern to the Digital Express VI. The first 12 output patterns correspond to a binary number
system. If the switch is in the + position, current will flow and the device connected to that line
will be on. If the switch is in the or X position, the device will be turned off. As you can see
from the table, sending an output pattern of 7 turns on all three lines. If your circuit is wired
properly, turning on all three lines simultaneously should cause the RGB LED to appear white.
Output Binary D1 D2 D3 D4 D5 D6
0
0000
X X
1
0001
+ X X
2
0010
+ X X
3
0011
+ + X X
4
0100
+ X X
5
0101
+ + X X
6
0110
+ + X X
7
0111
+ + + X X

Table 1 The digital output patterns for the DCU for use in this Challenge

CHALLENGE TROUBLESHOOTING
1. Make sure you are sending the proper output pattern to turn on one or more digital lines. Use
the Digital Express VI configuration window to test your pattern and hardware.
2. If you are not getting a good color range in this Challenge, you may need to adjust the value
of the resistors in your circuit (they do not have to be identical). The purpose of the resistors
is to limit the current through the LEDs to prevent burnout, but they should be sized to give a
good range of adjustment on each color. Check the manufacturers data sheet to find the
typical operating current for your particular LED. You can tell you have good color balance
if white light is produced when all three colors are illuminated.
LED Color Mixer
Engineering Projects with NI LabVIEW and Vernier P3 - 5
EXTREME CHALLENGE DESIGN REQUIREMENTS
Produce even more color hues by varying the intensity or brightness of one colors illumination
using a concept called pulse-width modulation. Pulse-width modulated signals flash the LED on
and off at a high enough rate of speed as to be perceived as a solid color by the human eye. The
colors intensity is controlled by the fraction of time the color is on (commonly called the duty
cycle). Using blue as the base color and red as the modulated color, write a LabVIEW program
to produce color hues from blue to magenta (the combination of blue and red). The duty cycle
for the red LED should be controlled independently from the front panel.

EXTREME CHALLENGE SETUP
Connect the RGB LED to the DCU (SensorDAQ)
1. Connect the lead wire for the red LED to DCU line D1.
2. Connect the lead wire for the blue LED to DCU line D3.
3. The lead wire for the GND connection should not be changed.
Connect the RGB LED to the DCU (LabQuest interface)
1. Connect the lead wire for the red LED to DCU line D4.
2. Connect the lead wire for the blue LED to DCU line D1.
3. The lead wire for the GND connection should not be changed.

EXTREME CHALLENGE BACKGROUND INFORMATION
In the Extreme Challenge, you are asked to build a Color Mixer that will display a continuous
range of color hues. Having two colors on simultaneously will produce a new color, but you will
get a much broader spectrum of color if you vary the intensity of one color as well. By flashing
one LED on and off at various duty cycles, while keeping the other LED on all the time, you can
create a range of shades between the two LEDs.
SensorDAQ and LabQuest interfaces have the capability of generating a pulse train signal. You
can control the pulses with a technique called pulse-width modulation (PWM). In any one pulse,
PWM limits the amount of time a signal is on. The ratio of on time to total time is called the
duty cycle. In the pulse train shown below, the pulse is on for 60% of the time and off for
40% of the time. This allows you to control the intensity, or brightness, of the LED by varying
the duty cycle.

Figure 3 Pulse-width modulated signal
Project 3
P3 - 6
Engineering Projects with NI LabVIEW and Vernier

When using PWM at very low frequencies with an LED, there is a noticeable flicker in the light
as it is switched on and off; once you get above the flicker frequency of the human eye, the light
appears as a single, continuous color. Fortunately, the Digital Express VI has a Pulse-Train
Generation selection that can be used to control both the frequency and duty cycle of the signal.
Since you are blending colors, you will have one LED on continuously, while varying the
intensity of a second LED with a PWM signal. For example, if the blue LED is on continuously
while the intensity of the red LED is varied, the colors you observe will range from blue to
magenta (the combination of blue and red).

Figure 4 Color mixing with pulse-width modulation
Due to hardware limitations, some DCU lines are not available when the pulse generator is
active. If you are using a SensorDAQ, you must connect the red LED that will be pulsed to DCU
line D1, and the blue LED that will remain on continuously to DCU line D3. If you are using a
LabQuest interface, you must connect the red LED that will be pulsed to DCU line D4, and the
blue LED that will remain on continuously to DCU line D1. Keeping one LED on continuously
and sending a pulse train to a second LED requires you to use two Digital Express VIs. You will
use one Digital Express VI to turn on the blue LED and a second Digital Express VI to send a
variable pulse to the red LED. Connect the Stopped and Stop terminals of these two Express VIs
together.

EXTREME CHALLENGE TIPS
1. Set the Frequency on the pulse generator to 50 Hz.
2. The Duty Cycle is a decimal number between 0 and 1, but you should avoid sending an
actual 0 or 1 to the Digital Express VI because these values are not supported.
3. If you are using a LabQuest interface, make sure the DCU is connected to the DIG1 port.

Project
3
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P3 - 1T
TEACHER INFORMATION
LED Color Mixer
If your students are not familiar with Enumerated Type Controls or Enums, you may want to go
over them before they start this Project. The Challenge for this chapter is not that difficult;
however, you should encourage your students to first develop and test a good working program
for the Project Design Requirements to ensure that their circuits are working properly. The front
panel should provide the user with a clear selector for the different color choices.
We offer an Extreme Challenge for SensorDAQ users only. This Extreme Challenge introduces
the concept of pulse-width modulation and takes advantage of the pulse output capabilities of the
SensorDAQ hardware. LabQuest interfaces do not have a good pulse output option for the
Extreme Challenge.

PROJECT CONSTRUCTION TIPS
The trickiest part of this Project is determining which wire corresponds to which of the three
colors. The simplest way to determine this is to assemble your circuit, and then do some
preliminary testing with DCU output patterns from the configuration window of the Digital
Express VI. Remember, you must click the Run button in the upper-left corner of the
configuration window to illuminate the LED connected to the DCU. Note: If you are using a
LabQuest interface for this Project, you may find that lines D3 and D4 remain on, even when the
program is not running. This occurs with older DCUs.
In the photo below, we connected the DCU cable to the resistors and LED wires through a
breadboard. This gives you the flexibility to quickly make modifications to your connections.
You will get significantly better color blending if you use an LED with a diffused lens (as
opposed to a clear lens) and if you place a white ping pong ball over the lens. This Project
assumes the use of a common cathode RGB LED.

Figure 1 Close-up of 3-color RGB LED circuit
Project 3 Teacher Information
P3 - 2T
Engineering Projects with NI LabVIEW and Vernier

PROJECT PROGRAMMING TIPS
This Project is relatively straightforward. After wiring the circuit, students should write a
LabVIEW program to illuminate one of the three colors on the LED by sending the appropriate
output pattern to the DCU. They should select the color by name from a front panel control. This
front panel control could be wired to a Case Structure in the block diagram to send the
appropriate DCU output pattern.
Illuminate a 3-color RGB LED
If students were using a traditional, single-color LED, they would simply activate one line on the
DCU to illuminate it; but an RGB LED actually involves three individual LEDs housed in a
single lens. The Digital Express VI found in the Vernier functions palette can be used to control
three different digital lines. When the Digital Express VI is placed on the block diagram, a
configuration window appears. When Output Lines 16 is selected from the Device Selection
tree control, an interactive picture of the DCU appears. Students can sample the 16 different
output patterns to see which combination of digital lines will be active for any given number.
Clicking the Run button in the upper-left corner of the window will activate these lines on the
DCU, if the DCU is connected to the interface. An output pattern of 1 will turn on DCU line
D1 illuminating whichever LED color is connected to it. A pattern of 2 will turn on DCU line
D2, but a pattern of 3 will not turn on DCU line D3. A pattern of 3 indicates that digital lines
D1 and D2 are on simultaneously, as shown in the figure below. Students must send a pattern of
4 to turn on DCU line D3. A pattern of 0 will turn all lines off.

Figure 2 Digital Express VI configuration window for DCU control
One suggestion for creating this program is to use a Case Structure with an enumerated type
control, Enum. An Enum (found in Controls Modern Ring & Enum) contains a list of text
strings through which you can cycle (in this exercise, the colors Red, Green, and Blue, as
well as the Off option would work well). When you wire an Enum to the selector terminal of a
Case Structure, LabVIEW matches the cases to the strings in the control.
LED Color Mixer
Engineering Projects with NI LabVIEW and Vernier P3 - 3T

Figure 3 Sample program for illuminating individual colors in an RGB LED
Tip: After placing the Enum control on the front panel, right-click on it and select Edit Items to
insert the three color choices and no color (Off). When you wire the Enum control to the Case
Structure on the block diagram, only two cases will be displayed. You must right-click on the
Selector Label and select Add Case for Every Value to reveal the other two choices.

CHALLENGE CONSTRUCTION TIPS
Students may need to adjust the resistors in their circuits to achieve good color balance for the
Challenge. Typically blue LEDs generate less intensity per milliamp than red or green LEDs.
You might want to provide a selection of lower-value resistors for your students to experiment
with after they have completed their programming modifications. Students can tell their circuits
have good color balance if white light is produced when all three colors are illuminated at full
power.

CHALLENGE PROGRAMMING TIPS
Illuminate four additional colors
The Challenge is simply an extension of the Project. Students will need to add the additional four
color choices (magenta, cyan, yellow, and white) to their Enum control. Right-clicking the Enum
control and selecting Properties will allow them to insert the additional four colors into the list of
strings.

Figure 4 Configuration window for adding items to an Enum control
Project 3 Teacher Information
P3 - 4T
Engineering Projects with NI LabVIEW and Vernier

Students will need to do some experimentation to match the higher number DCU output patterns
to the correct color hues. White should correspond to a pattern of 7 turning on three digital
lines at once. The revised program is shown below.

Figure 5 Sample program for illuminating seven colors with a RGB LED

EXTREME CHALLENGE CONSTRUCTION TIPS
The SensorDAQ and LabQuest interfaces have the capability to generate a pulse train signal;
however, in order to perform this output some DCU lines are compromised. SensorDAQ users
can only send pulses from DCU line D1. This leaves two output lines (D3 and D4) that can be
turned on while simultaneously performing a pulse output signal. LabQuest interface users can
only send pulses from DCU line D4 leaving output lines D1 and D2 available for a constant DC
signal output when the pulse generator is active. To satisfy the Extreme Challenge Design
Requirements, SensorDAQ users should connect the red LED to line D1 and the blue LED to
line D3. If students are using a LabQuest interface, the red LED should be connected to line D4
and the blue LED to line D1.
Note, if some of your sharper students plan to tackle Extension #1, the green LED should be
connected to DCU line D4 if using a SensorDAQ or DCU line D2 if using a LabQuest interface.

EXTREME CHALLENGE PROGRAMMING TIPS
Send a pulse-width modulated signal to an LED
One way to tackle the programming for the Extreme Challenge is to modify the program created
in the Challenge. First you will need to remove the Enum control and the Case Structure. Wire a
constant to the Digital Express VI for the DCU Pattern. Remember, to illuminate the blue LED
connect to line D3. SensorDAQ users will send a pattern of 4; LabQuest users will send a
pattern of 1.
It is important that you leave the DCU pattern input as a constant rather than a control. When
performing a pulse output from line D1, the output pattern to the DCU cannot be modified once
the pulse output has been started. To modify the output patter, you first must properly stop the
pulse output.
LED Color Mixer
Engineering Projects with NI LabVIEW and Vernier P3 - 5T

Figure 6 Modified program to illuminate the blue LED on line D3 with a SensorDAQ
Next, you must add a second Digital Express VI to the right of the first one. This Express VI will
be used to generate a PWM signal for the red LED. In the configuration window, select Pulse-
Train Generation and set the Frequency to 50 Hz. Avoid creating a front panel control for the
Frequency as changing the frequency while the program is running will tend to cause an error.

Figure 7 Configuration window for Pulse-Train Generation
After closing the Express VI configuration window, you should create a front panel control for
the Duty Cycle. A Slide or Dial works well for making quick adjustments. The Duty Cycle is a
decimal number between 0 and 1; however, the actual values of 0 and 1 are not supported in the
program. To avoid an execution error you should limit the Data Entry values to 0.001 and 0.999
as shown in the figure below. You can access the Data Entry configuration window by right-
clicking on the Duty Cycle control. Using the Data Entry property to limit the range of the Duty
Cycle is a much more user-friendly option than limiting the Scale on your front panel control.
Selecting Coerce as the response to a value outside the limits will ensure that the Duty Cycle
always stays within range.
Project 3 Teacher Information
P3 - 6T
Engineering Projects with NI LabVIEW and Vernier


Figure 8 Duty Cycle Properties configuration window
The figure below shows a sample program for a SensorDAQ. The final step is to wire the stop
(F) and stopped terminals of both Express VIs. Notice that the stopped terminal of the left-
hand Digital Express VI is wired to the stop (F) terminal of the right-hand Express VI. The
program will look the same for LabQuest interface users, except that the DCU Pattern input for
the first Digital Express VI will be 1 instead of 4.

Figure 9 Sample program for holding one LED on at full power,
while varying the intensity of a second LED with PWM

EXTENSIONS
1. Create a second color combination in the Extreme Challenge with the green LED. When the
pulse generator is active, one DCU line is able to send a PWM signal, but two additional
lines are available for connecting LEDs that receive a continuous signal. Pulsing the red LED
while keeping the green and/or blue LEDs on will yield a wide range of color variations
green to yellow, blue to magenta, or cyan to white (all three LEDs combined). Try placing
controls on the front panel to allow the user to turn the green and blue LEDs on or off as
desired. Be aware, however, that the user must stop the program before switching color
combinations, because the output pattern to the DCU cannot be modified once the pulse
output has been started.
LED Color Mixer
Engineering Projects with NI LabVIEW and Vernier P3 - 7T
2. Unlike a RGB LED, the behavior of a red and green bipolar LED depends on the direction of
current flow. If the current flows in one direction, the bipolar LED appears green; if the
current flows in the opposite direction, the LED appears red. Build the circuit shown below
(notice there is no GND connection in this circuit). Then write a LabVIEW program to
illuminate the two colors on the bipolar LED. Send an output pattern of 1 to activate line
D1 and illuminate the first color; send an output pattern of 2 to activate line D2 and
illuminate the second color.

Figure 10 Wiring diagram for a bipolar LED
3. SensorDAQ only: The SensorDAQ has the hardware capability to emulate a pulse-width
modulated signal using the array functions in LabVIEW. The user can generate an infinite
number of hues by manipulating all three LEDs simultaneously with front-panel controls.
This method does not produce satisfactory results with LabQuest interfaces, due to their
slower response when sending a signal to the DCU.
Start by wiring the red, green, and blue leads of the RGB LED to lines D1, D2, and D3 on
the DCU, and connecting the DCU to the SensorDAQ. Now, create a simple program to send
an output pattern to only control line D1. This pattern should consist of 10 elements that
control the amount of time that the line is on and the amount of time that the line is off (you
may want to experiment later with how the number of elements affects flicker and control).
A simple program that would keep the line on for approximately 5 milliseconds and off for
5 milliseconds is shown below. It is important to use the Wait (milliseconds) function within
the For Loop (this provides the time-base). Also, placing the For Loop within a While Loop
means that the 5 millisecond on/off pattern is continuous. To change the on/off pattern to
keep line D1 on for 2 milliseconds, and off for 8 milliseconds, you would have to stop the
program and change the values in the input array to 1,1,0,0,0,0,0,0,0,0. If line D1 were
connected to the red LED, the color would appear to have a pinkish hue because the red LED
is only on 20% of the time.

Figure 11 Program for turning on line 1 half of the time
Project 3 Teacher Information
P3 - 8T
Engineering Projects with NI LabVIEW and Vernier

This program should now be modified to provide better user control. Use LabVIEW array
function to create the 10-element array. One way to do this is shown in the program below.
First we created a 10-element array of 0s, and then we created a second array of 1s. The
number of elements in this second array is controlled by the user from a front panel control.
We merge the array of 1s into the beginning of the 10-element array of 0s using the
Replace Array Subset function. If, for example, the user sets the number of elements
control with a value of 5, the final array for our DCU pattern will consist of five 1s and five
0s, exactly the same as the array in the program above. But unlike the earlier program, this
program below allows the user to update the pattern as the program runs.

Figure 12 Program to allow user control of the duty cycle of line 1
Now, modify the program further to allow the user to control the on/off times of all three
lines. If you just wanted to control line D2 you would build a 10-element array that sends the
DCU a pattern of 2s and 0s. If you just wanted to control line D3 you would build a
10-element array that sends the DCU a pattern of 4s and 0s. However, the goal is not to
turn on a single line at a time. The goal is to control all 3 lines at the same time. This means
that our 10-element array, our pattern, should be controlling all three lines. For example,
recall that sending a 7 to the DCU turns on lines D1, D2, and D3. Therefore, a 10-element
array with a pattern of 7,7,7,7,7,0,0,0,0,0 would create a DCU output pattern with lines D1,
D2, and D3 on for 5 milliseconds and off for 5 milliseconds. Now consider a pattern of
7,7,7,7,6,6,2,2,0,0.
Output D1 D2 D3
7 X X X
7 X X X
7 X X X
7 X X X
6 X X
6 X X
2 X
2 X
0
0

LED Color Mixer
Engineering Projects with NI LabVIEW and Vernier P3 - 9T
The result is that line D1 is on 4 milliseconds and off for 6 milliseconds, line D2 is on for
8 milliseconds and off for 2 milliseconds, and line D3 is on for 6 milliseconds and off for
4 milliseconds.
One method to create the pattern of the 10-element array is to sum the output that controls
each line individually (1 turns on line D1, 2 turns on line D2, and 4 turns on line D3), the
result is the output required to turn on the appropriate line(s). If all three lines need to be
turned on, the output required is a 7 (1+2+4 = 7). If lines D2 and D3 need to be turned on,
the output is a 6 (0+2+4 = 6). And if only line D2 needs to be on the output is a
2 (0+2+0 = 2). A block diagram that performs this summation, and builds the appropriate
10-element array, is shown below.

Figure 13 Block diagram for the final program
The front panel for this program is shown below, where the array labeled result is the
pattern sent to the DCU.

Figure 14 Front panel for the final program

Project
4
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P4 - 1
Hot-Wire Anemometer

An anemometer is a weather instrument for measuring wind speed. There are many styles of
anemometers including windmill, cup, and sonic, but this Project is based on the concept of a
hot-wire anemometer. In a standard hot-wire anemometer, a thin wire is heated to a temperature
above ambient by running an electrical current through it. After a short period of time, the wire
will reach an equilibrium temperature such that the heat energy coming into the system from
electricity will be matched by the loss of heat energy to the environment. The rate of heat loss
depends on the wind speed of the surrounding environment. An increase in wind speed causes an
increase in heat loss. In a hot-wire anemometer, wind flowing across the thin wire causes the
temperature of the wire to decrease the faster the wind moves, the more the wire cools. By
measuring the temperature of the hot wire, you can indirectly determine wind speed.

PROJECT DESIGN REQUIREMENTS
In this Project, you will build a device that acts like an electric birthday candle based on the
principle of a hot-wire anemometer. Use the Digital Control Unit (DCU) to supply power to a
resistor, which will act as a heater (the hot wire) in your device. Add a red LED and a current-
limiting resistor to your apparatus to represent the flame on a birthday candle. Write a LabVIEW
program to monitor the temperature of the heating resistor with the Surface Temperature Sensor
and illuminate the candle flame LED when the temperature exceeds a threshold value. Your
program should make the LED act like a birthday candlethat is, when you blow on it, it should
go out.
Project 4
P4 - 2
Engineering Projects with NI LabVIEW and Vernier

MATERIALS
SensorDAQ or LabQuest interface LabQuest or LabPro power supply
LabVIEW red LED
computer 100 resistor
USB cable 220 resistor
Vernier Surface Temperature Sensor adhesive
Vernier Digital Control Unit (DCU) heat-shrink tubing (optional)

PROJECT SETUP
Construct a hot-wire anemometer
1. Plug the 9-pin cable into the socket on the side of the DCU .
2. Wire the LED and resistors to the DCU cable as shown in the diagram below. Note that the
flat side of (or the short wire on) the LED should be connected to GND.

Figure 1 Hot-wire anemometer wiring diagram
3. Secure the tip of the Surface Temperature Sensor against the heating resistor. If you have
heat-conducting Epoxy cement available, use it. If not, use a small dab of any adhesive.

Figure 2 Hot-wire anemometer
4. (Optional) Use short lengths of heat shrink tubing to cover your electrical connections, but
make sure not to cause a short. The Surface Temperature Sensor and heating resistor should
remain exposed to the open air.
Hot-Wire Anemometer
Engineering Projects with NI LabVIEW and Vernier P4 - 3
Connect the Surface Temperature Sensor and DCU to the interface
1. Connect the DCU to the DIG port of the interface.
2. Connect a power supply to the DCU.
3. Connect the Temperature Sensor to Channel 1 of the interface.
4. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.

PROJECT BACKGROUND INFORMATION
In this Project, you are asked to build a hot-wire anemometer that will act like an electric
birthday candle. A red LED will be used as a qualitative indicator of wind speed and will act as
the candle flame. A resistor will serve as the hot wire to radiate heat as current flows
through it. You should monitor the temperature of the hot wire with a Surface Temperature
Sensor and control the illumination of the LED with the Digital Control Unit (DCU).
The DCU is a small box with a short cable that connects to the DIG port on the interface. On one
side of the DCU is a socket that accepts a DC power supply for powering up to six electronic
components. The top of the DCU is transparent, through which you can view the six red LEDs
and one green LED inside the unit. The green LED illuminates when the DCU is properly
connected and running a DCU program. The red LEDs indicate the status (on or off) of the six
output lines of the DCU (D1-D6). A 9-pin, D-sub socket cable with bare wires on one end is
supplied with the DCU for use in building projects. There are connections for all six digital lines,
plus a power connection and two ground connections. The color code of the wires is identified
on a label attached to the cable.
When building devices such as a hot-wire anemometer, you should always keep the power
limitations of the DCU in mind. You should not exceed 1000 mA total.
The Digital Express VI found in the Vernier functions palette can be used to control the DCU. In
order to activate the DCU, you must send an output pattern to the Digital Express VI indicating
which line(s) are to be turned on. When you place the Digital Express VI on the block diagram, a
configuration window appears. If you select Output Lines 16 as the Device Selection, you will
see a picture of the DCU. Change values from 0 to 15 in the DCU Pattern control for feedback
on what lines are activated. As shown in the figure below, a pattern of 1 will turn on DCU line
D1.

Figure 3 Digital Express VI configuration window for the DCU
Project 4
P4 - 4
Engineering Projects with NI LabVIEW and Vernier

You need to individually control the LED and the resistor acting as a heater with your DCU. The
power to the heating resistor should remain on continuously, but the LED will turn on and off
depending on the reading from the Surface Temperature Sensor.
Once your device is constructed, you must do some preliminary testing to determine a good
threshold temperature. You will be using your own breath as the wind for your anemometer.
When the device is first activated, the air temperature around the sensor will increase as current
flows through the resistor. The LED should illuminate when a pre-defined temperature
(commonly called the set point) is reached. At this point, when you gently blow on the heating
resistor, the LED should stay lit. You want to set a threshold temperature that requires you to
blow somewhat vigorously (much like you would blow out the candles on a birthday cake) in
order to cool the resistor wire to a point that the LED goes off.
Normally, when you blow out a candle, the flame is completely extinguished; but your Project
will be more interesting and amusing if you treat your device as a trick candle. If you leave
DCU line D2 on continuously, the current through the heating resistor will never stop. The wire
will reheat to the threshold temperature when you stop blowing on it, and the LED will
illuminate again waiting for you to blow it out again.

PROJECT TIPS
1. LEDs are light emitting diodes. Like all diodes, an LED will only conduct an electrical
current in one direction. The short wire or flat side of the lens should be connected to ground.
2. The tip of the Surface Temperature Sensor should be near or touching the resistor.
3. Since you are using a resistor instead of a very fine wire, your anemometer may be slow to
respond. Be patient when waiting for the temperature reading to stabilize.
4. Avoid using the Abort Execution button to stop your VI, because some of the DCU lines may
remain on.
5. A good data-collection rate for the Surface Temperature Sensor is 10 samples/second.
6. The Analog Express VI collects data for a fixed amount of time. For an indefinite data
collection length, check the Repeat option in the Analog Express VIs Set Timing
configuration window.
7. Refer to Appendix C for additional information on programming the DCU, and the Digital
and Analog Express VIs.
8. Refer to Appendix E for additional information about the Vernier Surface Temperature
Sensor and DCU.

PROJECT TROUBLESHOOTING
1. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on.
2. Double-check the DCU cable connections against the color-coded label attached to the cable.
3. Make sure you are sending the proper output pattern to turn on one or more digital lines.
Hot-Wire Anemometer
Engineering Projects with NI LabVIEW and Vernier P4 - 5
4. Both the stop (F) and stopped terminals on the Vernier Analog and Digital Express VIs
must be wired in order for the program to execute and shut down properly.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Modify your Project program to include a birthday greeting sound file. (LabVIEW has the ability
to play any .WAV file.) Place a new button on the front panel to allow the user to play the sound
file when the candle flame LED lights up. You can record your own personal greeting,
download a file from another source, or use the sound file, Birthday.wav, included on the CD
that came with this book.

CHALLENGE BACKGROUND INFORMATION
LabVIEW contains several example files to help you learn how to play and/or record sound files.
The function you are most likely to use in this exercise is the Play Sound File subVI (found in
the Programming Graphics & Sound Sound Output functions palette). When using this
subVI, you must specify the path to the location of your sound file. You can designate the path
as a constant or you can use the path functions from the Programming File I/O function
palette to build a unique path name based on the location of your main program.

CHALLENGE TIPS
1. The Play Sound File subVI has a timeout input. A timeout value of 0 allows the While Loop
to continue without pause.
2. Play the sound file when the temperature is above the set point and the user has pressed the
button. A Case Structure is a good structure for this type of logic.

CHALLENGE TROUBLESHOOTING
Make sure the volume on your computer is turned on and set to an appropriate level.

EXTREME CHALLENGE DESIGN REQUIREMENTS
Instead of using your breath to blow out the candle flame LED, incorporate a small DC fan
into your apparatus that will turn on and blow out the LED when the temperature reaches the
threshold value. Since you are already using DCU lines D1 and D2 for the LED and resistors,
you will need to wire the fan to line D3.

ADDITIONAL MATERIALS
small fan

Project 4
P4 - 6
Engineering Projects with NI LabVIEW and Vernier

EXTREME CHALLENGE SETUP
Connect a DC fan to the DCU
1. Wire a small DC fan between DCU line D3 and GND.

Figure 4 DC fan wiring diagram
2. Position the fan so that it blows on the heating resistor in your anemometer.

EXTREME CHALLENGE BACKGROUND INFORMATION
The DCU can be used to control the fan as well as the components in your hot-wire anemometer.
The fan should come on when the LED is illuminated because the purpose of the fan is to blow
out the candle flame LED. This means that when the threshold value is exceeded all three
components (the fan, the resistor, and the LED) should be on.
The first eight DCU output patterns correspond to a binary number system as shown in the table
below. If the switch is in the + position, current will flow and the device connected to that line
will be on. If the switch is in the or X position, the device will be turned off. If your circuit is
wired correctly, turning on all three lines simultaneously should cause the fan to blow on the
heating resistor and cool it down so that the LED can go out.
Output Binary D1 D2 D3 D4 D5 D6
0 0000 X X
1 0001 + X X
2 0010 + X X
3 0011 + + X X
4 0100 + X X
5 0101 + + X X
6 0110 + + X X
7 0111 + + + X X

Table 1 Digital output patterns for the DCU for use in this Challenge

EXTREME CHALLENGE TROUBLESHOOTING
If your LED seems to be taking a long time to go out, adjust the position of the fan. The fan
should blow directly on the heating resistor rather than the LED or the Surface Temperature
Sensor.
Project
4
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P4 - 1T
TEACHER INFORMATION
Hot-Wire Anemometer
In this Project, students are asked to build an electric birthday candle based on the concept of a
constant-current, hot-wire anemometer. Real world anemometers send current through a very
thin section of heated wire, but in this Project students will apply a constant voltage to a small
resistor with the DCU. The hot wire, or resistor acting as a heat sink, will reach an equilibrium
temperature in a few minutes, such that the heat energy coming into the system from electricity
will be matched by the loss of heat energy to the environment. The rate of heat loss will depend
on the wind speed blowing across the hot resistor. The difficulty in this Project is finding an
acceptable threshold temperature that will allow your device to respond quickly to human breath.
Adding an adjustable control for the set point and an indicator for the sensor temperature to the
front panel will aid in testing the device. You should encourage your students to develop and test
a good working program for the Project Design Requirements before attempting to add a sound
file and a fan for the Challenge and Extreme Challenge.
This Project was inspired by the article, Electronic Birthday Candles Blow Out One at a
Time, by Abhijeet Deshpande, p 56 in Electronic Design, April 24, 2008.

PROJECT CONSTRUCTION TIPS
This Project can be assembled using a breadboard, but you may wish to wire your components
together and then cover the connections with short lengths of heat-shrink tubing. It will be easier
to hold onto the device as you blow on it. The trickiest part of this Project is wiring the circuit
properly so as not to create an unwanted electrical short. A small dab of any glue or cement
works well to secure the Surface Temperature Sensor to the heating resistor. If you have heat-
conducting Epoxy available, you will get an even faster response from your anemometer.
Make sure the students use a resistor in series with the LED so that it does not draw too much
current and burn out.
A good exercise for students go through is to determine the proper resistor to use as the heater
for this Project. Since the students need to use a physically small resistor, you probably want to
provide a 1/4 watt resistor. Have the students calculate the proper resistance for this resistor so
that it is dissipating the full 1/4 watt. If they use a LabQuest 5 V power supply
Power = I * V = V
2
/R
0.25 watt = (5 V)
2
/ R
R = 25 volts
2
/ 0.25 watt =

100 ohms
The voltage supplied by the DCU is actually somewhat lower than the rated voltage of the power
supply. The DCU uses transistors to switch the circuits, and therefore, the actual voltage out of
the DCU lines is typically about 0.7 volts lower than the power supply. This means a lower
resistance can be used. Students could be asked to measure the voltage supplied by the DCU to
the heating resistor and to calculate the lowest standard resistor value which would not exceed
the power rating.
Project 4 Teacher Information
P4 - 2T
Engineering Projects with NI LabVIEW and Vernier


Figure 1 Close-up of components, with a Surface
Temperature Sensor glued to a heating resistor

PROJECT PROGRAMMING TIPS
One suggestion for tackling this Project is to break it into two parts. First, write a LabVIEW
program to turn on any DCU line with a front panel control. This gives students the opportunity
to test the different DCU output patterns and ensure that their components have been wired
properly. Next, they can modify their programs to control one or more DCU lines based on
sensor data.
Part I Turn on a DCU line
You should use the Digital Express VI found in the Vernier functions palette to control the DCU.
Choosing the option to keep the DCU lines on indefinitely allows you to place the VI within a
loop and control the lines continuously. Be aware that the stop(F) terminal of the Digital
Express VI should be wired to ensure that all DCU lines are turned off before program execution
ends, as shown below.

Figure 2 Sample program to turn on one or more DCU lines
Hot-Wire Anemometer
Engineering Projects with NI LabVIEW and Vernier P4 - 3T
Part II Control DCU lines with sensor data
You should use the Analog Express VI found in the Vernier functions palette to collect data with
the Surface Temperature Sensor. If you want your program to run indefinitely, select the Repeat
option in the Set Timing configuration window. This allows data collection to continue until the
user clicks the stop button on the front panel. Note: The Averaging function should remain
checked if you are using SensorDAQ. Averaging is not an option for the LabQuest interface,
because it is done automatically in the interface firmware.

Figure 3 Data Collection configuration window for the Analog Express VI
One suggestion for determining the proper DCU output pattern is to use a Greater? and a Select
function as shown in the sample program below. When the sensor reading is less than the
Setpoint, a pattern of 2 will apply voltage to the resistor acting as a heat sink on DCU line D2.
When the temperature of the sensor exceeds the Setpoint, a pattern of 3 will turn on both DCU
lines D1 and D2, and the LED connected to line D1 will illuminate. Note how the stop (F) and
stopped terminals are wired between the Express VIs and the While Loops conditional
terminal. This wiring controls the proper sequence of calling the Analog Express VI prior to the
Digital Express VI, and ensures that these Express VIs are terminated prior to ending the
program.

Figure 4 Sample program for a hot-wire anemometer

Project 4 Teacher Information
P4 - 4T
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE CONSTRUCTION TIPS
The Challenge does not require any additional construction.

CHALLENGE PROGRAMMING TIPS
Before tackling the program for the Challenge, students must obtain a sound file. You can use
the file Birthday.wav included on the CD that accompanies this book, or you may wish to
broaden this Challenge by having students record their own sound files. LabVIEW includes
several functions, as well as example VIs, for recording short sound clips.
Next, encourage your students to write a short program to play the sound. This will allow them
to check if the clarity and volume of their recordings are acceptable. The last step is to merge the
code that plays the sound file with their VI created for the Project. The main difference in this
Challenge is the addition of a new front panel control that the user will activate to play the sound
file.
Play a sound file
There are many subVIs available in LabVIEW for generating, saving, and manipulating sound.
We used the Play Sound File subVI (found in the Programming Graphics & Sound Sound
Output functions palette) in the sample program shown below. When using this subVI, you
must specify the path to the location of your sound file. We used three path functions to build our
path name. The Current VIs Path (found in Programming File I/O File Constants) returns
the path to the current or calling VI. The Strip Path function (found in Programming File I/O)
strips off the last component of the path. The Build Path function (also found in Programming
File I/O) creates a new path by appending the name of the sound file to the modified path. The
advantage of this method is that no matter where the sound file is stored on the computer, as long
as it is in the same folder as our calling program, it will be found.

Figure 5 Code to open and play a sound file
The Play Sound File subVI also contains a timeout input terminal. This input tells the program
how long it must wait for the sound file to complete. The default value is 0, which works well for
this program. This allows the sound file to start playing without any wait time in the Play Sound
File subVI. In other words, there will be no delay in the flow of the program as the sound file
plays.
Play a sound file when the sensor reading exceeds the set point
In the final step, we merged the code to play a sound file with our original Project program. A
button to play the sound file and a virtual LED indicator were added to the front panel. The front
panel LED is not part of the design requirements, but may be helpful to show when our real LED
is lit. When the user starts the program, the DCU will apply a voltage to the heating resistor until
the temperature reading exceeds the set point. The program will light up the real LED in the
anemometer, along with the virtual LED on the front panel, and wait for the user to press the
button to start the birthday greeting.
Hot-Wire Anemometer
Engineering Projects with NI LabVIEW and Vernier P4 - 5T

Figure 6 Front panel for playing a birthday greeting
Our final program is shown below. Notice that an And function is used so that the birthday
greeting is not played unless the temperature exceeds the threshold value and the user has
clicked the Happy Birthday Message button.

Figure 7 Sample program to play a sound file based on sensor data
Project 4 Teacher Information
P4 - 6T
Engineering Projects with NI LabVIEW and Vernier

EXTREME CHALLENGE CONSTRUCTION TIPS
Any small DC fan that operates on 4 to 5 volts will work for this Extreme Challenge. Note that
these fans are not very powerful, so the time required to lower the temperature of your hot wire
will depend somewhat on the temperature of the surrounding air and the proximity of the fan to
your heating resistor. For better results, make sure the fan is blowing directly on the heating
resistor.
If you are using a LabQuest interface, you may find that lines D3 and D4 remain on, even when
the program is not running. This only occurs with older DCUs.

EXTREME CHALLENGE PROGRAMMING TIPS
Control three DCU lines with sensor data
The programming for the Extreme Challenge is not significantly different from the Project
program, as shown in the figure below. Instead of turning on two DCU lines simultaneously,
students will need to turn on three lines at the same time (the LED, the heating resistor, and the
fan). A pattern of 7 will turn on all three devices assuming they are connected to DCU lines
D1, D2, and D3 (see the table of DCU Output Patterns in the student handout).
Adding a Waveform Chart to the front panel of this VI makes the Project much more interesting.
Students can then see how the temperature varies as the fan goes on and off.

Figure 8 Sample program to control three digital lines with sensor data

EXTENSIONS
1. Calibrate your hot-wire anemometer so that it can be used to display wind speed on the front
panel. You will need to conduct some preliminary tests to determine the proportional
relationship between the temperature of your device and wind speed. You can perform the
calibration using a variable speed electric fan and a commercial anemometer. Vernier
Software & Technology sells an Anemometer that works very well for this calibration. The
sample graph below was plotted using Vernier Logger Pro software. We suggest you take an
initial reading of the ambient temperature and use it to calculate a change in temperature (or
Delta T) for analysis. Note: A more elegant system would be to use two Surface Temperature
Hot-Wire Anemometer
Engineering Projects with NI LabVIEW and Vernier P4 - 7T
Sensors and read both of them simultaneously to determine the difference in temperature
between the ambient air and the heating resistor. Students can determine a mathematical
equation using the Curve Fit feature in Logger Pro, which can then be inserted into their
LabVIEW programs to convert the temperature of the hot wire to wind speed. You should
collect at least 4 to 5 data points to get an accurate fit.

Figure 9 Empirical relationship between wind speed and resistor temperature
If you do not have a variable speed fan, you can use a single-speed fan by positioning it at
various distances from your device to produce different wind speeds. Another option is to
take your apparatus and a laptop in a car. As the passenger holds the hot-wire device out the
window, the driver can approximate the wind speed from the speedometer of the car.
Remember, this device works best at low speeds.

Project
5
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P5 - 1
DC Motor Control

Small DC motors find many uses in electronic devices and are a favorite component of engineers
and hobbyists. The input voltage to a motor determines how fast it rotates, but in many projects
it is important to be able to measure the speed of the motor. A tachometer is an instrument that
measures the rotational speed of a motors shaft in revolutions per minute (rpm). Tachometers
are used on cars and aircraft to show the rate of rotation of the engines crankshaft, and can be
used to assist the driver in selecting the appropriate throttle and gear settings for safe driving
conditions since exceeding the maximum safe operating speed on an engine can lead to
overheating and engine failure. Some tachometers use lasers to measure rotational speed, while
others use a small generator to produce a voltage that is roughly proportional to the rotational
speed. This Project uses a Photogate to determine the speed of the motor.

PROJECT DESIGN REQUIREMENTS
In this Project, you will build a tachometer to measure the rotational speed of a DC motor. First,
you must build a circuit to power your motor from the Vernier Digital Control Unit (DCU). Your
circuit should contain a potentiometer to allow the user to control the voltage to the motor. Then,
you will write a LabVIEW program to determine the rotational speed in revolutions per minute
(rpm) by measuring the period of a propeller mounted to the motor shaft passing through a
Vernier Photogate.

MATERIALS
SensorDAQ or LabQuest interface small DC motor with propeller
LabVIEW 1 k potentiometer
computer ring stand
USB cable two rod clamps
Vernier Digital Control Unit (DCU) breadboard
LabQuest or LabPro power supply jumper wires
Vernier Photogate
Project 5
P5 - 2
Engineering Projects with NI LabVIEW and Vernier

ADDITIONAL MATERIALS (SENSORDAQ ONLY)
Vernier Digital Proto Board Connector


PROJECT SETUP
Construct a tachometer with a Photogate
1. Mount a propeller onto the shaft of a DC motor.
2. Support the DC motor and Photogate using a ring stand and rod clamps. The motor should be
aligned such that the propeller blade blocks the light beam in the Photogate as the propeller
spins. You should make sure that only one blade at a time blocks the beam.

Connect the motor to the DCU
1. Plug the 9-pin cable into the socket on the side of the DCU.
2. Connect the potentiometer and DC motor to the DCU cable as shown in the diagram below.
If you are using SensorDAQ, connect the potentiometer to line D3. If you are using a
LabQuest interface, you connect the potentiometer to line D4.

Figure 1 Wiring diagram for a potentiometer-controlled motor circuit
Tip: The leads on a DC motor can be connected in any order. Reversing the polarity will simply
cause the motor to rotate in the opposite direction.
3. Connect a power supply to the DCU.
4. Connect the DCU to the DIG 1 on the interface.
5. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
Connect the Photogate to the interface (SensorDAQ)
1. Insert a Vernier Digital Proto Board Connector into a breadboard.
DC Motor Control
Engineering Projects with NI LabVIEW and Vernier P5 - 3
2. Wire the Digital Proto Board Connector to the SensorDAQ screw terminal using jumper
wires as shown in the figure below.

Figure 2 Digital Proto Board Connector pin-out to SensorDAQ screw terminal
3. Connect the Photogate to the Digital Proto Board Connector.
Connect the Photogate to the interface (LabQuest)
1. Connect the Photogate to DIG 2 on the LabQuest interface.

PROJECT BACKGROUND INFORMATION
Motors are used to convert electrical energy to mechanical energy (in this case, rotation). Most
DC motors have six basic parts: an armature or rotor, commutator, brushes, axle, field magnet,
and stator. The stator is the stationary part of the motor, which includes the motor casing and two
field (permanent) magnets. The rotor (which includes the axle and commutator) is an
electromagnet that rotates with respect to the stator. The windings on the rotor make an electrical
connection to the power source through the brushes and the commutator.

Figure 3 Parts of a DC motor
When a current flows through the rotor windings, a magnetic field is created. The rotor
experiences a torque caused by the permanent magnets in the stator causing the rotor to rotate. In
the diagram above, the rotor would rotate clockwise. Just before the rotor aligns with the field
magnets, the commutator moves such that the brushes make contact on the opposite side and the
flow of current reverses. As the current through the windings is reversed, the polarity of the
magnetic field of the rotor is changed, causing the rotor to continue to move and make another
half turn. As the direction of current is continuously flipped at just the right moment, the rotor
will turn continuously. The magnitude of the torque or force on the rotor is controlled by the
magnitude of the current.
Project 5
P5 - 4
Engineering Projects with NI LabVIEW and Vernier

In this Project, you are asked to power the DC motor with the DCU. The DCU is an electronic
device that allows you to control up to six digital output lines for on/off control of motors and
other DC electrical components. The DCU plugs into one of the digital connections on the
interface and is powered by a separate DC power supply. A 9-pin, D-sub socket cable is supplied
with the DCU, with bare wires on one end, for use in building projects. There are connections for
all six digital lines, plus a power connection and two ground connections. The color code of the
wires is identified on a label attached to the cable.
The Digital Express VI can be used to control the DCU. You must send an output pattern
indicating which digital lines should be on or off at any one time. You can determine the correct
patterns to turn your motor on and off by sampling all 16 different output patterns in the
configuration window of the Digital Express VI.
You can control the rotational speed of the motor by varying the voltage to the motor with a
potentiometer. A potentiometer is a variable resistor often found in stereos to control volume in
some speaker systems. A potentiometer is composed of a carbon film or fine wire windings,
usually in the shape of an incomplete circle with two terminals on either end. As a wiper arm
connected to a rotating shaft sweeps between the two terminals, the resistance in the circuit (and
consequently the voltage to the motor) is varied.
In this Project, you will use a Photogate to determine the speed of the motor. A Photogate is an
electronic sensor that sends a +5V signal when a beam of light is passed uninterrupted between
the two arms of the gate. To use the Photogate as a tachometer you will attach a propeller to the
motor shaft and have it interrupt the light as the motor turns. We will measure the time between
successive blockings of the Photogate by the propeller. Be aware that simply measuring the time
from one beam interruption to the next will not yield an accurate measure for the rotational
period. You must multiply the length of time by the total number of blades on your propeller.
Taking measurements with the Photogate (SensorDAQ)
The SensorDAQ has only one digital port capable of accepting BTD connectors. Since you will
be using this digital port for the DCU, you must monitor the Photogate from the general-purpose
counter/timer on the screw terminal (screw terminal 7) using the DAQ Assistant Express VI.
When the DAQ Assistant (located in the Measurement I/O DAQmx Data Acquisition
palette) is placed on the block diagram, a configuration window appears asking you to select the
type of task. You will be Acquiring a Signal using the Counter Input. For this exercise, you
should choose the Period option.

Figure 4 Configuration window for the DAQ Assistant
DC Motor Control
Engineering Projects with NI LabVIEW and Vernier P5 - 5
Next you must select the channel. If the SensorDAQ is connected to the computer and powered
on, the channel name ctr0 will appear in the configuration window. The final step is to
configure the DAQ Assistant for Period Timing. Use the following to set settings: Starting Edge
is Rising, the Max Signal Input Range is 100 seconds, and the Min Signal Input Range is 100u.
The u is shorthand notation for microseconds.
Taking Measurements with the Photogate (LabQuest interface)
A second Digital Express VI can be used to take measurements with the Photogate if you are
using a LabQuest interface, because all LabQuest interfaces have two digital ports capable of
accepting BTD connectors. You will need to place separate Digital Express VIs on the block
diagram for the DCU and the Photogate. When you place the Digital Express VI on the block
diagram, a configuration window appears. To use the Photogate as a tachometer, select Period
Timing. This will set up the VI to measure the time between successive blockings of the
Photogate. For both Digital Express VIs you must indicate the proper channel number for the
DCU and Photogate.

PROJECT TIPS
1. Remember that the Photogate measures the period in seconds, and that you are asked to
display rotational speed in revolutions per minute (rpm).
2. On the Express VI used for photogate timing, you will see an input terminal labeled Timeout.
This input controls the time that the VI will wait for the timing event. By default, if you do
not wire it, the value is 10 seconds. For this Project and Challenge, we recommend 2
seconds.
3. Avoid using the Abort Execution button to stop your VI, because some of the DCU lines may
remain on.
4. When building devices, you should always keep the power limitations of the DCU in mind.
This limit is 1000 mA total current. Your device should also not exceed the electrical current
limit of the power supply.
5. If you are using a LabQuest interface with an older DCU, you may notice that lines D3 and
D4 stay on, even when your program is not running.
6. Refer to Appendix C for additional information on programming the DCU and the Digital
Express VI.
7. Refer to Appendix E for additional information on the Vernier Photogate and DCU.

PROJECT TROUBLESHOOTING
1. Make sure that only the tip of one propeller blade blocks the Photogate at any one time. The
Photogate must pass from blocked to unblocked and back to blocked in order to measure the
period of revolution accurately. You can use the small red LED on the top of the Photogate
to monitor the status of the gate. The LED will be on when the Photogate is blocked and off
when the Photogate is unblocked.
2. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on.
Project 5
P5 - 6
Engineering Projects with NI LabVIEW and Vernier

3. Double-check the DCU cable connections against the color-coded label attached to the cable.
Make sure you are using the right line for powering the motor.
4. (SensorDAQ) Make sure you are using the same SensorDAQ that was connected to the
computer when you configured the DAQ Assistant. Switching SensorDAQs will cause an
error (#-201003 or -200478) when you run your program. See Appendix F for information on
how to resolve this problem.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Connect the motor directly to the DCU (remove the potentiometer) and write a LabVIEW
program to vary the input voltage to the motor using pulse-width modulation. Your device
should operate like an analog control system allowing the user to adjust the effective voltage
from a front panel control.

CHALLENGE SETUP
Build the motor circuit
1. Remove the potentiometer from the circuit that was set up for the Project.
2. Connect the DC motor to the DCU cable, as shown in the diagram below. Note that if you
are using SensorDAQ, pulses can only be sent from line D1. If you are using a LabQuest
interface, pulses can only be sent from line D4.

Figure 5 Wiring diagram for a pulse-width modulated motor circuit

CHALLENGE BACKGROUND INFORMATION
Another way of varying motor speed when using a digital controller like the DCU is by using a
method called pulse-width modulation (PWM). In PWM, a short pulse, typically 1 to
2 millisecond, pulse is sent from the controller such that the voltage is on for a portion of the
pulse and then off for the remainder of the pulse. When these pulses are sent to the motor at a
high frequency, the average voltage to the motor is reduced and it operates at a slower speed.
The ratio of on time to total time is called the duty cycle. In the example shown below, the
pulse is on for 60% of the time. If the supply voltage is 10 volts, this translates to an effective
voltage of 6 volts.
DC Motor Control
Engineering Projects with NI LabVIEW and Vernier P5 - 7

Figure 6 Pulse-width modulated signal
The Digital Express VI contains an option for Pulse-Train Generation when configuring the
DCU. The input to this Express VI is the duty cycle formatted as a decimal number between 0
and 1.


Project
5
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P5 - 1T
TEACHER INFORMATION
DC Motor Control
In this Project, students are asked to set up a circuit to power a DC motor and build a tachometer
to measure the rotational speed of the motor. Students should use the Vernier Digital Control
Unit (DCU) to power their motors and the Vernier Photogate to measure rotational speed (in
rpm). Encourage your students to develop and test a good working program for the Project
Design Requirements so they can ensure their tachometers are working properly before
attempting the Challenge.

PROJECT CONSTRUCTION TIPS
One tricky part of this Project is finding the proper alignment between the propeller blades and
the arms of the Photogate so that the Photogate detects both a blocked and an unblocked state as
the propeller blades are turned. A small DC fan can be substituted in place of a separate propeller
and DC motor as shown in the photo below.

Figure 1 Close-up of DC motor tachometer with fan

PROJECT PROGRAMMING TIPS
There are a number of ways this Project can be tackled. One suggestion is to divide the Project
Design Requirements into two steps. First, write a LabVIEW program to power the motor using
the DCU. Ignoring any Photogate input at this stage will allow students to ensure their motors
are operating properly and can be voltage-controlled with the potentiometer. Next, modify the
program to measure the rotational speed of the motor using a Vernier. The rotational speed in
revolutions per minute (rpm) should be displayed on the front panel.
Part I Power a DC motor with the DCU
The programming for this portion of the project is fairly straightforward because students are
essentially writing a program for a power switch. The Digital Express VI found in the Vernier
functions palette can be used to control the DCU. When configuring the DCU Timing, the option
for the Lines to Stay On Indefinitely should be selected. On the block diagram, create a constant
Project 5 Teacher Information
P5 - 2T
Engineering Projects with NI LabVIEW and Vernier

to connect to the DCU Pattern input of the Digital Express VI. LabQuest interface users will
send a pattern of 1, since their circuits are wired to DCU line D1; SensorDAQ users send a
pattern of 4, since their circuits are wired to DCU line D3. Be sure to wire the stop (F) and
stopped terminals of the Express VI as shown in the figure below.

Figure 2 Sample program to power a DC motor circuit
on DCU line D3 with a SensorDAQ
Part II Measure the rotational speed of a motor (LabQuest interface)
Because LabQuest interfaces have two digital ports, students can use a second copy of the
Digital Express VI to make measurements with the Photogate. In the configuration window,
Period Timing is selected to capture the time between each successive pass of a propeller blade.
It is also important to select the appropriate channel under Channel Selection.

Figure 3 Configuration window for the Digital Express VI showing Period Timing
The number of propeller blades must be accounted for in the calculations, because a single blade
does not measure a complete period. Therefore, we take one period measurement and multiply it
by the number of blades. In our example program shown below, we used a propeller with
5 blades. The Digital Express VI measures the time in seconds, so we converted the time to
minutes and displayed the inverse in revolutions per minute (rpm). Students may wish to build
their calculations in a Formula Express VI (found in the Express Arithmetic & Comparison)
or save their calculations to a subVI since the same code will be used in the Challenge.
DC Motor Control
Engineering Projects with NI LabVIEW and Vernier P5 - 3T

Figure 4 Sample program to build a tachometer with the LabQuest interface
Note that we set the timeout input on the Digital Express VI to 2 seconds because the default
value of 10 seconds seemed a little long for this application. Be aware that the timeout is the
period of time the Express VI will wait for a period measurement to occur. This means that if the
propeller blade is not moving when the VI is stopped (e.g. the motor speed = 0), there will be a
2 second delay before the program ends.
Also notice that when the Digital Express VI is configured for period timing, there are no
terminals to stop the Express VI or provide feedback that it has been stopped. The absence of
these terminals is a good indicator that the period measurement (or the timeout) must complete
before the VI can move on to the next action. To ensure proper data flow, we wired the Error
Out/In terminals on the two Digital Express VIs together.
Part II Measure the rotational speed of a motor (SensorDAQ)
SensorDAQ users access the second digital connection from the screw terminal, so they use the
DAQ Assistant Express VI to make measurements with the Photogate. The DAQ Assistant
(located in the Measurement I/O DAQmx Data Acquisition palette) is a generic Express VI
designed for many pieces of National Instruments hardware. When the DAQ Assistant is placed
on the block diagram a configuration window appears asking you to designate the type of task.
Select Acquire Signals, and then select Period as the Counter Input.

Figure 5 Configuration window for the DAQ Assistant
Next, you must select the channel. If the SensorDAQ is connected to the computer and powered
on, the channel name ctr0 will appear in the configuration window. The final step is to
configure the settings. The settings should be as follows: Starting Edge is Rising, the Max Signal
Input Range is 100 seconds, and the Min Signal Input Range is 100u. The u is shorthand
notation for microseconds.
Project 5 Teacher Information
P5 - 4T
Engineering Projects with NI LabVIEW and Vernier


Figure 6 Configuration window for Period Setup
After you close the DAQ Assistant, the next step is to calculate the rotational speed. The number
of propeller blades must be accounted for in the calculations, because a single blade does not
measure a complete period. In the example program shown below, we used a propeller with
5 blades. The DAQ Assistant measures the time in seconds, so we converted the time to minutes
and displayed the inverse in units of revolutions per minute (rpm). Students may wish to build
their calculations in a Formula Express VI (found in the Express Arithmetic & Comparison) or
save their calculations to a subVI since the same code will be used in the following two
exercises.

Figure 7 Sample program to build a tachometer with the SensorDAQ
Notice that when the DAQ Assistant is configured for Period Timing, there are no terminals to
stop the Express VI or provide feedback that it has been stopped. The absence of these terminals
is a good indicator that the period measurement (or the timeout) must complete before the VI can
move on to the next action. You must wire the Error Out/In terminals on the two Express VIs
together and then wire an indicator to the Error Out terminal on the DAQ Assistant. Otherwise
you will get an error if the DAQ Assistant times out waiting for a period measurement. The Error
Out indicator does not serve any purpose to the operator, so it can be located off-screen on the
front panel out of view of the user. We also designated 2 seconds as the Timeout input on the
DAQ Assistant. The timeout is the period of time the Express VI will wait for a period
measurement to occur. This means that if the propeller blade is not moving when the VI is
stopped (e.g. the motor speed = 0), there will be a 2-second delay before the program ends.
It is important to note that if you create a VI using the DAQ Assistant with one SensorDAQ, and
then try to use it with a different SensorDAQ, you will get error -201003 or -200478. See
Appendix F for information on how to resolve this problem.
DC Motor Control
Engineering Projects with NI LabVIEW and Vernier P5 - 5T
CHALLENGE CONSTRUCTION TIPS
There are no additional materials required for the Challenge; however, the potentiometer should
be removed from the apparatus, and the motor should be connected directly to the DCU cable.
Be aware that if you are using a SensorDAQ, the DCU can only generate a pulse for devices
connected to line D1. The LabQuest interface can only generate a pulse for devices connected to
line D4.
Note: (SensorDAQ users only) Students may wonder why they can use line D1 in this Challenge
when they were told that they could not use it for the Project. Sending a pulse train on line D1 is
different than sending a DCU pattern. The hardware makes it possible to send a pulse train when
simultaneously using the Photogate on the screw terminals counter/timer. However, the
hardware does not allow sending a DCU pattern when simultaneously using the Photogate on the
screw terminals counter/timer.
CHALLENGE PROGRAMMING TIPS
Control motor speed with pulse-width modulation
In this Challenge, you will still be using the Digital Express VI to send power to the motor, but
the effective voltage will be controlled by pulse-width modulation. You can reconfigure the
Digital Express VI to send a pulse-width modulated signal rather than the full voltage. In the
configuration window, you should select Pulse-Train Generation, and set the frequency to 50 Hz.
The Duty Cycle can be left at its default value, because you will be wiring a front panel control
to this input.
Note: The hardware allows continuous updates to the duty cycle. It does not allow continuous
updates to the frequency.

Figure 8 Configuration window for Pulse-Train Generation
The modified program is shown in the figures below. A Dial or Slider works well for quick
changes to the Duty Cycle.
Project 5 Teacher Information
P5 - 6T
Engineering Projects with NI LabVIEW and Vernier


Figure 9 Sample program to control motor speed with PWM using a SensorDAQ


Figure 10 Sample program to control motor speed with PWM using a LabQuest interface

EXTENSIONS
1. Create a motor controller that will allow you to reverse the direction of the motor from a
front panel control. Note: If you wire the motor between D1 and D2, the motor will switch
direction depending on which line is high.
2. LabQuest interface users only: Create a motor controller that can run at three distinct speeds:
high, medium, and low. Continue to use the DCU to power the motor and the Photogate to
measure speed, but revise your motor circuit to include two resistors and two diodes as
shown below.

Figure 11 Wiring diagram for resistor/diode-controlled motor circuit
Sending power through the resistors either singly or in pairs creates three distinct voltage
DC Motor Control
Engineering Projects with NI LabVIEW and Vernier P5 - 7T
drops across the motor, which change the speed of the motor. Referring to the circuit diagram
above, you can see that the resistors are wired in parallel. When resistors are wired in
parallel, their equivalent resistance will always be smaller than the value of any single
resistor. The equivalent resistance for a parallel circuit using two resistors is given by:
2 1
2 1
R R
R R
R
eq


Since resistance is inversely proportional to motor speed, the smaller the resistance, the faster
the motor will spin. You will need to send several different output patterns to the Digital
Express VI to control the speed of your motor. Turn on DCU line D1 for one speed, turn on
line D2 for a second speed, and turn on both lines at once for a third speed.
Notice we have added two diodes to the circuit. A diode is an electrical component that
restricts current flow to one direction only. Both DCU lines D1 and D2 are connected to the
same side of the motor. If we sent one DCU line high, while the other DCU line is low, then
the current could simply flow in a short circuit from one line to the other, bypassing the
motor. Diodes allow us to overcome this problem.
Note: (SensorDAQ users only) When a Photogate is connected to the screw terminals of the
SensorDAQ, the DCU patterns are limited, so you cannot do this extension with SensorDAQ.
3. Write a LabVIEW program that will allow you to control two motors at once. The operator
should have independent control of each motors direction from front panel controls.
4. Power the DC motor with a Vernier Power Amplifier and control the rate at which the shaft
of the motor turns with a variable voltage control placed on the front panel of your LabVIEW
VI. The Power Amplifier has the ability to output a continuously varying voltage, and allows
you to drive sufficient current to run motors. The Power Amp Express VI (found on the
Vernier functions palette) should be used when writing your LabVIEW program. If you are
using the LabQuest interface, you should select the DC signal for the output waveform to
ensure your motor runs smoothly. The SensorDAQ interface sends a DC signal by default.
If you are using the SensorDAQ interface, you must connect the port on the Power Amplifier
labeled Audio Input LP to the Analog Output and ground terminals on the screw terminal
(connectors 9 and 10). You can wire a Vernier Analog Proto Board Connector to the screw
terminal, and then use a BTA cable to make your connections. If you are using a LabQuest
interface, you must connect the Audio In port on the Power Amplifier to the Audio Out
port on the side of the LabQuest. Note: The LabQuest Mini cannot be used for this extension,
because it does not have the ability to output a voltage signal.
5. Calculate the power consumption of the DC motor with a Vernier Current Probe and a
Vernier Voltage Probe when using the Power Amplifier as the control source using the
following
power = current x voltage


Project
6
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P6 - 1
Light Intensity & Stepper Motors

Light is an electromagnetic wave composed of alternating electric and magnetic fields. Light
sources, such as flashlights, emit electromagnetic waves with electric fields that oscillate in all
different directions. This type of light is called unpolarized light. There are multiple ways of
separating out light whose electric fields have the same plane of oscillation. The most common
way is to use polarizing filters. Polarizing filters are plastic sheets that have many aligned, long-
chain molecules embedded in them. When unpolarized light passes through these sheets, only the
light with electric fields that are parallel to the long-chain molecules are able to pass through.
Almost all other electromagnetic waves will be absorbed by the sheets. The filtered light that
passes through is said to be polarized. When two polarizing filters are stacked in alignment, they
transmit almost as much light as a single filter. However, as one polarizing filter is rotated
relative to the other, less light passes through, and the intensity of light decreases. When one
polarizing filter is rotated until it is perpendicular to the other, very little light will pass through.

PROJECT DESIGN REQUIREMENTS
Build a device to rotate a polarizing filter using a stepper motor and the Vernier Digital Control
Unit (DCU), and then write a LabVIEW program to graphically display the light intensity from a
Vernier Light Sensor as the filter rotates through 360. Your Waveform Chart should be scaled
appropriately to display the entire range of light intensity for your apparatus. Place a control on
the front panel to allow the user to vary the speed of the rotating filter.

MATERIALS
SensorDAQ or LabQuest interface Vernier Digital Control Unit (DCU)
LabVIEW LabQuest or LabPro power supply
computer stepper motor
USB cable small light bulb and bulb socket
Vernier Light Sensor support structure
two polarizing filters (approx 5 cm diameter)

Project 6
P6 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT SETUP
Build a rotating device to measure light intensity
1. Secure one polarizing filter to the shaft of a stepper motor.
2. Set up the apparatus as shown in the figure below. All components are stationary, except for
the rotating filter.

Figure 1 Light intensity apparatus
Tip: The two filters should be close, but do not need to be touching. You can allow a centimeter
between them to accommodate any mounting hardware.
3. Align the center of the light bulb directly in front of the Light Sensor detector. The two
polarizing filters should be between the Light Sensor and the filters.
Wire the stepper motor and light bulb to the DCU
1. Plug the 9-pin cable into the socket on the side of the DCU.
2. Refer to the diagrams below, which symbolically show how bipolar and unipolar stepper
motors are internally wired. Wire your stepper motor to the DCU cable using the appropriate
pattern.
Tip: If you do not have a wiring diagram for your stepper motor, you can use a resistance meter
to determine which wires are paired together. Two wires that form a motor coil will have a few
ohms of resistance.
Light Intensity & Stepper Motors
Engineering Projects with NI LabVIEW and Vernier P6 - 3

Figure 2 Bipolar stepper motor connection to a DCU

Figure 3 Unipolar stepper motor connection to a DCU
4. Wire the two leads of the light bulb holder to the power (+) terminal and either ground (G)
terminal.
Tip: The light bulb does not have polarity, so you can connect the leads in any order.
Connect the DCU and Light Sensor to the interface
1. Connect the DCU to the DIG port on the interface.
2. Connect a power supply to the DCU.
3. Connect the Vernier Light Sensor to Channel 1 of the interface.
4. Set the switch on the Light Sensor to the 0600 lux range.
5. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.

Project 6
P6 - 4
Engineering Projects with NI LabVIEW and Vernier

PROJECT BACKGROUND INFORMATION
In this Project, you are asked to use a stepper motor to turn a polarizing filter. A stepper motor is
a motor that rotates in discrete (individual) steps rather than with continuous movement. It is
used in cases where exact control and positioning of a motion are required. Examples include the
positioning of the laser in a CD-ROM player or the head on a computers disk drive.
There are basically two types of stepper motors that you may want to use: unipolar and bipolar.
You can identify which type you have with these guidelines:
Bipolar stepper motors have 4 lead wires.
Unipolar stepper motors have more than 4 wires (usually 5, 6, or 8).

Identifying the leads on a stepper motor can be tricky. It helps if you have a diagram provided by
the manufacturer, but often you will be using a surplus stepper motor and will need to identify
the leads yourself. First, determine which type of stepper motor you have (bipolar or unipolar).
Next, look for patterns by examining the wires carefully. Use a meter to measure resistance. Two
wires that form a motor coil will have a few ohms of resistance.
Once your motor is receiving power, you will need to determine how many steps it takes for one
complete revolution, either by referring to the manufacturers data or by counting the steps as the
motor turns. Then, calculate the turn rate in degrees per step (360 = 1 revolution). Both of these
values will be helpful in controlling the speed and position of your stepper motor.
Tip: The stepper motor used in the figures above is a unipolar, permanent-magnet type. It has six
wires and performs 48 steps per revolution, or 7.5 degrees per step.
You can use a Vernier Digital Control Unit (DCU) to run the stepper motor as well as power the
light bulb. The DCU is an electronic device that allows you to control up to six digital output
lines for on/off control of motors, lamps, and other DC electrical components. The DCU plugs
into the DIG port on the interface and is powered by a separate DC power supply. A 9-pin, D-
sub socket cable with bare wires on one end is supplied with the DCU for use in building
projects. There are connections for all six digital lines, plus a power connection and two ground
connections. The color code of the wires is identified on a label attached to the cable. Since the
light bulb needs to be on all the time, connect it to the + and ground lines of the DCU.
The Digital Express VI can be used to send a pattern of on/off signals to the DCU to activate the
electromagnets inside the stepper motor. This Express VI uses the Normal method for stepper
motor rotation as the default, in which the electromagnets inside the motor are always turned on
two at a time as the motor steps through a pattern (5,9,10,6 for clockwise and 6,10,9,5 for
counterclockwise). If required, this output pattern can be modified by changing the DCU Pattern
Array values in the configuration window. You have the option to create front panel controls for
the Number of Steps, Step Speed, and the turning Direction, or to set these parameters as
constants in the configuration window. Notice that the Step Speed is actually the duration of
each step in milliseconds, so entering a smaller number will make the motor turn faster.
Light Intensity & Stepper Motors
Engineering Projects with NI LabVIEW and Vernier P6 - 5

Figure 4 Digital Express VI configuration window for controlling a stepper motor
The Analog Express VI (found in the Vernier functions palette) can be used to collect light
intensity data with the Vernier Light Sensor. When the Analog and Digital Express VIs are used
together in the same loop, make sure they are connected together so that they operate
sequentially. If there are no stop (F) and stopped terminals to connect, as is the case with
this program, use the Error In and Error Out terminals. The correct order of operation is to
collect a data point with the Analog Express VI, plot it, and then turn the stepper motor with the
Digital Express VI.

PROJECT TIPS
1. For smoother plots, set the Number of Steps in the Digital Express VI to 1 (the default value
is 6), because the loop will wait until the motor has turned the designated Number of Steps
before moving on to collect the next data point.
2. Note the Sampling Rate that you set for the Light Sensor with the Analog Express VI. Now
make sure that the Step Speed setting for your motor in the Digital Express VI is fast enough
that it does not interfere. For example, if you are collecting 1 sample/second with the Light
Sensor, the Step Speed of the motor should be less than 1 second.
3. The standard unit for measuring light intensity, as perceived by the human eye, is the lux.
Everything that the eye can see gives off a certain amount of light that can be measured in
lux. A full moon near the equator measures about one lux while direct sunlight can measure
well over 100,000 lux. The Light Sensor has three different settings corresponding to
different ranges of measured light. Pick the setting that is most appropriate to the range of
measured light that you will be working in. For small bulbs, the 0600 lux range is probably
appropriate.
4. A good data-collection rate for the Light Sensor is 10 samples per second.
5. The Analog Express VI collects data for a fixed amount of time. For an indefinite data
collection length, select the Repeat option in the Analog Express VIs Set Timing
configuration window.
6. No matter what type of stepper motor you have, it must match the voltage you are using on
your DCU power supply.
Project 6
P6 - 6
Engineering Projects with NI LabVIEW and Vernier

7. The Light Sensor must be positioned so the light passes through both polarizing filters at the
same time, even when one of the filters is turning.
8. Avoid using the Abort Execution button to stop your VI, because some of the DCU lines may
remain on.
9. Since the light bulb is connected directly to the power source, it will remain on whenever the
DCU is receiving power.
10. Be aware that ambient light will affect the Light Sensor. You may need to shield your
apparatus from outside light sources.
11. Refer to Appendix C for additional information on programming the DCU, and the Digital
and Analog Express VIs.
12. Refer to Appendix E for additional information on the Light Sensor and DCU.

PROJECT TROUBLESHOOTING
1. If your light intensity graph is not smooth, make sure the Number of Steps is set to 1 in the
Digital Express VI configuration window, and that your Step Speed is not limiting the speed
of data collection.
2. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on.
3. Double-check the DCU cable connections against the color-coded label attached to the cable.
4. Make sure the stepper motor is wired to the DCU correctly.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Modify your Project program so that your device will automatically rotate the polarizing filter to
a specific light intensity defined by the user. You will need to add a light intensity control to the
front panel that is scaled to match your Waveform Chart.

CHALLENGE TIP
It is almost impossible for your system to rotate to an exact light intensity due to reflection off
the filters, ambient room light, etc. You can see this by watching the output from the Light
Sensor fluctuate while the filters are stationary. To help your program rotate to the desired
setting, consider adding a buffer region of 35 lux around the user-defined light intensity.

Project
6
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P6 - 1T
TEACHER INFORMATION
Light Intensity & Stepper Motors
Before having students start this Project, you should probably have them connect a stepper motor to
the DCU and write a simple VI to make it rotate. Once they have the stepper motor running, they
can build the apparatus with the rotating polarizer and the light source. The same apparatus is used
for both the Project and the Challenge.

PROJECT CONSTRUCTION TIPS
A metal construction kit that allows a degree of flexibility in positioning and securing the different
elements works well for this Project. In the figure below, the Light Sensor was positioned between
the stepper motor and the polarizing filter. The filter was connected to the motor shaft by a long,
lightweight rod.

Figure 1 Close-up of Light Sensor between motor and filters
Another option is to place the Light Sensor and stepper motor side-by-side, as shown below (and in
Figure 2 of the student handout). This has the advantage of attaching the polarizing filter directly to
the motor shaft. The important thing to remember is that the center of the light bulb should be
aligned directly in front of the Light Sensor with the two polarizing filters between them. The Light
Sensor does not need to be located in the center of the filters; it can be offset. Notice that the support
structure in the photo below is a recycled plastic container.

Figure 2 Close-up of another apparatus
Project 6 Teacher Information
P6 - 2T
Engineering Projects with NI LabVIEW and Vernier

PROJECT PROGRAMMING TIPS
There are a number of ways this Project can be tackled. One suggestion is to divide the Project
Design Requirements into two steps. First, write a LabVIEW program to rotate the stepper motor.
The front panel should include a control so that students can experiment with motor speed. Next,
modify the program to read and display data from a Vernier Light Sensor. The Waveform Chart
should be scaled to display the complete range of light intensity data for at least one complete
revolution.
Part I Rotate a stepper motor
After students build their devices, they will need to write a LabVIEW program to rotate the stepper
motor. The Digital Express VI found in the Vernier functions palette can be used to control a
stepper motor connected to the DCU. The Project Design Requirements state that the user should be
able to control the speed of the motor. When the Digital Express VI is placed on the block diagram,
a configuration window appears. When Control Stepper Motor is selected as the Device Selection,
an interactive picture of a stepper motor appears with several setup parameters, including Step
Speed. The Step Speed is actually a time measurement. It specifies how long (in milliseconds) a
motor will wait before making the next step; therefore, a lower number will result in a faster turn
speed. Be aware that, while the motors step size (in degrees per step) is a feature of the motor and
cannot be adjusted by the user, the motors step size will affect the motors apparent speed.

Figure 3 Sample program for turning a stepper motor
Part II Read and display light intensity data
When programming the first part of this Project to rotate the shaft of the stepper motor, it did not
matter what value you set for the Number of Steps. However, it does matter when you add the
Analog Express VI to collect data from the Light Sensor. The idea for this program is to move the
filter and measure how this affects the light intensity. Therefore, for best results, the motor should
only make a single step with each iteration of the While Loop. In addition, this step must occur fast
enough that the Light Sensor data-collection rate is not compromised (i.e., do not have a slow Step
Speed and a fast Light Sensor data-collection rate).
Setting the Number of Steps to 1 is recommended. However, there might be situations where
performing a single step with each iteration of the loop is not fast enough (even with a small Step
Speed). In this case, you may want to speed up the rotation by setting the Number of Steps to more
than one. The trade off is that you will reduce the number of light intensity readings per rotation.
Light Intensity & Stepper Motors
Engineering Projects with NI LabVIEW and Vernier P6 - 3T

Figure 4 Sample program to display the light intensity of a rotating filter
Tip: Adding a History property node to clear the Waveform Chart at the beginning of the program
will aid the user when analyzing repeated trials. You can create this property node by right-clicking
the Waveform Chart and selecting Create Property Node History Data. Since the default
configuration for the History Data Property Node is a Read output terminal, you must right-click on
the property node after you place it on the block diagram and select Change All To Write. Right-
click the property node a second time and create a constant. An empty array input will clear the
chart. The History property node should be placed outside the While loop.
To ensure that the two Express VIs operate sequentially, wire the Error Out terminal of the Analog
Express VI to the Error In terminal of the Digital Express VI. This will control the flow of the
program. If they are not wired they will run at the same time, which will cause an error with the
hardware and the program. To configure the Analog Express VIs Set Timing options for an
undefined experiment length, select Repeat. This will allow data collection to continue indefinitely.
Note: The Averaging function should remain checked if you are using the SensorDAQ interface.
Averaging is not an option with the LabQuest interface, because it is done automatically in the
interface firmware.

Figure 5 Analog Express VI Data Collection configuration window

CHALLENGE CONSTRUCTION TIPS
There is no additional construction required for the Challenge.
Project 6 Teacher Information
P6 - 4T
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE PROGRAMMING TIPS
Rotate a polarizing filter to a specific light intensity
This Challenge will require some logic to go with the Desired Intensity user control on the front
panel. Due to ambient light in the room, reflection off the filters, and other environmental
conditions, the Light Sensor most likely will not be able to detect the exact value specified by the
user. One way to deal with this is to add a buffer region of 35 lux around the Desired Intensity
value (we used a buffer of 5 in the sample program below). If the sensor reading falls within this
range (the True Case), the program takes no action (the motor does not turn), signifying that the
filter is in the correct position. If the sensor reading is outside of this range (the False Case), the
stepper motor continues to rotate.

Figure 6 Sample program to rotate a polarizing filter to a specific light intensity
Encourage your students to explore more efficient ways to tackle this Challenge. For example, the
method described above always rotates in the same direction, even if the desired alignment is just a
few steps back. The Digital Express VI includes programmable parameters for turn Direction and
Number of Steps.

EXTENSIONS
1. There are a few modifications you can make to the Project to make it more user friendly. You
can allow the user to specify whether the motor rotates clockwise or counterclockwise, you can
calculate and display the angle of rotation on the graph (instead of just time) as the motor turns
(in degrees per step), or you can add a control to allow the user to rotate the filter a specified
number of degrees.
2. Determine the mathematical relationship between light intensity and the angle between the
rotating filters. Investigate how your data matches the theory on this (the Law of Malus).
3. Polarized sunglasses selectively remove glare caused by light reflected by horizontal surfaces
(for example, the hood of a car or a wet highway). For polarized sunglasses to be most effective,
the glare must be polarized. Devise an experiment to measure how strongly polarized the glare is
compared to light from the sun or a flashlight. You will need a smooth horizontal surface to
create glare, a bright light source, a polarizing filter, a Vernier Light Sensor, and an interface.
Determine the orientation of the polarizing filter when the glare is minimized.
Light Intensity & Stepper Motors
Engineering Projects with NI LabVIEW and Vernier P6 - 5T
4. Use the Challenge code to specify a light intensity and then change the ambient light level to see
if if your device will rotate to the same position as before.
5. You have probably noticed that a light appears to be brighter when you are close to it and
dimmer when you are farther away. Modify your apparatus to allow you to investigate the
relationship between light intensity and the distance between the light source and the sensor.
Remove the polarizing filters, and then build a conveyor belt, powered by your stepper motor, to
slowly pull the Light Sensor away from the lamp. It is extremely important that the sensor and
lamp stay aligned during movement and data collection. (Students will probably expect an
inverse square relationship, but they will not get that unless they are very careful about using a
point source of light.)

Project
7
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P7 - 1
Servo Motors
Servos are small, relatively inexpensive motors known for their ability to provide a large torque
or turning force. They draw current proportional to the mechanical load, which means the
heavier the load, the larger the current draw. Servo motors are controlled by pulse-width
modulation or PWM. In PWM, the shaft of the motor is oriented to specific angular positions
within about a 90 range by sending the servo a square wave voltage pattern. The length of time
that the square wave is at the high voltage controls the shaft position. The servo motor will hold
its position firmly as long as the square wave continues. A servo horn or arm is often attached to
the shaft of the motor to convert the motors rotational motion to linear motion.
Servo motors are used in small-scale robotics applications, in rack and pinion steering, and in
radio-controlled models to adjust the flaps on a plane or the rudder of a boat. While servo motors
can be used for steering, they are not normally used for driving the wheels of a car, because they
cannot continuously rotate without internal modification.

Figure 1 Setup for the Challenge for this chapter.

PROJECT DESIGN REQUIREMENTS
In this Project, you will investigate the principle of pulse-width modulation by writing a
LabVIEW program to control the position of a servo motor. You will use the Vernier Digital
Control Unit (DCU) to provide a square-wave signal. Your program should allow the user to
vary the motor position from a front panel control for its full range of motion (approximately
90).

MATERIALS
SensorDAQ or LabQuest interface Vernier Digital Control Unit (DCU)
LabVIEW LabQuest or LabPro power supply
computer servo motor
USB cable servo horn


Project 7
P7 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT SETUP
Connect the motor to the DCU (SensorDAQ)
1. Wire the servo motor to the DCU 9-pin cable as shown in the diagram below.

Figure 2 Servo motor wiring diagram for a SensorDAQ
2. Connect the DCU to the DIG port on the interface.
Connect the motor to the DCU (LabQuest interface)
1. Wire the servo motor to the DCU 9-pin cable, as shown in the diagram below.

Figure 3 Servo motor wiring diagram for a LabQuest interface
2. Connect the DCU to the DIG1 port on the interface.
Set up the equipment
1. Plug the DCU cable into the 9-pin socket on the side of the DCU.
2. Connect a power supply to the DCU.
3. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
4. Mount a servo horn to the shaft of your motor.

PROJECT BACKGROUND INFORMATION
Servo motors have three wires: ground (usually black), power (usually red), and input signal
(usually white or yellow). Small servos, which are frequently used for hobbies or small projects,
operate between 4.8 and 6 volts. This allows the power line of the servo motor to be connected to
the DCUs +5V terminal if powered by a LabQuest or LabPro power supply.
Servo Motors
Engineering Projects with NI LabVIEW and Vernier P7 - 3
The output shaft of a standard servo motor is limited to turns within a 90 range, with the exact
location determined by the duration, or width, of a square-wave pulse sent to the input signal
line. Servo motor square-wave pulses usually have widths between 0.5 to 2.5 milliseconds, as
shown in the figure below. If the high voltage lasts 1.5 milliseconds, for example, it causes the
servo to move to 0 degreesalso known as the neutral position.

Figure 4 Pulse width/degree correlation for a servo motor
In order for a servo to hold its position, pulses must be sent continuously at a rate of about one
every 20 milliseconds (50 Hz).

Figure 5 Pulse train for a servo motor held at the neutral position
As long as the pulse width of the pulse train remains constant, the servo will hold its position. If
the pulse width is modified, the servo will rotate to, and hold, the new position until the signal is
changed or the program is stopped. As before, the duration of the high voltage part of the pulse
train controls the servo motor position.
The Digital Express VI, located in the Vernier functions palette, can automatically generate the
pulse train to control a servo motor. Place the Digital Express VI on the block diagram and a
configuration window will appear. Under Device Selection, choose Control Servo Motor under
the DCU listings. The configuration window is now customized for servo motors. You can test
your servo motor within the configuration window by setting the Position (degrees) control and
clicking the Run button. This will briefly move the servo motor to this position. You should not
have to modify the Servo Pulse-Width Parameters; they have been set to match the most
commonly used servo motors. Consult your manufacturers specifications before making
modifications.
The Digital Express VI has an input terminal where you can wire a control for servo motor
position. Place the Express VI in a loop for continuous operation.

PROJECT TIPS
1. Placing a white mark on the tip of the servo horn will help you see its rotation.
Project 7
P7 - 4
Engineering Projects with NI LabVIEW and Vernier

2. Refer to Appendix C for additional information on programming the DCU and the Digital
Express VI.
3. Refer to Appendix E for additional information on the Vernier DCU.

PROJECT TROUBLESHOOTING
1. If your servo motors appear to have a slightly greater range than 180, the Vernier Digital
Express VI requires that angles be limited to 90.
2. The servo motors input signal line must be wired to DCU line D1 if you are using a
SensorDAQ or line D4 if you are using a LabQuest interface.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Build a motorized track and fulcrum to automatically roll a small ball back and forth. Mount a
Photogate at the midpoint of your track to detect the presence of the ball as it passes the
midpoint. Your LabVIEW program should cause a servo motor to raise and lower one end of the
track so that the ball can pass through the arms of the gate. When the Photogate detects the ball,
it should signal the servo motor to reverse the incline of the track.

ADDITIONAL MATERIALS
Vernier Photogate small ball
support structure for track


ADDITIONAL MATERIALS (SENSORDAQ ONLY)
Vernier Digital Proto Board Connector jumper wires
breadboard


CHALLENGE SETUP
Build a motorized track to roll a ball back and forth
1. Build a shallow track at least a half meter in length that will allow a ball to roll freely along
the length. The longer the track, the easier the Challenge will be.
2. Position the servo motor at one end of the track. Mount the servo horn to the end of the track
so that the track will raise and lower as the servo turns.
3. Mount the Photogate in the center and just above the track so that as the ball rolls along the
track, it will pass through and block the beam on the Photogate.
Connect the Photogate to the interface (SensorDAQ)
1. Insert a Vernier Digital Proto Board Connector into a breadboard.
Servo Motors
Engineering Projects with NI LabVIEW and Vernier P7 - 5
2. Wire the Digital Proto Board Connector to the SensorDAQ screw terminal using jumper
wires as shown in the figure below.

Figure 6 Digital Proto Board Connector pin-out to SensorDAQ screw terminal
3. Connect the Photogate to the Digital Proto Board Connector.
Connect the Photogate to the interface (LabQuest)
1. Connect the Photogate to DIG 2 on the interface.

CHALLENGE BACKGROUND INFORMATION
In this Challenge, you are asked to use a Photogate to detect when the ball has rolled past the
midpoint on the track. The Vernier Photogate is an electronic sensor that sends a beam of light
between the two arms of the gate. When this light beam is blocked, the voltage from the
photogate changes.
Monitoring the Photogate (SensorDAQ)
Because there is only one DIG port on the SensorDAQ, you must monitor these blocked and
unblocked transitions from the general-purpose counter/timer on the screw terminal (screw
terminal 7) using the DAQ Assistant Express VI. When the DAQ Assistant (located in the
Measurement I/O DAQmx Data Acquisition palette) is placed on the block diagram a
configuration window appears asking you to select the type of task. You will be Acquiring a
Signal using the Counter Input. For this Challenge, you should choose the Pulse Width option.

Figure 7 Configuration window for the DAQ Assistant
Project 7
P7 - 6
Engineering Projects with NI LabVIEW and Vernier

Next, you must select the channel. If the SensorDAQ is connected to the computer and powered
on, the channel name ctr0 appears in the configuration window. The final step is to configure
the Pulse Width parameters in the DAQ Assistant. The Starting Edge is Falling, the Max Signal
Input Range is 1 second, and the Min Signal Input Range is 100m. The m is shorthand for
milliseconds.
Monitoring the Photogate (LabQuest interface)
Since all LabQuest interfaces have two digital ports, you can monitor the Photogate with a
second Digital Express VI. In the configuration window, select Continuous Counting under the
Photogate options. A count occurs every time the Photogate goes from a blocked to an
unblocked state. After closing the configuration window, you must place the Express VI in a
loop for continuous counting. Counting will continue, without interruption, until the user stops
the Express VI.

CHALLENGE TIPS
1. Consider the weight of your building materials when designing your track, and keep the
power limitations of the DCU in mind. You should not exceed 1000 mA total. In general,
you will not damage the DCU by trying to draw too much current, but your servo motor may
not be able to lift and hold the track in the desired position if it is too heavy.
2. Control the flow of your program by wiring together the Error Out and Error In terminals of
the two Express VIs.
3. Small elevation changes will give you greater control of the ball and prevent it from rolling
off the track.
4. Refer to Appendix E for additional information on the Vernier Photogate and Digital Proto
Board Connector.

CHALLENGE TROUBLESHOOTING
1. If you are using SensorDAQ and get the error message Error -200474 occurred at DAQmx,
it simply means that the program timed out while waiting for the Photogate to be blocked.
The DAQ Assistant Express VI, which is used to check the status of the photogate, has a
terminal labeled Timeout. By default, the Timeout value is 10 seconds. This means that if
you do not block the Photogate within 10 seconds, you will get the error message. You can
change the Timeout to make it longer, or you can set it to -1, which specifies no timeout
period. The drawback to setting the timeout to -1 is that when you try to stop your VI from
executing, it may not stop normally until you block the Photogate. You may even have to
block the Photogate several times.
2. If you are using SensorDAQ, check the Pulse-Width Parameters in the DAQ Assistant:
Starting Edge = Falling; Max Signal Input Range = 1 second; Min Signal Input Range =
100m. The m is shorthand notation for milliseconds.
3. Make sure you are using the same SensorDAQ that was connected to the computer when you
configured the DAQ Assistant. Switching SensorDAQs will cause an error (#-201003 or
-200478) when you run your program. See Appendix F for information about how to resolve
this problem.
Project
7
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P7 - 1T
TEACHER INFORMATION
Servo Motors
In this book we introduce students to three common motor types: DC, stepper, and servo. Each type
has advantages in different situations. This chapter focuses on the servo motor. Servo motors work
well when you want a lot of torque and the ability to hold a position against resistance.
Encourage your students to develop and test a good working program for the Project Design
Requirements to ensure their servo motors are working properly before attempting the Challenge.
The front panel should provide the user with a properly scaled angle control. Even though your
servo motor may appear to have a slightly greater range, the Digital Express VI cannot handle
angles outside 90. Students who are continuing with the Challenge should do a little
experimentation to determine the appropriate high and low angle values to use when building their
tracks.

PROJECT CONSTRUCTION TIPS
Students should attach a servo horn to the shaft of the motor. Any shape will work, but students
might want to place a contrasting-colored mark at some point along the horn to make it easier to
distinguish movement. No support structure is required for this Project; the motor can simply be
placed in an upright position on any flat surface.

Figure 1 Servo horn on motor

PROJECT PROGRAMMING TIPS
Send a pulse train to a servo motor
For this Project, you can use the Digital Express VI found in the Vernier functions palette to send a
pulse train to the servo motor. When you place the Digital Express VI on the block diagram, a
configuration window appears and you should select the Control Servo Motor option under DCU.
The controls under Servo Pulse-Width Parameters are default values that should not be adjusted
unless your particular servo motor has different specifications (as provided by the manufacturer).
Project 7 Teacher Information
P7 - 2T
Engineering Projects with NI LabVIEW and Vernier

You can test your servo motor within the configuration window by setting the Position (degrees)
control and clicking the Run button. The servo will briefly move to this set position.

Figure 2 Configuration window for the Digital Express VI
The Digital Express VI must be placed in a While Loop when you are controlling a servo motor,
because the pulse train must be sent continuously to maintain the desired position. Your program
should allow the user to modify the servo position from a front panel control, with a range limited to
90. A Dial or Slide works well for fast changes. Be aware that both the stop (F) and stopped
terminals on the Digital Express VI must be wired as shown below to stop the Express VI prior to
ending the program.

Figure 3 Sample program for controlling the position of a servo motor

CHALLENGE CONSTRUCTION TIPS
A small metal construction kit that allows a degree of flexibility in positioning and securing the
different elements works well for this project. In the figure below, a length of channel was used for
the ball track, and a second channel provides a stable base for the support structure. Both the servo
motor and Photogate are attached to the base. The Photogate is centered just above the track so that
a ball can pass through the arms of the gate. The right side of the track is connected to the base at a
pivot point, while the left side of the track is supported by a small cross bar mounted to the servo
Servo Motors
Engineering Projects with NI LabVIEW and Vernier P7 - 3T
motor horn. Rotating the servo horn will cause the track to tilt up or down, and the ball to pass back
and forth through the Photogate.

Figure 4 Close-up of the support structure for the servo motor and Photogate
To make the Challenge easier, have the students use a longer track. This makes the system much
more forgiving on timing and angle adjustments.
Another way to build a device for this Challenge is to use a toy monkey on a unicycle designed to
move along a string. Fix one end of the string and then have the servo motor raise and lower the
other end so that the clown moves back and forth, blocking the Photogate as it travels. Since the
string will sag, the clown will automatically slow down as it approaches the other end of the string.
You can probably make this version operate based on time, with no Photogate (see Figure 5).

Figure 5 Monkey on a unicycle version of the Challenge

Project 7 Teacher Information
P7 - 4T
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE PROGRAMMING TIPS
Since the programming for this Challenge can be somewhat tricky, you may wish to break it into
two parts. First, modify your LabVIEW program to switch the track elevation between a high and
low state with a front panel Boolean control; ignore any Photogate input at this point. This allows
you to adjust your angle values so that you keep good control of the ball. Next, add the Express VI
to use the Photogate as an event trigger.
Raise and lower a track with the servo motor
One suggestion for raising and lowering the track is to use a Select function to send either an upper
or a lower angle value to the Digital Express VI, as shown in the sample program below. At this
stage, the value that is sent can be controlled with a simple Boolean front panel control. Even
though we did some preliminary testing to determine acceptable angle values, we programmed them
as front panel controls to allow the user to make slight modifications.

Figure 6 Program to raise and lower a track
Use the Photogate as an event trigger (SensorDAQ)
Since there is only one DIG port on the SensorDAQ, the Photogate must be controlled from the
screw terminal using the DAQ Assistant Express VI. When the DAQ Assistant (located in the
Measurement I/O DAQmx Data Acquisition palette) is placed on the block diagram, a
configuration window appears asking you to select the type of task. You will be Acquiring a Signal
using the Counter Input on the SensorDAQ screw terminal. For this Challenge, choose the Pulse
Width option.
Servo Motors
Engineering Projects with NI LabVIEW and Vernier P7 - 5T

Figure 7 Configuration window for the DAQ Assistant
Next, you must select the channel. If the SensorDAQ is connected to the computer, the channel
name (ctr0) will appear in the configuration window.

Figure 8 Configuring the counter terminal on the SensorDAQ
Project 7 Teacher Information
P7 - 6T
Engineering Projects with NI LabVIEW and Vernier

The final step is to set the Pulse-Width Parameters. The Starting Edge is Falling, the Max Signal
Input Range is 1 second, and the Min Signal Input Range is 100m. The m is shorthand notation
for milliseconds.

Figure 9 Configuring the Pulse Width parameters in the DAQ Assistant
In the final program, shown below, we changed the Boolean control to a Boolean constant and
placed it outside the While Loop to initialize the shift register. This program is written to start with
the ball on the high side first. When the program starts, the first Express VI that is called is the DAQ
Assistant. The program waits until the pulse width is read by the DAQ Assistant (the ball rolls
through the Photogate). At that point the program flows to the Digital Express VI, where the lower
angle value is sent to the servo motor, lowering the track and causing the ball to roll back the other
way. A Not function changes the Boolean value and a Shift register on the While Loops border
sends this new value to the next iteration of the loop. On the second loop iteration, the DAQ
Assistant once again waits for the pulse to occur (the ball to roll back through). When it occurs, the
upper angle value is sent to the servo, raising the track and causing the ball to roll back once again.
Your program will continue operating in this manner until the user clicks the Stop button. Note that
on the VI shown below, we have the Timeout parameter on the DAQ Assistant set to -1. This means
that there is no timeout; the DAQ Assistant will wait indefinitely for a Photogate to be blocked. It
also means that if you try to stop the VI, you may have to block the Photogate a couple times before
the program will stop running.
Servo Motors
Engineering Projects with NI LabVIEW and Vernier P7 - 7T

Figure 10 Sample program for the Challenge using a SensorDAQ
Note that problems can develop when students switch SensorDAQ units. If they create a VI using
the DAQ Assistant with one SensorDAQ, and then try to use it with a different SensorDAQ, they
will get error -201003 or -200478. See Appendix F for information about how to resolve this
problem.
Use the Photogate as an event trigger (LabQuest interface)
There are two DIG ports on all LabQuest interfaces, so the Photogate can be controlled with a
second Digital Express VI. Students should select the Continuous Counting Photogate option in the
configuration window. The Count Interval can be ignored if students use the value of the Total
Count in their logic. An example is shown below. Every time the ball passes through the Photogate,
it will update the Total Count. We used the Quotient & Remainder function (found in Programming
Numeric) as a trigger to rotate the servo motor horn, thereby raising or lowering our ball track.

Figure 11 Sample program for the Challenge using a LabQuest interface

Project 7 Teacher Information
P7 - 8T
Engineering Projects with NI LabVIEW and Vernier

EXTENSIONS
1. Try using other Vernier analog sensors to build elaborate control systems. For example, use a
servo motor to open a vent on a model greenhouse if the temperature reading gets too hot. Use
an Accelerometer to keep the platform level (as the platform shifts, the servo motor rotates the
platform to keep it level). Another example would be using a Light Sensor reading paired with a
servo motor to follow a bright light. As the light moves, the servo rotates to follow.
2. Mount a laser pointer to the servo motor horn and write a LabVIEW program to allow the user
to aim the pointer at various objects in a room, or to create a laser light show.
Project
8
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P8 - 1
Analyzing the Heart with EKG

An electrocardiogram (EKG) is a graphical recording of the electrical events occurring within
the heart. In a healthy heart there is a natural pacemaker in the right atrium that initiates an
electrical sequence. This impulse then passes down natural conduction pathways between the
atria to the atrioventricular node and from there to both ventricles. The natural conduction
pathways facilitate orderly spread of the impulse and coordinated contraction of first the atria
and then the ventricles. The electrical journey creates unique deflections in the EKG that tell a
story about heart function and health. Doctors and other trained personnel can look at an EKG
tracing and see evidence for disorders of the heart such as abnormal slowing, speeding, irregular
rhythms, injury to muscle tissue (angina), and death of muscle tissue (myocardial infarction). By
looking at several beats, you can also calculate heart rate.

PROJECT DESIGN REQUIREMENTS
Write a LabVIEW program to graphically record an EKG tracing of heart activity. You will use
a Vernier interface and an EKG Sensor for data collection with a Sampling Time of 10 seconds
and a Sampling Rate of 100 samples/second. You should make two graphical displays: the first
plots data in real time on a chart, and the second displays the plot on a graph after all data have
been collected. The second display should incorporate the graphical analysis tools available with
the use of a Waveform Graph. After creating your VI, follow the steps in the Project Setup to
properly attach the EKG to a test subject and run your program.

MATERIALS
SensorDAQ or LabQuest interface USB cable
LabVIEW Vernier EKG Sensor
computer electrode tabs

Project 8
P8 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT SETUP
Connect the sensor to the interface
1. Connect the Vernier EKG Sensor to Channel 1 of the interface.
2. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
Note: Wait until your VI is written before performing the rest of the Project Setup.
Attach the EKG electrodes to subject
1. Use three electrode tabs per subject. Place the first electrode on the right wrist, a second
electrode on the inside of the right elbow, and a third electrode on the inside of the left
elbow. Place each electrode so it is on the inside part of the arm (closer to the body) with the
tab on the edge of the electrode patch pointing downward. This way, the wires of the sensor
can hang freely without twisting the edge of the patch.
2. Connect the alligator clips from the sensor to the tabs on the electrodes. Connect the black
(or ground) clip to the right wrist electrode, connect the green (or negative) clip to the right
elbow electrode, and connect the red (or positive) clip to the left elbow electrode as shown in
the figure below. The subject should be seated and remain relaxed.
Red (positive)
Green (negative)
Black (ground)

Figure 1 EKG electrode placement for measuring heart activity

PROJECT BACKGROUND INFORMATION
The EKG Sensor measures cardiac electrical potential waveforms (voltages produced during the
contraction of the heart). A typical tracing consists of a series of waveforms occurring in a
repetitive order. These waveforms arise from a flat baseline called the isoelectric line. Any
deflection from the isoelectric line denotes electrical activity.
The five major deflections on a normal EKG are designated by the letters P, Q, R, S, and T. One
heart cycle is represented by a group of waveforms beginning with the P wave, followed by the
QRS wave complex, and ending with the T wave (see Figure 2). The P wave represents the
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 3
depolarization of the atria and is associated with their contraction. Ventricular activation is
represented by the QRS complex. The T wave results from ventricular repolarization, which is a
recovery of the ventricular muscle tissue to its resting state.

Figure 2 EKG waveform
In order to zoom in and analyze a two-beat EKG tracing like the one shown above, you will need
to enable the graphical analysis tools of the Waveform Graph. Right-click a Waveform Graph
and select Properties to view the configuration window. The options to make the graphical
analysis tools visible are found on the Appearance tab.

Figure 3 The graphical analysis tools configuration window
Project 8
P8 - 4
Engineering Projects with NI LabVIEW and Vernier

To enable a cursor that can be used for examining your waveform, you must set up its properties
on the Cursors tab. Match the settings that are shown below.

Figure 4 The Graph Properties configuration window, Cursors tab
Once you have collected a set of data and enabled the graphical analysis tools, you can examine
your data with a cursor. If you configured your cursor like that shown above, a dashed vertical
line will appear at the beginning of your Waveform Graph (if you do not see the cursor, right-
click the cursor legend and select Bring to Center). Click and drag this vertical line to examine
your data.

Figure 5 Waveform Graph cursor selector
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 5
To zoom in on a portion of the graph, click the Zoom selector (found in the Graph Palette) and
drag across two complete waveforms.

Figure 6 Zoom selector

PROJECT TIPS
1. The Waveform Chart terminal should reside within the While Loop. Wiring the data to the
Waveform Graph requires that the data be gathered as an array. The easiest way to do this is
to locate the Waveform Graph outside the data collection While Loop. Wire the data output
terminal of the Analog Express VI through the border of the While Loop to the Waveform
Graph, and then right-click on the tunnel created at the border of the While Loop and select
Enable Indexing. The data will automatically be gathered into an array that will be plotted to
the graph when the loop has finished executing.
3. Because the electrical signal produced by the heart and detected at the bodys surface is so
small, it is very important that the electrode patches make good contact with the skin. You
may need to scrub the areas of skin where the patches will be attached with soap and water to
remove dead skin and oil.
2. Do not reuse electrode tabs on different subjects.
4. Refer to Appendix C for additional information on programming the Analog Express VI.
5. Refer to Appendix E for additional information about the Vernier EKG Sensor.

PROJECT TROUBLESHOOTING
1. EKG waveforms should show a positive deflection from the isoelectric line. A positive
deflection represents electrical activity moving toward the positive lead (the green lead in
this exercise). If your waveforms are showing a negative deflection, make sure the positive
lead is connected to the electrode on the right elbow, and the negative lead (red) is connected
to the electrode on the left elbow.
2. The EKG Sensor leads are not shielded and can pick up electronic interference from
computers, monitors, cell phones, and power cables. This can cause a noisy waveform
making it somewhat difficult to plot an accurate tracing of heart activity. Proper electrode
placement, avoidance of electronic equipment, and minimizing the area between the
electrode leads (e.g., by twisting them together) can reduce noise.
Project 8
P8 - 6
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Modify the VI created in the Project to compute and display heart rate in beats per minute (bpm)
from the signal readings of the EKG Sensor.

CHALLENGE BACKGROUND INFORMATION
In a normal EKG, the waveforms repeat at regular intervals. The time between waveforms can be
used to determine the subjects heart rate measured in beats per minute (bpm).
There are several subVIs that can be used to help with calculating the heart rate. One option is to
use the Peak Detector subVI (found in the Signal Processing Signal Operation function
palette). This subVI requires the data are input as an array. The width and threshold inputs are
important parameters that may take some experimentation to determine proper values. Use the #
found output of this subVI to calculate beats per minute. For example, multiplying the number
of peaks in a 5 second sample by 12 will give you the heart rate in beats per minute.

Figure 7 Peak Detector subVI

CHALLENGE TIPS
1. The Project Tips describe a method of creating an array at the border of a While Loop. This
array can be used as input into the Peak Detector subVI.
2. Since the exact placement of the electrodes will affect the size of the signal detected by the
EKG, you will need to experiment to find the proper threshold value.
3. If your waveform does not have strong, easy-to-detect peaks, you may have to include some
signal processing. The goal of this processing is to reshape the waveform to have a distinct
peak for every beat of the heart.
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 7
EXTREME CHALLENGE DESIGN REQUIREMENTS
While an EKG Sensor is normally used to record the muscle activity of the heart, it can also
detect other electrical changes in other parts of your body, even the motion of your eyes. Build a
device that switches a bipolar LED from one color to another when you look left or right. Use
the EKG Sensor to detect the motion of the eyes, and the Vernier Digital Control Unit (DCU) to
power the LED.

ADDITIONAL MATERIALS
Vernier Digital Control Unit (DCU) 220 resistor
Vernier LabQuest or LabPro power supply breadboard
bipolar LED jumper wires


EXTREME CHALLENGE SETUP
Connect the sensor to the interface
1. Connect the EKG Sensor to Channel 1 of the interface.
2. Connect the interface to the computer.
Connect the DCU to the interface
1. Connect the DCU to the DIG port on the interface.
2. Connect a power supply to the DCU.
Construct a bipolar LED circuit
1. Plug the 9-pin cable into the side of the DCU.
2. Insert the bipolar LED and resistor into a breadboard, and then wire the components to the
DCU cable as shown in the figure below. You can find the color-coded pin-out for the DCU
cable on the label attached to the cord.

Figure 8 Wiring diagram for connecting
a bipolar LED to the DCU cable
Note: Wait until your VI is written before performing the rest of the Extreme Challenge Setup.
Project 8
P8 - 8
Engineering Projects with NI LabVIEW and Vernier

Attach the EKG electrodes to subject
1. Place three fresh electrode tabs on the subject, as shown in the figure below. Place a tab to
the side of each eye, and then place a third tab on the neck.

Figure 9 EKG electrode placement for monitoring eye movement
2. Connect the red (or positive) alligator clip to the right eye electrode, connect the green (or
negative) clip to the left eye electrode, and connect the black (or ground) clip to the neck
electrode. The subject should be seated and remain relaxed.

EXTREME CHALLENGE BACKGROUND INFORMATION
The retina of the eye is a complex layered structure of neurons, and as such, it maintains a charge
across its surface giving the eyeball a small electrical dipole moment. The EKG Sensor is
capable of detecting changes in this dipole moment as the eyes rotate. If the eyes rotate to the
right a voltage pulse is produced in the EKG Sensor and if they rotate to the left a pulse of
opposite polarity is produced.
In the Extreme Challenge, you are asked to control the color of a bipolar LED with eye
movement. The behavior of a bipolar LED depends on the direction of current flow. If the
current flows in one direction, the bipolar LED will appear green. If the current flows in the
opposite direction, the bipolar LED will appear red. Since an LED can be destroyed if too much
current flows through it, you should wire it in series with a current-limiting resistor.
The Vernier Digital Control Unit (DCU) can be used to switch between colors in the bipolar
LED. The DCU is an electronic device that allows you to control up to six digital output lines for
on/off control of LEDs and other DC electrical components. The DCU connects to the DIG port
on the interface and is powered by a separate DC power supply. A 9-pin, D-sub socket cable is
supplied with the DCU, with bare wires on one end, for use in building projects. There are
connections for all six digital lines, plus a power connection and two ground connections. The
color code of the wires is identified on a label attached to the cable.
The bipolar LED should be connected in series with a current-limiting resistor between DCU
lines D1 and D2 (there is no ground connection in this setup). To illuminate each color, you must
send a numeric output pattern to the DCU to turn on one of the digital lines. The Digital Express
VI found in the Vernier functions palette can be used to send these output patterns.
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 9

Figure 10 Configuration window for the Vernier Digital Express VI

EXTREME CHALLENGE TIPS
1. A good first step is to record some data and analyze the waveform. Then, you can determine
what events occur in the waveform, such as peaks, that can be used in your program to
control the output to the DCU.
2. For best results, do not reuse electrode tabs.
3. Since the exact placement of the electrodes will affect the size of the signal detected by the
EKG, you will need to experiment to find an upper and lower threshold to change the LED
color that works for your apparatus. You will find the Waveform Graph on your front panel
very helpful for this process.
4. When the Analog and Digital Express VIs are used together in the same loop, they should be
connected together via their stop (F) and stopped terminals.
5. Avoid using the Abort Execution button to stop your VI because some of the DCU lines may
remain on.
6. Refer to Appendix C for additional information on programming the DCU and the Digital
Express VI.
7. Refer to Appendix E for additional information on the Vernier DCU.

EXTREME CHALLENGE TROUBLESHOOTING
1. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on.
2. Make sure you are sending the proper output pattern to turn on a digital line. Use the Digital
Express VI configuration window to test your pattern and hardware.
Project
8
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P8 - 1T
TEACHER INFORMATION
Analyzing the Heart with EKG
This Project is fairly simple and straightforward. The front panel should provide the user with
the necessary tools for determining the five major deflections in an EKG tracing. Displaying the
graphical analysis tools does not require additional programming, but it does require students to
spend some time configuring the Waveform Graphs properties. Encourage your students to
develop and test a good working program for the Project Design Requirements before attempting
the Challenge.

PROJECT CONSTRUCTION TIPS
There is no construction for this project; however, students should be mindful of the placement
of the EKG electrode tabs in order to plot an accurate tracing.

PROJECT PROGRAMMING TIPS
There are a number of ways this project can be tackled. One suggestion is to divide the Project
Design Requirements into two parts. First, write a LabVIEW program to collect and display
EKG data for 10 seconds. A Waveform Chart should be used for this display, because the data
will be displayed in real time. Writing this portion of the program first allows students to check
that their equipment is setup and working properly. Next, modify the program to save the data to
an array, and then publish it to a Waveform Graph when data collection ends. The graphical
analysis tools are only available with the Waveform Graph.
Part I Record a live EKG tracing
The simplest way to collect live data with a Vernier interface is to use the Analog Express VI.
When the Express VI is placed on the block diagram a configuration window appears. The EKG
sensor is automatically detected, but students will need to increase the Sampling Rate in the Set
Timing options (100 samples/second is a good sample rate for this project).

Figure 1 Sample program to plot the activity of the heart in real time
Tip: Adding a History property node to clear the chart at the beginning of the program will aid
the user when analyzing repeated trials. You can create this property node by right-clicking the
Waveform Chart and selecting Create Property Node History Data. Since the default
configuration for the History Data Property Node is a Read output terminal, you must right-click
Project 8 Teacher Information
P8 - 2T
Engineering Projects with NI LabVIEW and Vernier

the property node after you place it on the block diagram and select Change All To Write. Right-
click on the property node a second time and create a constant. An empty array input will clear
the chart. The History property node should be placed outside the While loop.
Part II Add graphical analysis tools to an EKG tracing
Waveform Charts excel at displaying plots of data acquired point-by-point, while Waveform
Graphs are best at displaying plots of multi-point data arrays. One method of creating an array of
data is by using a technique known as auto-indexing. When a wire crosses the border of a While
Loop an indexing point on the border (called a tunnel) is created. Enable auto-indexing by right-
clicking the tunnel and selecting Enable Indexing. Visually, the tunnel is solid when auto-
indexing is disabled and bracketed when auto-indexing is enabled. The wire exiting the loop is
thicker when using auto-indexing, because the wire contains an array.

Figure 2 Sample program to analyze an EKG tracing

CHALLENGE CONSTRUCTION TIPS
The Challenge does not require any additional components. Instead, students will focus on
enhancing their LabVIEW programs.

CHALLENGE PROGRAMMING TIPS
The Challenge Design Requirement suggests using the Peak Detector subVI found in Signal
Processing Signal Operation. This subVI requires students to input a threshold cutoff value in
order to define a peak. This value can be determined by examining the data in the Waveform
Graph after an initial test run. Be aware that the threshold value may vary between subjects, so
students may wish to program this parameter as a front panel control. The width input of the
Peak Detector subVI is also an important variable that might affect the output of this subVI.
Study the Context Help of the subVI for more information.
Compute heart rate using the Peak Detector subVI
The Peak Detector subVI counts the number of peaks that occur in a data array. Since the Analog
Express VI is configured to collect a 10 second sample, we multiplied the number of peaks by
6 in order to calculate the heart rate in beats per minute. We used a cutoff threshold value of 1.4
volts in the sample shown below. Using controls as the inputs into the threshold and width
allows the user to modify and experiment to find the proper values for these parameters. Because
the number of peaks returned is an integer, this method of determining beats per minute is more
precise if you sample for a longer period of time. Remember to modify the multiplier if you
adjust the length of the experiment.
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 3T

Figure 3 Sample program to calculate heart rate using the Peak Detector subVI
Signal processing
If the waveform does not have a strong peak, some signal processing might be required. For
example, we were able to create a waveform with distinct peaks by applying a high-pass filter
with a cut-off of 8 Hz to smooth out the T wave. Then we performed a discrete differentiation to
magnify the rapid change that occurs at the QRS complex.
Other signal processing methods can also be applied, including filtering to reduce noise. If you
are considering doing some signal processing you want to save the EKG data to a file, and then
build a new VI that retrieves the saved data and performs signal analysis. This allows you to play
with the hundreds of analysis tools within LabVIEW, without having to hook up a test subject
for each run.
Vernier physiology example VIs
You have access to many Vernier example VIs in the LabVIEW Example Finder (accessed from
the Help menu). Included in the Vernier example Vis folder is a folder called Physiology
Sensors. You can find examples for EKG and Hand Grip Heart Rate, among others. The Hand
Grip Heart Rate example performs a calculation of beats per minute using the Vernier subVI
called Beats Per Minute. You might consider having your students study these examples to see
how we performed a beats per minute calculation.

EXTREME CHALLENGE CONSTRUCTION TIPS
The simplest way to construct your circuit is to connect the LED and resistor to the DCU cable
through a breadboard. Connect the longer lead (wire) on the LED to the resistor. Students can
run some preliminary tests from within the configuration window of the Digital Express VI to
determine the display color for each DCU line.

EXTREME CHALLENGE PROGRAMMING TIPS
Control a bipolar LED with sensor data
The easiest way to start the Extreme Challenge is to modify your program from the Project. The
cursor tools you added to the Waveform Graph will be useful in determining the threshold values
for looking left and right.
Project 8 Teacher Information
P8 - 4T
Engineering Projects with NI LabVIEW and Vernier

The Digital Express VI found in the Vernier functions palette can be used to control digital lines
D1 and D2 on the DCU. When the Digital Express VI is placed on the block diagram a
configuration window appears. When Output Lines 16 is selected from the Device Selection
tree control, an interactive picture of the DCU appears. Select Lines Stay On Indefinitely as the
Configure DCU Timing option, so that your program can continually update the DCU output
without pause.

Figure 5 Configuration window for the Digital Express VI
Figure 4 Close-up of bipolar LED circuit
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 5T
You will need to make a timing change to the Analog Express VI, since it was originally
configured to stop data collection after 10 seconds. Double-click the Express VI to open the
configuration window. Click the Set Timing button in the upper-left corner, and then check the
Repeat option in the Data Collection window.

Figure 6 Data Collection configuration window for the Analog Express VI
In the sample program shown below, we used the Greater?, Less?, and Select functions to turn
on DCU line D1 when the sensor reading was greater than 1.8 mV (subject looking right) and
DCU line D2 when the sensor reading was less than 0.7 mV (subject looking left). To prevent
the LED from turning off when the sensor reading is returning a mid-range value, we used a shift
register to latch onto the current value until a new value is triggered. Notice the wiring of the
stop (F) and stopped terminals on the Analog and Digital Express VIs. This ensures that the
Express VIs execute in proper order and that all DCU lines will be turned off before program
execution ends.

Figure 7 Sample program to control a bipolar LED with eye movement
Project 8 Teacher Information
P8 - 6T
Engineering Projects with NI LabVIEW and Vernier

Getting the Extreme Challenge to work reliably can be tricky, because eye movements can be
both voluntary and involuntary actions. In the figure shown below, an upward pulse occurs when
the eyes look to the right, and a downward pulse occurs when the eyes look to the left. However,
notice that when the eyes return to looking forward, they naturally produce a movement in the
opposite direction. One way this problem can be overcome is to encourage the subject to look
sharply (or quickly) when looking left or right. This will usually cause a pulse with larger
amplitude than the reflex pulse.

Figure 8 Voltage plot of eye movements
Another thing to notice is the larger pulse differential between looking right versus looking left.
Most people have greater muscle strength when looking in one direction over another. Students
should spend some time studying the Waveform Graphs produced by their subjects in order to
determine appropriate upper and lower threshold values. Be aware, however, that subjects will
tire after a period of time and have difficulty controlling their eye movements.
One enhancement you might wish to add to your program to reduce unwanted eye movements is
to place an indicator on the front panel showing the current state of the LED. This can be a
Round or Square LED (found in the Modern Boolean controls palette) or a text string
displaying the terms left or right.

EXTENSIONS
1. Control the power to a simple electronic device (such as a DC motor, a buzzer, or a lamp)
with the blink of your eye. Place the red and green electrode tabs above and below your right
eye (placement order does not matter); place the black electrode tab on the left side of your
neck. Wire the electronic device between DCU lines D1 and GND. You will need to run
some preliminary tests to determine an acceptable threshold cutoff value for an eye blink.
2. The Vernier EKG Sensor can also be used to make an electromyogram (EMG), a graphical
recording of electrical activity within muscles. The activation of muscles by nerves results in
changes in ion flow across cell membranes, which generates electrical activity. This can be
measured using surface electrodes placed on the skin over the muscle of interest. Electrical
activity correlates with strength of muscle contraction, and is dependent on the quantity of
nerve impulses which are sent to the muscle. This is easily visible in large muscles such as
the extensor muscle in the arm and the quadriceps muscle in the leg, but can also be
demonstrated in smaller, less visible muscles, such as the masseter muscle in the jaw. Modify
your basic LabVIEW program to make an EMG. The electrode placements for these three
muscles are shown below.
Analyzing the Heart with EKG
Engineering Projects with NI LabVIEW and Vernier P8 - 7T

Figure 9 Electrode placement for EMG
3. Muscle fatigue occurs with prolonged or repetitive use of a muscle group. With fatigue, there
is a sense of weakness and even discomfort, which eventually leads one to discontinue the
activity that is causing it. Modify your LabVIEW program to measure the subjects hand grip
strength with a Vernier Hand Dynamometer and correlate the strength with the electrical
activity of the biceps muscles in the arm. The program should collect data for approximately
2 minutes during which time the subject should continuously squeeze the Hand
Dynamometer.

Figure 10 Electrode placement for grip strength

Project
9
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P9 - 1
Blood Pressure

Blood pressure is a measure of the fluid pressure within the circulatory system. This pressure is
required to ensure the delivery of oxygen and nutrients to, and the removal of carbon dioxide and
waste products from, tissues. Blood pressure varies from a peak pressure produced by the
contraction of the left ventricle, to a low pressure produced by ventricular relaxation. The peak
pressure is called systole, and the pressure that is maintained while the left ventricle is relaxing is
called diastole. The average pressure is the mean arterial pressure or MAP. Blood pressure is
traditionally reported with the systolic pressure stated first and the diastolic pressure stated
second. In adults, 120/80 and below is considered normal blood pressure. High blood pressure
(also called hypertension) is a major risk factor for a number of health problems including
strokes and congestive heart failure. In adults, 140/90 and above is considered high blood
pressure.
The photo above is of an automated blood pressure measurement system, which is the Challenge
for this chapter.

PROJECT DESIGN REQUIREMENTS
In this Project, you will write a LabVIEW program to display the blood pressure of a test
subject. You will use a Vernier Blood Pressure Sensor, a non-invasive unit that includes a
handheld pump, pressure release valve, and cuff. The cuff is placed on the upper arm to
pressurize the arteries, just like other blood pressure monitoring devices. The sensor connects to
the cuff and is used to monitor the pressure in the cuff in units of mm Hg. The cuff is pressurized
with the pump. The pressure release valve slowly releases pressure out of the cuff. Your front
panel design should include a graphical cuff pressure versus time display with a large, easily
readable indicator for live cuff pressure readings. The program should provide a visual or
audible signal when the cuff pressure has reached 160 mm Hg as a signal to stop inflating the
cuff. When data collection ends, the VI should use the recorded cuff pressure to calculate and
display the test subjects systolic and diastolic blood pressures.
Project 9
P9 - 2
Engineering Projects with NI LabVIEW and Vernier

MATERIALS
SensorDAQ or LabQuest interface USB cable
LabVIEW Vernier Blood Pressure Sensor
computer

PROJECT SETUP
Connect the sensor to the interface
1. Connect the Vernier Blood Pressure Sensor to Channel 1 on the interface.
2. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
Note: Wait until your VI is written before performing the rest of the Project Setup.
Attach the blood pressure cuff to the subject
1. Connect the rubber hose from the blood pressure cuff to the connector on the Blood Pressure
Sensor.
2. Remove any clothing that may cover or constrict the portion of the subjects arm being
measured.
3. Wrap the cuff firmly around the subjects upper arm, approximately 2 cm above the elbow.
The two rubber hoses from the cuff should be positioned over the bicep muscle (brachial
artery) and not under the arm (see Figure 1).

Figure 1 Blood pressure cuff placement
Conduct the blood pressure measurement
1. The subject should be seated with his or her arm supported by a nearby table or desktop.
Encourage the subject to avoid moving his or her arm during the experiment.
2. Start your VI to begin data collection. Immediately begin to pump until the VI signals that
the cuff pressure has reached at least 160 mm Hg. Stop pumping at this point.
3. The pressure will start to drop. The test subject should sit quietly and not move.
4. When the cuff pressure drops below 50 mm Hg, stop the VI. Release the pressure from the
cuff by pressing down on the release valve located next to the pump.
5. If your VI is working correctly, the systolic and diastolic arterial pressures will be calculated
and displayed on the front panel of the VI.
Blood Pressure
Engineering Projects with NI LabVIEW and Vernier P9 - 3
PROJECT BACKGROUND INFORMATION
The Blood Pressure Sensor does not measure blood pressure directly, it measures cuff pressure.
The cuff pressure waveform can be used to calculate blood pressure using the oscillometric
method, a non-invasive means of measuring blood pressure without using a stethoscope. This
method is based on the principle that when a cuff is pressurized on the upper arm, blood pumped
through the arteries causes the arterial walls to flex, forming pressure pulses that pass from the
arteries, through the arm, and into the pressure cuff itself. The Blood Pressure Sensor records the
magnitude of these pressure pulses. When the artery is fully compressed, blood flow stops along
with the pulsations. As the pressure in the cuff is slowly exhausted, the pulses become
increasingly significant until they reach maximum amplitude. Continued decreasing of the cuff
pressure minimizes the occlusion of the artery and causes the pulse amplitude to decay.

Figure 2 Cuff pressure measured by sensor
These pressure pulses, when separated from the decaying mean pressure of the cuff, form an
oscillating waveform. In the figure below, the waveform has been flattened or reoriented along
the horizontal plane causing the peak-to-peak amplitudes to create a bell-shaped envelope.
Within the envelope, the amplitudes of the waveform increase through the systolic blood
pressure and continue increasing until the mean arterial pressure (MAP) is reached.

Figure 3 Oscillatory waveform used to identify the blood pressure envelope
Project 9
P9 - 4
Engineering Projects with NI LabVIEW and Vernier

The BP Analysis subVI (found under Data Logging Physiology Analysis in the Vernier
functions palette) will determine the MAP using the method described above, and then display
the systolic and diastolic blood pressures. This subVI is designed to work with an array of data
collected at a data-collection rate of 100 points/second.

Figure 4 BP Analysis subVI

PROJECT TIPS
1. The data collection rate must be 100 samples per second for the BP Analysis subVI to
calculate blood pressure accurately.
2. Set the experiment length to 90 seconds to allow ample time for data collection.
3. It is not necessary to inflate the pressure cuff higher than 160 mm Hg. Over inflation of the
cuff may cause pain and/or injury.
4. The pressure release valve is used to slowly exhaust the pressure from the cuff. In addition, if
you press down on this valve, it will immediately exhaust all of the pressure out of the cuff.
5. The subjects arm and hand must remain still during measurements.
6. Do not touch or move the pressure release valve during measurements.
7. Refer to Appendix C for additional information on programming the Analog Express VI.
8. Refer to Appendix E for additional information about the Blood Pressure Sensor.

PROJECT TROUBLESHOOTING
1. Proper placement of the blood pressure cuff will increase the accuracy of your
measurements. The rubber hoses from the cuff should exit over the brachial artery about 2
cm above the crease in the elbow.
2. The larger a subjects arm, the slower the release valve will exhaust. If the pressure release
valve is exhausting slower or faster than 24 mm Hg/s, use a screwdriver to adjust the
exhaust rate of the pressure valve. To increase the rate of exhaust, turn the screwdriver
clockwise; to decrease the rate of exhaust, turn the screwdriver counter-clockwise.
3. If the BP Analysis subVI does not seem to be working correctly, make sure you have set the
data-collection rate of the Analog Express VI to 100 points per second and that you are
taking data covering cuff pressures from 160 to 50 mm of Hg.
Blood Pressure
Engineering Projects with NI LabVIEW and Vernier P9 - 5
CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Once you have mastered taking blood pressure measurements, try building a motorized pumping
device to automatically inflate the pressure cuff. You can use a Vernier Digital Control Unit to
control a pump and also control a quick-release discharge valve. Write a LabVIEW program to
activate the pump, inflate the cuff to a pressure of 160 mm Hg, read the pressure in the cuff as
the pressure drains to about 50 mm Hg, quickly release the remaining pressure out of the cuff,
and then display blood pressure readings. The front panel design should remain the same as the
Project, with the addition of a control to quickly release all pressure from the cuff in case of a
situation where the cuff pressure is getting too high and causing the subject discomfort.

ADDITIONAL MATERIALS
Vernier Digital Control Unit (DCU) solenoid
LabQuest or LabPro power supply plastic tubing
pump two T-valves

CHALLENGE SETUP
Construct a blood pressure pumping device
1. Build the device as shown below, and also in the photo at the beginning of this chapter. The
sensor, cuff, and pressure release valve are provided with the Vernier Blood Pressure Sensor.
These parts will be used in the same manner as they were used in the Project. An additional
solenoid valve and electric pump will be used. The solenoid valve provides a means to
automate the immediate exhaust of all the pressure out of the cuff. This quick release of
pressure is desirable in case of discomfort to the user and also when data collection has
ended. You will also need to obtain a pump. The electric pump will take the place of the
hand pump you used in the Project. The two additional T-valves shown in the figure below
are optional. Their purpose is to isolate portions of the device to aid in testing during
assembly. They may also be useful for immediately stopping cuff inflation in the case of a
programming error. These valves should all be turned to the Open position when you are
ready to begin blood pressure measurements.
Tip: Mounting the components to some type of backer board will ensure that the connections
stay tight.

Figure 5 Pumping device for blood pressure cuff
Project 9
P9 - 6
Engineering Projects with NI LabVIEW and Vernier

2. The pressure release valve should be adjusted to an exhaust rate of 24 mm Hg/s.
Tip: The pressure release valve can remain open during cuff inflation, because the discharge rate
is insignificant compared to the inflation rate of the pump. The solenoid valve, however, must
remain closed during inflation and deflation.
3. Connect the DCU to the DIG port on the interface.
4. Connect a power supply to the DCU.
5. Plug the 9-pin cable into the side of the DCU.
6. Wire the solenoid and pump to the DCU cable as shown in the figure above. You can find the
color-coded pin-out for the DCU cable on the label attached to the cord.

CHALLENGE BACKGROUND INFORMATION
In the Challenge, you will replace the handheld pump with an electric pump to automatically
inflate the blood pressure cuff. A solenoid will be used to automate the quick release of pressure
from the cuff. A solenoid is an electromechanical device, in this case it is used to control a valve
for controlling the flow of air. You can use a DCU to control these two components of your
pumping mechanism. The DCU is an electronic device that allows you to control up to six digital
output lines for on/off control of DC electrical components. The DCU plugs into the DIG port on
the interface and is powered by a separate DC power supply. A 9-pin, D-sub socket cable is
supplied with the DCU. It has bare wires on one end for use in building projects. There are
connections for all six digital lines, plus a power connection and two ground connections. The
color code of the wires is identified on a label on the cable.
To turn on a component connected to one of the digital lines, your LabVIEW program must send
a numeric output pattern to the DCU. Lets assume you have connected the solenoid to line D1
and the pump to line D2. In order to run the solenoid alone, your program would send a pattern
of 1 to the DCU. Line D1 (the solenoid) would be turned on and all other lines would be off.
To run the pump alone, your program would send a pattern of 2. However, to run both devices
simultaneously, your program must send a pattern of 3. You can preview the 16 output
patterns available for the DCU within the configuration window of the Digital Express VI. This
Express VI is found in the Vernier functions palette.

CHALLENGE TIPS
1. You can obtain the proper solenoid and pump for this Challenge by taking apart an off-the-
shelf blood pressure kit found at your local pharmacy. They are fairly inexpensive.
2. Determine if voltage applied to the solenoid opens or closes the valve. Then apply this to
your programming logic so that it remains closed until an immediate release of air is required
(in case of emergency or at the end of data collection).
3. Before testing your device on a human subject, make sure your program stops inflating the
cuff at 160 mm Hg. Be prepared to physically detach the cuff from the pump during these
trials so as not to overinflate the cuff.
Blood Pressure
Engineering Projects with NI LabVIEW and Vernier P9 - 7
4. Provide some way to physically stop cuff inflation in case of a programming error. One
suggestion is to incorporate one or more T-valves into your device to use as an emergency
exhaust when conducting initial tests. Another option is to remove power from the DCU.
5. When building your device, keep the power limitations of the DCU and your DCU power
supply in mind. You should not exceed 1000 mA total.
6. Refer to Appendix C for additional information on programming the DCU and the Digital
Express VI.
7. Refer to Appendix E for additional information about the Vernier DCU.

CHALLENGE TROUBLESHOOTING
1. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on.
2. Double-check the DCU cable connections against the color-coded label attached to the cable.
3. Make sure you are sending the proper output pattern to turn on two digital lines at the same
time. Use the red LEDs on the top of the DCU to verify the pattern the DCU is producing.

Project
9
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P9 - 1T
TEACHER INFORMATION
Blood Pressure
Students will need to work in pairs to do blood pressure measurements, since the person being
tested should not be moving around.
Encourage your students to work towards creating a simple, concise program. The front panel
should contain a large, easy-to-read digital indicator and graphical display of the live pressure
readings of the cuff pressure as well as an alert (either visual or auditory) so the operator will
know when to stop inflating the cuff. There should also be indicators for the systolic and
diastolic pressures. Students should develop and test a good working program to meet the Project
Design Requirements so that they have a clear understanding of the workings of a blood pressure
cuff before attempting to build a pumping device for the Challenge.

PROJECT CONSTRUCTION TIPS
There is no construction for this Project, however, students should be mindful of the proper cuff
placement in order to determine an accurate pressure reading. It is very important that the
pressure release valve deflates the cuff at the specified rate of 24 mm Hg/s, otherwise the
systolic and diastolic computations will not be accurate. To increase the pressure release valves
rate of exhaust, turn the slot on the top of the release valve clockwise with a screwdriver; to
decrease the rate of exhaust, turn the slot counter-clockwise. In addition, it is very important for
the subject to remain seated and very still so as not to impart false pressure changes in the cuff.

PROJECT PROGRAMMING TIPS
Collect and display blood pressure data
One suggestion for tackling this Project is to use the Analog Express VI (found in the Vernier
functions palette) to collect and display data from the Blood Pressure Sensor. The design
requirements specify that the pressure reading should be displayed both as a digital indicator and
as a graphical display. Also, the program should provide an indication that the 160 mm Hg
reading has been reached so that the operator will know when to stop inflating the cuff.
The indication that the 160 mm Hg reading has been reached can be done with a Case Structure.
For the case that occurs when the pressure exceeds the limit, you can add a sound (as shown
below) or code to turn on a Boolean indicator. If your students are not familiar with Case
Structures you may want to go over it with them, or refer them to chapter 6 of our book, Hands-
On Introduction to NI LabVIEW with Vernier.
The trickiest part of this Project is to collect the entire data set within the While Loop and then
send it out of the loop as an array so that it can be processed by the BP Analysis subVI (found
under Data Logging Physiology Analysis in the Vernier functions palette). The BP Analysis
subVI assumes that data is collected at 100 points/second. Right-clicking the tunnel at the border
of the While Loop and selecting Enable Indexing will cause the data to exit the While Loop as an
array. Note that the wire leaving the While Loop is thicker, indicating an array data type.
Project 9 Teacher Information
P9 - 2T
Engineering Projects with NI LabVIEW and Vernier


Figure 1 Sample program for determining blood pressure
Students should spend time with their front panel designs in this Project, since the user is
dependent on the data display to know if they are taking the blood pressure readings properly.

CHALLENGE CONSTRUCTION TIPS
When building the pumping device, the only additional components you need are a solenoid, an
electric pump, and some plastic tubing. The sensor, cuff, and pressure release valve are provided
with the Vernier Blood Pressure Sensor. One way to obtain the proper solenoid and pump is to
disassemble an off-the-shelf blood pressure kit found at your local pharmacy. This also gives you
a spare blood pressure cuff.
In the photo below, we used a "Heath Care Blood Pressure Cuff Monitor" (Model # BP3AQ1-
1RITE, purchased from Rite Aid Pharmacy). The unit came apart easily and the pneumatics
removed cleanly. Two wires controlled the motor and two wires controlled the solenoid. The
solenoid had no polarity, and figuring out the polarity of the motor was straightforward. The
only (very minor) difficulty was finding the correct adapter to join the smaller tubing size to the
Luer Lock fitting on the Vernier Blood Pressure Sensor.

Figure 2 Close-up of the pumping apparatus
The solenoid and pump should be wired between a DCU line and a ground connection. (We
connected the solenoid to digital line D1 and the pump to D2.) You may wish to incorporate one
Blood Pressure
Engineering Projects with NI LabVIEW and Vernier P9 - 3T
or two T-valves into your device to serve as emergency release valves during testing. All T-
valves should be turned to the Open position when you are ready to begin blood pressure
measurements.
In addition, spend a fair amount of time ensuring that the students have a method to stop
inflating the cuff in case of a programming error (shutting a valve, disconnecting a tube,
removing power to the DCU, etc.), and that they do initial testing without placing the cuff on a
subject.

CHALLENGE PROGRAMMING TIPS
Drive a motorized pump to inflate a blood pressure cuff
The Digital Express VI found in the Vernier functions palette can be used to control the DCU.
When the Digital Express VI is placed on the block diagram, a configuration window appears.
When Output Lines 16 is selected from the Device Selection tree control, an interactive picture
of the DCU appears. Students can sample the 16 different output patterns to see which
combination of digital lines will be active for any given number.

Figure 3 Configuration window for the Digital Express VI
In the example program shown below, both the solenoid and the pump are powered on at the
beginning of the program by sending a pattern of 3 to the DCU. This causes the blood pressure
cuff to inflate. The program monitors the Blood Pressure Sensor until the pressure exceeds
160 mm Hg. At that point, the motor is turned off while the solenoid remains on (a pattern of 1
turns on DCU line D1 and turns off all other lines). With the pump turned off, the pressure
release valve will slowly release the cuff pressure. Notice that we have used a Boolean shift
register as a flag to detect when the pressure has reached the target limit. If you do not provide
some sort of flag, the DCU will continuously try to re-inflate the cuff every time the pressure
starts to drop below 160 mm Hg. Note: The True Case Structure makes no change to the
Boolean value, but simply passes it through to the shift register.
Project 9 Teacher Information
P9 - 4T
Engineering Projects with NI LabVIEW and Vernier


Figure 4 Sample program for automatically inflating a blood pressure cuff
Tip: Remember, an output pattern of 3 will turn on both digital lines D1 and D2.
If the user presses the Release Valve front panel Boolean control, a pattern of 0 stops the pump
and opens the release valve to immediately exhaust the cuff pressure. Note that when the Digital
Express VI is stopped, a pattern of 0 is automatically sent to the DCU.

EXTENSIONS
1. You probably noticed the repetitive beats in your pressure waveform. These periodic
repetitions can be used to find the subjects pulse rate in beats per minute (bpm). Modify
your program to display pulse rate on the front panel. Notice that this is one of the
calculations performed by the Vernier Blood Pressure subVI, but try to determine the pulse
rate yourself using the Peak Detector subVI found in the Signal Processing Signal
Operation palette.
2. Instead of using the Blood Pressure subVI to find systolic and diastolic blood pressure, try to
perform the calculations yourself. The mathematics of finding blood pressure may seem
complicated, because it can be tricky to find the peak mean arterial pressure (MAP) in a
decaying waveform. One suggestion is to calculate the pressure differential between
succeeding peaks and troughs along the waveform. The systolic blood pressure is determined
by finding the point along the envelope prior to the MAP at which the pulsations begin to
show a marked increase in amplitude, while the diastolic blood pressure is determined by the
point on the envelope after the MAP at which the pulsations start to level off. Another
method is to flatten the decaying waveform along the horizontal plane (like that shown in
Figure 3 in the student handout). The systolic pressure is roughly one-third the magnitude of
the MAP and the diastolic pressure is about two-thirds of the MAP.
Project
10
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P10 - 1
Strain Gage Measurement

When a force is exerted on an object, the length of the object will change. The ratio of the
change in length to the original length is called strain. A strain gage is a small section of very
fine wire that changes electrical resistance when its dimensions are changed. Two leads (wires or
terminals) are available to connect the gage to measuring instruments. In use, a strain gage is
attached to the surface of the object to be measured in such a way that when the mechanism is
deformed, the conducting material is also deformed. Consider two strain gages that are glued to
the top and bottom of a metal cantilever beam. When a force is applied to the beam, it bends
down in proportion to the force (Hookes Law). As the bar bends downward, the top of the bar
stretches as it is placed in tension. The top strain gage is also stretched, and its resistance
increases slightly because the length of gage wire increases while the width of the wire
decreases. For the strain gage on the bottom of the bar, all of these effects are reversedthe
bottom of the beam is placed in compression and the gage decreases in resistance. These changes
in resistance are small, but they can be measured accurately with the proper circuit. A well-
known circuit designed to convert small changes in resistance to changes in voltage is a
Wheatstone bridge circuit.

PROJECT DESIGN REQUIREMENTS
Build a Wheatstone bridge circuit with two strain gages, and use it to measure the strain on a
cantilever beam as a load is applied to the end of the beam. You will write a LabVIEW program
to measure the output voltage of this circuit and convert it to strain. Both voltage and strain
should be displayed on the front panel as Waveform Charts. Your apparatus should incorporate a
Vernier Instrumentation Amplifier to magnify the voltage readings.

Project 10
P10 - 2
Engineering Projects with NI LabVIEW and Vernier

MATERIALS
SensorDAQ or LabQuest interface glue for strain gages
LabVIEW aluminum bar (1/8 x 3/4 x 8)
computer set of small weights (100500 grams)
USB cable breadboard
Vernier Instrumentation Amplifier jumper wires
two 120 strain gage two 120 (1%) precision resistors
(e.g., Omega #SG-6/120-LY11) clamp to secure bar at one end


ADDITIONAL MATERIALS (LABQUEST INTERFACE ONLY)
Vernier Analog Breadboard Cable


PROJECT SETUP
Mount the strain gages and lead wires
1. Obtain an aluminum bar of rectangular cross section.
2. Follow the strain gage installation instructions provided by your instructor to adhere one
strain gage to the beam, about 2 or 3 cm from the point where it will be clamped. Center the
gage mid-width and align the lead wires or terminals so that they are extending toward the
end of the beam that will carry the load.
3. Glue a second strain gage to the opposite side of the beam in the same location and with the
same orientation. Make sure the leads or terminals on both gages project in the same
direction.
4. If the gage has pre-attached metal leads, make sure that they do not touch the metal bar. Bend
them away from the bar and wrap electrical tape around the bar, under the leads. Then tape
the wire leads firmly to the taped bar so that if the leads are pulled they will not break off of
the strain gage.
5. Three wires should be coming from the apparatus. A single wire must extend from one
terminal or lead of each of the two strain gages. A third wire must extend from the junction
of the other two lead wires (one from each strain gage) as shown in Figure 1. One method of
creating the three leads is to use bondable terminal pads. Leads from the strain gages are
soldered to the terminals. Then longer wires are soldered to these terminals and secured to
the bar with tape.
Strain Gage Measurement
Engineering Projects with NI LabVIEW and Vernier P10 - 3

Figure 1 Strain gage lead wires
6. Clamp the end of the beam with the strain gage to the table. In our device shown in the
picture above, we created a fixture for the metal beam using a vertical t-handle toggle clamp.
Build the Wheatstone bridge circuit
1. Use a breadboard to connect the various parts of the circuit shown below. Connect the
Vernier Analog Breadboard Cable to the breadboard, you will see a +5V and GND pin on the
cable that you will use in the circuit. Add the two 120 resistors to the breadboard as
required for the circuit. Now connect the single wire from each strain gage to your
breadboard circuit.
Tip: If you are using a SensorDAQ, you can make the +5V and GND connection to the screw
terminal on the side of the SensorDAQ. This way, you do not need the Vernier Analog
Breadboard Cable. Use screw terminal 6 for the +5V power source and use screw terminal 5, 8,
or 10 for Ground.

Figure 2 Strain gage connection to Vernier Instrumentation Amplifier
2. The wire from the junction of the two strain gage leads should be connected to the negative
(black) terminal on the Instrumentation Amplifier.
3. A wire should connect the point between the two resistors to the positive (red) terminal on
the Instrumentation Amplifier.
Project 10
P10 - 4
Engineering Projects with NI LabVIEW and Vernier

Connect the sensor to the interface
1. Connect the Instrumentation Amplifier to Channel 1 on the interface. Adjust the knob to
20mV.
2. If you are using a Vernier Breadboard Cable, connect it to Channel 2 on the interface.
3. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.

PROJECT BACKGROUND INFORMATION
The Wheatstone bridge circuit contains four resistances and a constant voltage excitation source.
In a half-bridge circuit, two of the four resistors are strain gages (see Figure 1).

Figure 3 Wheatstone half-bridge circuit
The two resistors and two strain gages are arranged in a diamond pattern. The resistors should
have approximately the same resistance as the two strain gages. A DC excitation voltage (Vex) is
applied across the top and bottom of the diamond and the output voltage (Vout) is measured
across points A and B. The two strain gages are mounted on a test specimen (see Figure 4).

Figure 4 Strain gage mounting
As the figure above shows, the strain gages are mounted at the location where the strain is to be
measured. The two gages are mounted on opposite sides of the bar. When the circuit is balanced,
the voltage at both points A and B in Figure 3 above will be one-half of the excitation voltage.
Therefore, the output voltage will be approximately zero. When a force is applied, the resistance
of the strain gage in tension increases and the resistance of the gage in compression decreases.
This change in resistance creates a voltage change at point B. The voltage at point A has not
changed and is still equal to one-half the excitation voltage. Therefore, a small voltage difference
will appear across points A and B. The voltage between these points (Vout) can be monitored, and
is proportional to the amount of bending or strain in the structural member.
Strain Gage Measurement
Engineering Projects with NI LabVIEW and Vernier P10 - 5
In our circuit, the excitation voltage (Vex) of the circuit can be supplied by the +5V terminal on
the Breadboard Cable. The circuits output voltage (Vout) is never very largerarely as large as a
millivolt. Therefore, the output voltage must be amplified so that it can be measured. The
Instrumentation Amplifier is used to provide this amplification (see Figure 5).

Figure 5 Apparatus setup
If the bridge resistances are not exactly balanced, there will be a nonzero output voltage when no
load is applied. Taking this into account, the output voltage (Vout) of the half-bridge circuit can
be determined using the following equation:
Vout Vmeasured Voffset

where Vmeasured is the measured voltage of the Instrumentation Amplifier and Voffset is the output
voltage measured when no load is applied.
The output voltage of the half-bridge circuit is related to the excitation voltage (Vex) by the
following relationship:
2

GF V
V
ex
out


where is the strain, Vex is the excitation voltage, and GF is the nondimensional gage factor of
the strain gage.
The strain in the beam is therefore represented by the following equation. Notice that the strain
varies in a linear way with the output voltage.
GF V
V
ex
out

2


You will use the interfaces output voltage terminal (which supplies about 5 volts) as the
excitation voltage (Vex). For this Project, you can use 5 volts for the excitation voltage. Most
strain gages have a gage factor of about 2, so you can use 2 for GF.
Project 10
P10 - 6
Engineering Projects with NI LabVIEW and Vernier

In addition, Vout can be replaced with the first equation above that takes the offset voltage into
account. The resulting equation, shown below, should be used in your LabVIEW program to
calculate the strain in the beam.

GF V
V V
ex

offset measured
2



PROJECT TIPS
1. The Vernier Instrumentation Amplifier provides readings in units of millivolts. You will
need to convert this reading to volts to match the units of the excitation voltage.
2. The aluminum bar should flex, but not deform permanently, when a small load is applied.
3. The strain gages should be aligned with the longer, straight sections of wire inside the gage
running along the length of the bar. The gages should be mounted about 2 or 3 cm from the
clamped end.
4. Attaching the strain gages to the bar can be tricky at first. It may take a few trial runs to
adhere the gage without bubbles between the gage and bar. It is recommended that you use a
strain gage adhesive and follow the directions closely. Make sure the gage is glued flat
against the surface of the bar with a thin, even layer of glue between the gage and the bar.
5. While it is strongly recommended that you use an adhesive specifically designed for strain
gages, the strain gage can be attached using household cyanoacrylate glue (e.g., Super
Glue

). Do not use the gel-type Superglue. Make sure to use a small amount (one drop) and
to use a technique that minimizes bubbles between the gage and bar.
6. The leads on the strain gages are very fragile, so you need to make sure they are not ripped
out by a pull on the wires. Create some strain relief by taping the wire leads firmly to the
metal bar so that if the wires are pulled, the force is not delivered to the strain gage leads.
7. A good data-collection rate for the Instrumentation Amplifier is 50 samples per second.
8. The Analog Express VI collects data for a fixed amount of time. For an indefinite data
collection length, check the Repeat option in the Analog Express VIs Set Timing
configuration window.
9. The gage factor for your strain gage can be found from your manufacturers published data.
Typical values are slightly greater than 2.
10. Some strain gages are sold with long lead wires already connected to the strain gage. This
would be an option to avoid the need to solder wires onto the strain gage.
11. Refer to Appendix C for additional information on programming the Analog Express VI.
12. Refer to Appendix E for more information about the Instrumentation Amplifier and
Breadboard Cable.

Strain Gage Measurement
Engineering Projects with NI LabVIEW and Vernier P10 - 7
PROJECT TROUBLESHOOTING
1. The Project calls for setting the Instrumentation Amplifier to the 20 mV setting. This
assumes that all 4 resistors in the Wheatstone bridge circuit are the same when no load is
applied. However, if your resistor resistance is not precise, the no-load output may be outside
of this range, and the setting will have to be changed. Try using the 200mV setting. The
instrument should still work, but the resolution of the measurements will be reduced.
2. If your voltage readings keep fluctuating, you may need to shield your device from the
surrounding electrical interference. Place a sheet of paper and then a sheet of aluminum foil
over the sensor, interface, and circuit (the paper prevents the foil from inadvertently creating
a short circuit between electrical components). The aluminum bar should remain exposed.
3. A nice addition to the circuit is to replace one of the static resistors with a variable resistance
(potentiometer). This way, the resistance on that leg of the bridge can be fine-tuned in order
to balance the bridge when no load is applied.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Modify your VI created in the Project to use your strain gage device as a penny counter. When a
stack of pennies is placed on the end of the cantilever beam, the program should be able to
determine the number of pennies in the stack and display this value on the front panel.

ADDITIONAL MATERIALS
pennies

CHALLENGE TROUBLESHOOTING
1. To make a reliable penny counter, you will need to eliminate noise on your strain gage force
measurement system built for the Project. Shielding the circuit and keeping it away from the
computer, the monitor, and power supply lines is important.
2. Be aware that pennies minted before 1983 have more mass than those minted after 1983 due
to significantly different proportions of copper and zinc. Also be sure that your pennies are
clean and free of tarnish.

Project
10
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P10 - 1T
TEACHER INFORMATION
Strain Gage Measurements
The trickiest part of this Project is building a device that works reliably. The Instrumentation
Amplifier leads are not shielded and can pick up electronic interference from computers, cell
phones, and power outlets. This can cause a noisy signal, which makes it somewhat difficult to
detect a deflection in the metal bar. Proper adhesion of the strain gages, avoidance of electronic
equipment, and shielding the amplifier leads (e.g., by lightly covering them with aluminum foil)
can help to reduce noise. Encourage your students to develop and test a good working program
to satisfy the Project Design Requirements before attempting the Challenge. The front panel
should provide the user with Waveform Charts and digital indicators for voltage and strain.

PROJECT CONSTRUCTION TIPS
Building a good, working apparatus requires great care and precision in attaching the strain
gages to the metal bar. You may wish to glue the strain gages to the bar in advance so that the
students can concentrate on the electronics and programming. If you choose to let the students
adhere the strain gages to the bar, be sure to have extras available as some will almost surely be
accidentally destroyed in the process. It is recommended that you use a strain gage adhesive and
follow the directions closely, though household cyanoacrylate glue (e.g., Super Glue

) will
work, too.
The strain gages should be mounted about 2 or 3 cm from the clamped end of the bar. The
longer, straight sections of wire inside the gage should be aligned along the length of the bar. A
breadboard is useful for building the Wheatstone bridge circuit. Notice in the photo below, we
secured the strain gage leads to the bar with short lengths of tape to prevent the leads from being
separated or damaged when the alligator clips are attached.

Figure 1 Close-up of strain gage apparatus with SensorDAQ
Project 10 Teacher Information
P10 - 2T
Engineering Projects with NI LabVIEW and Vernier

PROJECT PROGRAMMING TIPS
There are a number of ways this Project can be tackled. One suggestion is to divide the Project
Design Requirements into two parts. First, write a LabVIEW program to read raw voltage from
the Instrumentation Amplifier. Then, convert the raw voltage to strain.
Part I Read raw voltage
After students build their Wheatstone bridge circuits, they will need to write a LabVIEW
program to take readings from the Instrumentation Amplifier connected to Channel 1. Since the
most difficult part of this Project is proper adhesion of the strain gages to the bar, it will save
time and frustration to have your students initially ignore strain calculations at this time and
instead write a simple LabVIEW program to verify that their apparatus is exhibiting a change in
the readings as a load is applied and removed. A Waveform Chart with a digital indicator is a
better analysis tool than a digital indicator alone. Adding a History property node to clear the
chart at the beginning of the program will aid the user when analyzing repeated trials.

Figure 2 Sample program to read voltage in a Wheatstone bridge circuit
Tip: You can create a property node by right-clicking the Waveform Chart and selecting Create
Property Node History Data. Since the default configuration for the History Data Property
Node is a Read output terminal, you must right-click on the property node after you place it on
the block diagram and select Change All To Write. Right-click on the property node a second
time and create a constant. An empty array input will clear the chart. The History property node
should be placed outside the While Loop.
To configure the Analog Express VIs Set Timing options for an undefined experiment length,
check the box next to the Repeat option. This will allow data collection to continue indefinitely.
Note: The Averaging function should remain checked if you are using the SensorDAQ interface.
Averaging is not an option with the LabQuest interface, because it is done automatically.

Figure 3 Data Collection configuration window
Strain Gage Measurements
Engineering Projects with NI LabVIEW and Vernier P10 - 3T
Even though the Breadboard Cable is connected to Channel 2, it does not need to be configured
in the Analog Express VI. Its purpose is to send the excitation voltage to the circuit, not receive a
signal.
Part II Convert raw voltage to strain
Once students have verified that their circuits are working properly, they should add the
calculations to convert the raw voltage data into strain.

GF V
V V
ex

offset measured 2

In this equation, we suggest using 5 volts for the excitation voltage. If you prefer, have the
students measure it directly with a Voltage Probe or digital voltmeter. We also suggest using a
value of 2 as the gage factor (gage factors have no units). If you know the gage factor as listed
by the manufacturer, you can provide that value to your students.
The chance of the apparatus reading 0 V when unloaded is unlikely, so this equation incorporates
an offset value to adjust the voltage readings to a zero baseline. Running the VI a few times with
the beam unloaded will allow students to determine the offset value.

Figure 4 Sample program for measuring strain
Tip: Strain gage readings are strongly affected by temperature and electromagnetic interference.
The offset value should be checked often and adjusted as necessary.
Using a Formula Express VI rather than individual mathematical operators keeps the block
diagram cleaner. The Formula Express VI is found in the Express Arithmetic & Comparison
palette. When it is placed on the block diagram, a configuration window appears. Variable
names, such as Vmeas, Voffset, and GF, are entered into the Formulas Label controls. Then
the formula is built by pressing the calculator buttons and by pressing the X1, X2, and X3
buttons to insert the measured voltage, offset voltage, and the gage factor into the formula. The
formula is created with the measurement and the offset in voltage units. Therefore, in the block
diagram these values are converted from millivolts to volts by dividing by 1000.
Project 10 Teacher Information
P10 - 4T
Engineering Projects with NI LabVIEW and Vernier


Figure 5 Formula configuration window

CHALLENGE CONSTRUCTION TIPS
There are no additional materials required for the Challenge. For best results, make sure your
apparatus is shielded from electrical interference and is resting on a solid surface away from
vibrations.

CHALLENGE PROGRAMMING TIPS
Count pennies using a strain gage device
Modifying the VI created in the Project to be used as a penny counter will require some initial
testing to determine the voltage reading for a single penny. At such small values, this can be
extremely tricky. Rather than testing individual pennies, students might have more success
measuring groups of pennies and computing an average voltage, or using quarters or washers.
The equation below can be used to calculate the number of pennies. The offset voltage is the
voltage reading when there is no load on the bar. This equation can be programmed using a
second Formula Express VI. To distinguish between the two Formula Express VIs, however, it is
a good idea to rename them.
penny
offset measured
#
V
V V
pennies


When using the penny counter, there will always be some vibrations no matter how carefully you
place the pennies on the end of the bar. In order to get a more accurate voltage reading, we
collected an array of data points and then calculated the average using the Mean subVI (found in
the Mathematics Probability & Statistics functions palette) as shown in the figure below. We
reconfigured the Analog Express VI for multi-point sampling (this occurs at sample rates greater
than 200 samples/second) by entering a data-collection Length of 0.5 second and a Sampling
Rate of 10000 samples/second. Note: Double-click the Analog Express VI to view its
configuration window. When you wire the CH1 Auto-ID terminal on the Analog Express VI to
the Mean subVI, LabVIEW will automatically insert the Convert from Dynamic Data function.
Strain Gage Measurements
Engineering Projects with NI LabVIEW and Vernier P10 - 5T

Figure 6 Sample program to count pennies

EXTENSIONS
1. Use your device for counting other coins, such as quarters.
2. Compare the measured strain to the theoretical strain. The theoretical strain can be computed
with the equation:
EI
FLy

where is the strain, F is the applied load, L is the length of the beam to the center of the
strain gage, y is the distance to the neutral axis, E is the elastic modulus (7 x 10
10
N/m
2
for
aluminum), and I is the moment of inertia (
3
12
1
bh for a rectangular bar).

Figure 7 Cross-section of strain gage apparatus
Tip: Use another Formula Node for the computation with front panel controls for all of the
variables. Then use the Bundle function to combine the result of this Formula Node (the
theoretical strain) and the measured strain. Wire the cluster from the Bundle function to the
Waveform Chart on the front panel in order to create two separate plots on the same chart.
Project 10 Teacher Information
P10 - 6T
Engineering Projects with NI LabVIEW and Vernier

3. The actual load is a known value that the user hangs from or places on the cantilever beam.
Use the equation from Extension 2 to compute the load that is hanging from or placed on the
cantilever beam and compare this measured load to the actual load.
Tip: Add a Gauge to the front panel. Right click the gauge and select Add Needle so that
both the measured load and the actual load are visible on the gauge. Use the Bundle function
to input the two values into the gauge.
4. Connect a Vernier Dual-Range Force Sensor to the interface. Now, instead of hanging
weights of known mass, use the Force Sensor to apply and measure the load. The Analog
Express VI will need to be reconfigured to reflect a Force Sensor connected to Channel 3.
Before loading the beam, hold the Force Sensor vertically with no load on the hook and
record the reading. You will want to use this recorded value in your program as an offset, so
that the Force Sensor reads 0 when it is vertical.
F
actual
= F
measured
F
offset

Then, hang the Force Sensor from the free end of the beam, and slowly pull down on it to
deflect the beam. Compare the load as measured by the Force Sensor to the calculated load.
5. Use an electronic device to provide a warning if the load applied to the end of the beam is
too high. Connect a device (such as a buzzer or an LED) to the Vernier DCU or a digital
output line on the SensorDAQ screw terminal. Set a threshold value in your program; if the
load value is above the threshold, turn on the electronic device.
6. If you are having trouble building the strain gage apparatus, consider modifying the exercise
to use a quarter-bridge circuit. With this change, only a single gage will have to be applied.
Modify the figures and the equation to show this change. Of course the strain calculation in
the LabVIEW program will have to be slightly modified too.

Project
11
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P11 - 1
Propeller-Powered Pendulum


A pendulum is a weighted object suspended from a pivot point. As a pendulum moves, it swings
out in a circular arc moving back and forth in a periodic motion. A pendulum usually operates
under the influence of gravity; but in this Project, you will use a motorized propeller to power
the pendulums motion. The spinning blades of a propeller cause a pressure differential on the
front and back surfaces resulting in a force that moves the object through the air called thrust.
Propeller blades are attached to their hubs at an angle or pitch, much like the threads on a screw.
Propeller blades are also twisted. When the propeller is spinning, each section of the blade
travels at a different velocity, but the twist in the blade is meant to provide uniform lift along the
length of the blade making for a more efficient propeller.

PROJECT DESIGN REQUIREMENTS
Build a physical pendulum driven by a DC motor, a propeller, and a digital controller. You
should attach the motor and propeller to the end of a long bar. The Vernier Rotary Motion
Sensor will be used for mounting the bar at its pivot point and for measuring the angle of the
bars swing. You will use the Vernier Digital Control Unit (DCU) to power the motorized
propeller and initiate the swing of the bar. The program should pulse the power on and off as
needed to keep the bar swinging. For safety reasons, you should limit the range of your bars
swing to approximately 20. The bar angle should be displayed on the front panel, but the bars
motion should be controlled totally by the program.
Project 11
P11 - 2
Engineering Projects with NI LabVIEW and Vernier

MATERIALS
SensorDAQ or LabQuest interface DC motor
LabVIEW propeller
computer jumper wires
USB cable long metal bar (approx 50 cm)
Vernier Digital Control Unit (DCU) ring stand
LabQuest or LabPro power supply rod clamp
Vernier Rotary Motion Sensor rod


ADDITIONAL MATERIALS (SENSORDAQ ONLY)
Vernier Digital Proto Board Connector breadboard


PROJECT SETUP
Construct the propeller device
1. Connect a propeller to the shaft of a DC motor.
2. Connect the motor to the end of a long bar so that the motor shaft is perpendicular to the bar
(see photo above).
3. Insert a rod through the mounting hole of the Rotary Motion Sensor and tighten the thumb
screw.
4. Mount the rod to a ring stand with a rod clamp so that the shaft of the Rotary Motion Sensor
is parallel with the ground.
5. Mount the long bar to the Rotary Motion Sensor about one-third of the way up from the
motorized propeller. Note: If necessary, pre-drill a 1/8 hole in the bar to accept the thumb
screw.
6. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
Connect the motor to the DCU
1. Plug the 9-pin cable into the socket on the side of the DCU.
2. Wire the motor to the DCU cable as shown in the figure below. Use the D1 connection if you
are using a SensorDAQ and a D4 if you have a LabQuest interface. You can find the color-
coded pin-out for the DCU cable on the label attached to the cord. (Note: the reason we use
the D4 connection with LabQuest interfaces is because that connection is required for the
later parts of this chapter.)
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 3

Figure 1 Wiring diagram for DCU-controlled circuit
3. Connect a power supply to the DCU.
Tip: The performance of your motor will depend on the output characteristics of the power
supply you are using.
Connect the DCU to the interface (SensorDAQ)
1. Insert a Vernier Digital Proto Board Connector into a breadboard.
2. Wire the Digital Proto Board Connector to the SensorDAQ screw terminal using jumper
wires as shown in the figure below.

Figure 2 Digital Proto Board Connector pin-out to SensorDAQ screw terminal
3. Plug the DCU into the Digital Proto Board Connector.
Note: The digital output lines of the screw terminal are on by default. You may have to
disconnect the DCU, or power from the DCU, until you run the program for the first time.
4. The Rotary Motion Sensor should be connected to the DIG channel on the side of the
SensorDAQ.
Connect the DCU and Rotary Motion Sensor to the interface (LabQuest interface)
1. Connect the DCU to channel DIG1 on the side of the LabQuest interface.
2. The Rotary Motion Sensor should be connected to channel DIG2.

PROJECT BACKGROUND INFORMATION
In this Project, you will write a LabVIEW program to make a driven physical pendulum. You
can use the Digital Express VI (found in the Vernier functions palette) to monitor angle readings
from the Rotary Motion Sensor to provide feedback to maintain an acceptable swing range.
Project 11
P11 - 4
Engineering Projects with NI LabVIEW and Vernier

You can power your motorized propeller with the Vernier Digital Control Unit (DCU). The DCU
is an electronic device that allows you to control up to six digital output lines for on/off control
of motors and other DC electrical components. The DCU plugs into one of the digital
connections on the interface and is powered by a separate DC power supply. A 9-pin, D-sub
socket cable with bare wires on one end is supplied with the DCU for use in building projects.
There are connections for all six digital lines, plus a power connection and two ground
connections. The color code of the wires is identified on a label attached to the cable.
Always keep the power limitations of the DCU and your DCU power supply in mind. You
should not exceed 1000 mA total output current.
Controlling the DCU (SensorDAQ)
If you are using SensorDAQ, you must control the DCU from the screw terminal (screw terminal
1) using the DAQ Assistant Express VI. When the DAQ Assistant (located in the Measurement
I/O DAQmx Data Acquisition palette) is placed on the block diagram, a configuration
window appears asking you to select the type of task. For this Project, you will be Generating a
Signal. Select the Line Output option from the Digital Output dropdown list. Next, select the
Physical Channel name. If your SensorDAQ is connected to the computer and powered on, you
should select port0/line0. Unlike the Digital Express VI, which sends an output pattern of 1
to turn on the DCU, you control the DCU from the DAQ Assistant with a 1-D Boolean array
(True tells the DAQ Assistant to turn on DCU line D1, False turns D1 off). Only the top row
(the first element) of the array is used. The other rows of the array must remain empty (grayed-
out).

Figure 3 DAQ Assistant for DCU control
To make sure that the two Express VIs operate in a sequential manner, wire them together using
the Error lines.
Controlling the DCU (LabQuest interface)
The Digital Express VI can be used to control the DCU if you are using a LabQuest interface
since these interfaces have two digital ports capable of accepting BTD connectors. You must
send an output pattern indicating which digital lines should be on or off at any one time. An
output pattern of 8 will turn on DCU line D4 and a pattern of 0 will turn all lines off. You
can sample all 16 different output patterns in the configuration window of the Digital Express
VI. You will need to place separate Digital Express VIs on the block diagram for the Rotary
Motion Sensor and the DCU. In the configuration window under Channel Selection, choose DIG
Channel 1 for configuring the Rotary Motion Sensor and DIG Channel 2 when configuring the
DCU. Connect the two Digital Express VIs together using the stop (F) and stopped
terminals.

Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 5
PROJECT TIPS
1. Avoid using the Abort Execution button to stop your VI because some of the DCU lines may
remain on.
2. If using SensorDAQ, end your program by turning DCU line D1 off.
3. Make sure that all wires are away from the rotating propeller blades and that the bar is able to
swing freely.
4. Incorporate some sort of physical stop into your apparatus so that if you supply too much
voltage to the motor, the bar does not spin around in circles. For example, the rod supporting
the Rotary Motion Sensor could extend out far enough to stop the bar from rotating too far.
5. The Rotary Motion Sensor assumes the initial position of the bar is at 0; therefore, make
sure the bar has stopped swinging before restarting the program.
6. Refer to Appendix C for additional information on programming the DCU and the Digital
Express VI.
7. Refer to Appendix E for additional information on the Vernier DCU, Rotary Motion Sensor,
and Digital Proto Board Connector.

PROJECT TROUBLESHOOTING
1. Make sure the DCU is receiving power. The green LED in the top of the DCU box will be lit
when the DCU is powered on. Using the red LEDs on the DCU make sure you are turning
on the right line of the DCU to control the motor. It should be D1 if you are using a
SensorDAQ and D4 if you are using a LabQuest interface.
2. Double-check the DCU cable connections against the color-coded label attached to the cable.
3. If your pendulum appears sluggish, consider switching to a better motor or a larger propeller.
You may need to use a different power supply. The DCU will accept external supplies up to
+12V
4. Make sure you are using the same SensorDAQ that was connected to the computer when you
configured the DAQ Assistant. Switching SensorDAQs will cause an error (#-201003 or
-200478) when you run your program. See Appendix F for information about how to resolve
this problem.
Project 11
P11 - 6
Engineering Projects with NI LabVIEW and Vernier

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Write a LabVIEW program to allow a user to control the speed of the propeller motor and
thereby gently raise the pendulum from the resting state to a specific angle. The user should be
able to control the motor voltage, and indirectly the speed of the propeller, from the front panel.
The propeller and motor should be mounted as they were in the Project, that is, at the end of a
long bar. The bar should be connected to the Rotary Motion Sensor, and the bar angle should be
displayed on the front panel.
Note: There are two methods for powering the motor, depending upon the interface you are
using. All LabQuest interfaces have two DIG ports, so the fan motor can be powered with the
Vernier Digital Control Unit (DCU). Since the SensorDAQ only has one DIG port, it will be
much simpler to power the motor using an analog voltage control and the Vernier Power
Amplifier.

ADDITIONAL MATERIALS (SENSORDAQ ONLY)
Vernier Power Amplifier Vernier Analog Proto Board Connector


CHALLENGE SETUP
SensorDAQ
1. Leave the Rotary Motion Sensor connected to the DIG channel on the interface.
2. Remove the DCU from your apparatus. It will not be used in the Challenge.
3. Connect the two terminals on the DC motor to the 10V (red) and GND (black) ports on the
Vernier Power Amplifier.
4. Connect the Power Amplifier to its external power source and flip the power switch to the
On position.
5. Insert an Analog Proto Board Connector into a breadboard.
6. Plug one end of a BTA cable into the port marked Audio Input on the Power Amplifier and
the other end into the Analog Proto Board Connector.
7. Use jumper wires to connect the SensorDAQ screw terminal to the Analog Proto Board
Connector as shown in the figure below.

Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 7

Figure 4 Analog Proto Board Connector pin-out to the SensorDAQ screw terminal
LabQuest interface
1. Leave everything connected as it was in the Project. The DCU should be connected to the
DIG 1 connector and the Rotary Motion Sensor should be connected to DIG 2. The motor
should be connected to D4 of the DCU.
Note: Simply turning the voltage on or off can be done from any DIG channel on the LabQuest
interfaces, but sending a PWM signal must be done from the first DIG port, line D4. That is
why we use this line throughout this chapter.

CHALLENGE BACKGROUND INFORMATION
In the Project, we controlled the physical pendulum with a digital (on or off) output line and the
DCU. In this Challenge, the user will vary the rate at which the propeller turns. LabQuest users
will do this using a technique called pulse-width modulation (PWM). SensorDAQ users will vary
the propeller rate by directly controlling analog output.
In PWM, a short pulse, typically 12 millisecond, is sent from the controller such that the
voltage is on for a portion of the pulse and then off for the remainder of the pulse. When these
pulses are sent to the motor at a high frequency, the average voltage to the motor is reduced and
it operates at a slower speed.
The ratio of on time to total time is called the duty cycle. In the example shown below, the
pulse is on for 60% of the time. If the supply voltage is 10 volts, this results in an effective
voltage of 6 volts. The option for sending a PWM signal to the DCU through line 4, is found in
the Digital Express VI. The duty cycle is designated as a decimal value between 0 and 1. Both
the duty cycle and frequency can be regulated through front-panel controls. However, in most
cases, only the duty cycle should be modified as your LabVIEW program is running.

Figure 5 Pulse-width modulated signal
The PWM method can be somewhat cumbersome when using SensorDAQ, since it does not
have two DIG ports. The DCU would need to be wired to the screw terminal and the
programmer would need to configure the PWM signal using the DAQ Assistant. A much simpler
Project 11
P11 - 8
Engineering Projects with NI LabVIEW and Vernier

method is to use the Vernier Power Amplifier as an analog output controller. The Power Amp
Express VI (found on the Vernier functions palette) should be used to control the Power
Amplifier when writing your LabVIEW program. This Express VI sends a DC voltage signal by
default, which can be regulated with a front panel control. You can continue to use the Digital
Express VI to monitor the angle readings from the Rotary Motion Sensor.

CHALLENGE TIPS
1. Propel the bar in a direction away from the wires connecting the DC motor to ensure that the
wires do not get tangled in the propeller.
2. Incorporate some sort of physical stop into your apparatus so that if you supply too much
voltage to the motor, the bar does not rotate too far. For example, the rod supporting the
Rotary Motion Sensor could extend out far enough to stop the bar.
3. (LabQuest interface users) If the propeller motor appears sluggish, you may need to increase
the Frequency setting in the Digital Express VI. A frequency of about 100 Hz is a good
starting value. Do not change the frequency as the program is running, as this may cause an
error in the hardware. Instead, set the frequency in the Express VI prior to running your
program, and modify the duty cycle as the program runs.
4. (LabQuest interface users) If you are having trouble getting the bar to the required angle
while performing PWM output from the LabQuest, then consider trying a more powerful
power supply. The DCU can accept input voltages up to 12 V.
5. Refer to Appendix C for additional information on programming the Power Amp Express VI.
6. Refer to Appendix E for additional information on the Vernier Power Amplifier and Analog
Proto Board Connector.

EXTREME CHALLENGE DESIGN REQUIREMENTS
Modify the VI you created in the Challenge so that the propeller is automatically raised to an
exact angle of 30. Use Proportional-Integral-Derivative (PID) control so that your propeller
reaches the desired angle quickly with a minimum of overshoot and/or oscillation. Create a
Waveform Chart on the front panel for displaying a plot of the desired angle of the propeller, as
well as a second plot of the actual angle of the propeller. You should place a second Waveform
Chart on the front panel to display the motor voltage (SensorDAQ users) or the duty cycle
(LabQuest interface users).

EXTREME CHALLENGE BACKGROUND INFORMATION
When using manual control to raise the propeller to a desired angle, the operator knows
instinctively to increase the speed of the propeller for more lift or decrease the propeller speed
for less lift. However, the Extreme Challenge requires a method of automatic control for
situations in which a human operator is absent.
A feedback control system takes information on the current (and sometimes past) measurements
to influence a system. In this case, the Rotary Motion Sensor monitors the bar angle and feeds
the data back to the program which continuously adjusts the propeller speed to keep the bar as
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 9
close to the desired angle as possible (see the figure below). An ideal system would cancel out
all errors and keep the propeller at exactly the desired angle, but this can be difficult due to
measurement precision, delays in the controller response, and external air currents.

Figure 6 Feedback control loop
A PID (proportional, integral, derivative) controller is often used in control systems. It uses the
weighted sum of three corrections to quickly and smoothly adjust the voltage to the desired
condition. The proportional factor makes an adjustment to the process based on the current error,
the integral factor makes an adjustment based on the sum of recent errors, and the derivative
factor makes an adjustment based on the rate at which the error has been changing. All three
terms are then summed. This equation can be shown as:


dt
de
K dt t e K t e K t V
d i p

where K
p
is the proportional constant, e(t) is the error, K
i
is the integral constant,

dt t e is the
summation of the error and the previous error, K
d
is the derivative constant, and
dt
de
is the time
rate of change of the error. For SensorDAQ users, V(t) is the output voltage to the propeller
motor. For LabQuest interface users, V(t) represents the duty cycle.
At first glance, this equation can appear daunting, but you do not need an extensive background
in differential equations to implement this formula into your LabVIEW program. All of the terms
can be simplified to basic arithmetic.
The error in this exercise is simply the number of degrees difference (positive or negative)
between the desired angle and the measured angle.
e(t) = error = desired angle measured angle

Using one Shift Register in your LabVIEW program to store the current error value (and use it in
the next iteration as the previous error), and a second Shift Register to store the sum of the
errors, will allow you to compute (

dt t e ) (error + sum of errors) and de (error previous


error).
To get the rate of change in the error we should really use the change in the error value divided
by the time between readings (dt). By default the Digital Express VI reads the Rotary Motion
Sensor 10 times a second, and therefore, dt = 0.1 seconds/sample.
The simplified result for the PID portion of the equation can now be written as:
1 . 0 / error previous error Kd error of sum error Ki error Kp
Project 11
P11 - 10
Engineering Projects with NI LabVIEW and Vernier

The example below shows one way to program this equation.

Figure 7 Calculating the Error, Change in Error, and Sum of Errors using LabVIEW

Tuning the PID equation
Tuning the PID equation is a matter of finding the optimal K coefficients that will yield a
responsive system with minimal overshoot or oscillation. The proportional term takes into
consideration how far away the bar angle is from 30. As the difference grows or shrinks, the
influence of the proportional correction grows or shrinks. The main problem with proportional
control alone is that the bar will tend to oscillate. The derivative term can help minimize the
overshoot problem. The integral term will tend to make the error go to zero, but it also will tend
to make the overshoot worse.
The best approach for determining the correct proportional, integral, and derivative values is trial
and error. Make sure your equipment is in an isolated location so that if the long bar starts
oscillating wildly, it will not hit other people or equipment. When you write your LabVIEW
program, place a Waveform Chart on the front panel to monitor the actual angle of the bar in
relation to the desired angle. You can use a Bundle function (found in the Programming
Cluster, Class, & Variant palette) to plot both the desired and the actual bar positions on the
same chart.
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 11

Figure 8 Plotting two values on a Waveform Chart with a Bundle function

1. Set all three K coefficients to zero.
2. As you run the program, increase the proportional coefficient (K
p
) until the barbegins to
oscillate, but not wildly. Note that you are not trying to match the angle of the bar to the
desired angle at this stage.
Tip: Right-click your PID front panel controls. From the Properties window, set the Data Entry
Increment for the K constants to help you in tuning your PID system. The value of the increment
will depend on your system. We found the K
i
increment, in some cases, needed to be as small as
0.00001.
3. Next, cut K
p
in half and increase K
i
to accelerate the process. Note that the system will
probably continue to oscillate, but K
i
will quickly make the system unstable.
4. Next increase K
d
until the system stabilizes to the desired angle.
5. At this point, you should stop and restart your program, taking note of the amount of
overshoot at the beginning of your system. Adjust the K
i
value and notice how it affects how
quickly the system reaches the desired angle, and how much it overshoots. Adjust the K
d

value and note the overshoot and the ability to hold the desired angle.
6. Continue stopping and restarting your system until the overshoot is as small as possible (an
adjustment in K
d
) and the system reaches the desired angle very quickly (an adjustment in
K
i
).

EXTREME CHALLENGE TIPS
1. You may want to look up articles on PID control on the internet or in engineering books.
2. Incorporating the mathematics for a PID controller in the Extreme Challenge is not difficult,
but finding the proper constants for the proportional, derivative, and integral input
parameters can be tricky. You should program these values as controls, rather than constants,
so that you can adjust them to suit your equipment.
3. Make the K coefficients adjustable by hundredths, or thousandths of a unit.
Project 11
P11 - 12
Engineering Projects with NI LabVIEW and Vernier

4. (LabQuest interface users) If you are having trouble getting the bar to the required angle
while performing PWM output from the LabQuest, then consider trying a more powerful
power supply for the DCU.

EXTREME CHALLENGE TROUBLESHOOTING
1. If the bar appears to have reached a steady 30 angle, but the plot of the Rotary Motion
Sensor angle is not overlaying the plot of the desired angle, check to see if you are starting
the program while the propeller is still swinging. The Digital Express VI assumes the initial
angle of the bar is 0. If the bar is not in a resting position on startup, the plot will be off.
2. A common mistake when tuning the PID system is to try to match the angle of the bar to the
desired angle when adjusting only the proportional coefficient (K
p
). Students will think they
have tuned the system, but in actuality you will notice a significant amount of overshoot or
delay in reaching the desired angle when you stop and restart the program. When adjusting
the proportional coefficient, the bar should exhibit a uniform oscillation. The addition of the
integral (K
i
) and derivative (K
d
) coefficients should be used to stabilize the bar.

Project
11
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P11 - 1T
TEACHER INFORMATION
Propeller-Powered Pendulum
The Propeller-Powered Pendulum has three levels for students to try. First, students are asked to
build a physical pendulum that will automatically swing back and forth within a 20 swing
range using a digital controller. This is a good exercise for teaching students how to use the
Vernier Rotary Motion Sensor to measure and display the angle of a swinging bar. In the
Challenge, students are asked to build a manual controller to regulate the angle of the bar.
Students using a LabQuest interface will perform this task by sending a pulse-width modulated
(PWM) signal to the propeller motor via the DCU. While SensorDAQ users could also use the
PWM method, most students will find it easier to control the angle of the device with an analog
controller and the Vernier Power Amplifier. In the Extreme Challenge, students are asked to
modify their manual controllers using PID (proportional, integral, derivative) control so that the
pendulum bar is automatically raised to an exact angle with a minimum of overshoot or
oscillation.

PROJECT CONSTRUCTION TIPS
Small propellers and DC motors can be found at most hobby stores. A small DC fan also works
well as a motorized propeller and is actually a little safer to use due to its contained structure.
Just be sure if using a fan to mount it so that the axis of rotation and the fan blades are both
perpendicular to the long bar. A long bar from a metal building set, with pre-drilled holes, works
well for this Project as the swinging pendulum. The holes allow it to attach to the Rotary Motion
Sensors shaft, and it allows the balance point of the pendulum to be modified as needed.
Make sure that all wires are away from the rotating propeller blades and that the bar is able to
swing freely. You may wish to incorporate some sort of physical stop into your apparatus so that
if you supply too much voltage to the motor, the bar does not spin around in circles. For
example, the rod supporting the Rotary Motion Sensor could extend out far enough to stop the
bar from rotating too far.
If you are using a SensorDAQ to build the physical pendulum, connect the DCU to the screw
terminal, so that the Rotary Motion Sensor can be connected to the single DIG channel. You
must wire the first digital output terminal, the 5 volt source, and one ground line from the
SensorDAQ screw terminal to the corresponding connections on the DCU connector. The digital
output terminal will be used to turn the DCU line D4 on and off. The problem with this setup is
that the digital output terminal is on by default when the SensorDAQ is initially connected to the
computer. Running a program will turn the digital output lines off, but you may want to wait to
connect the DCU to the SensorDAQ until you run the program for the first time. Otherwise, the
fan will be turned on and running while the students are building their devices.
For LabQuest users, any DCU line can be used for this Project, but we suggest using D4 because
that is the line that needs to be used for the Challenge. If use it here, you will not need to change
the hardware as you move to the other parts of this chapter. Note that turning on the D4 line of
the DCU requires the DCU pattern be set to 8.
Project 11 Teacher Information
P11 - 2T
Engineering Projects with NI LabVIEW and Vernier


Figure 1 Close-up of propeller mount

PROJECT PROGRAMMING TIPS
In this Project, students must accomplish three different tasks: measure the bar angle with the
Rotary Motion Sensor, power the propeller motor with the DCU, and develop the logic to make
the motorized propeller swing back and forth like a physical pendulum. Tackling each task
separately will make programming and debugging significantly easier. Advise your students to
use caution when testing their motors because the pendulum can swing wildly.
Part I Measure the angle of the bar
The Digital Express VI found in the Vernier functions palette can be used to measure the angle
of the bar with the Rotary Motion Sensor. A Waveform Chart was used for the front panel
display. The stop (F) and stopped terminals on the Express VI should be wired as shown
below to properly stop the hardware before program execution ends.
Note: SensorDAQ users should be aware that there was a bug in the NI-DAQmx driver software
that caused the Rotary Motion Sensor to only be able to read angles in one direction. This bug
was in DAQmx versions 9.1 and 9.2. If you find that the sensor only reads in one direction you
should update to version 9.3 or newer.
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 3T

Figure 2 Sample program to measure bar angle with the Rotary Motion Sensor
Tip: Adding a History property node to clear the Waveform Chart at the beginning of the
program will aid the user when analyzing repeated trials. You can create this property node by
right-clicking the Waveform Chart and selecting Create Property Node History Data.
Since the default configuration for the History Data Property Node is a Read output terminal,
you must right-click the property node after you place it on the block diagram and select Change
All To Write. Right-click the property node a second time and create a constant. An empty array
input will clear the chart. The History property node should be placed outside the While Loop.
Part II Control a motor with the DCU (SensorDAQ)
SensorDAQ users are accessing the second digital connection from the screw terminal, so they
must use the DAQ Assistant Express VI to control the motor with the DCU. The DAQ Assistant
(located in the Measurement I/O DAQmx Data Acquisition palette) is a generic Express VI
designed for many pieces of hardware. When the DAQ Assistant is placed on the block diagram,
a configuration window appears asking you to designate the type of task. Select Generate
Signals, and then select the Line Output option under Digital Output.

Figure 3 Configuration window for the DAQ Assistant
Project 11 Teacher Information
P11 - 4T
Engineering Projects with NI LabVIEW and Vernier

Next, you must select the channel. If the SensorDAQ is connected to the computer, the channel
name port0/line0 will appear in the configuration window. All other default settings should
remain the same.

Figure 4 Channel selection window for the DAQ Assistant
One example that can be used to power the motor is shown in the following diagram. Notice that
the DAQ Assistant requires a 1-D Boolean array to turn the DCU on or off. Only the top row
(the first element) of the array is used. A DAQ Assistant inside the While Loop with an input
value of True turns the motor on. The screw-terminal digital output lines default to On, so when
the loop ends, it is a good idea to add a second DAQ Assistant, placed outside the loop, with an
input of False, to stop the motor.

Figure 5 Sample program to control a motor with SensorDAQ

Part II Control a motor with the DCU (LabQuest interface)
LabQuest interface users can control a motor with a second Digital Express VI, as shown below.
Notice that we placed a temporary control on the front panel to manually turn the propeller
motor on or off and ensure that it is spinning. A DCU pattern of 8 will turn the motor on, and a
pattern of 0 will turn the motor off.

Figure 6 Sample program to control a motor with a LabQuest interface
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 5T
Part III Make the propeller swing like a pendulum
There are many ways to tackle the logic of this program. One solution is shown in the figures
below. The fan turns on any time the pendulum is between 1 and 20 degrees. This starts the
pendulum swinging from rest and provides decent results. The fan will be on when the pendulum
is at the bottom of its swing while it is going either direction.
More elegant examples, with smoother motion, could certainly be devised. Try minimizing the
range of angles through which the fan will be turned on and only turn the fan on as the pendulum
swings in the direction of the fans thrust. The use of Shift Registers may be useful for
expanding the logic of this Project.

Figure 7 Sample program to control a physical pendulum with SensorDAQ

Figure 8 Sample program to control a physical pendulum with a LabQuest interface

CHALLENGE CONSTRUCTION TIPS
SensorDAQ
If students are using a SensorDAQ for the Challenge, they will need to disconnect the motor
from the DCU and connect it to the Power Amplifier. The Power Amplifier will be connected to
an Analog Proto Board Connector which is wired to the SensorDAQ screw terminal.
Project 11 Teacher Information
P11 - 6T
Engineering Projects with NI LabVIEW and Vernier

LabQuest interface
Make sure that you have a motor/DCU power supply combination that works well when using
PWM output. For example, you do not want a 6 volt motor and a 10 volt DCU power supply
running at a 60% duty cycle. Even though this provides the equivalent of 6 volts, you are still
hitting your motor with 10 volt signals, and this might not be okay for your motor. On the other
hand, if you have a motor rated at 6 volts that can barely lift your pendulum with 6 volts, you
will not have good luck varying the duty cycle. The power that the DCU can deliver depends on
its power supply. The DCU has input connectors for both the LabQuest power module and the
LabPro power module, which deliver 5 V and 6 V respectively. If more power is needed, the
DCU will accept inputs up to 12 V from an external source.

CHALLENGE PROGRAMMING TIPS
The program for the Challenge is significantly simpler than the program used for the Project
Design Requirements, so it makes sense to start with a new blank VI. First activate the motor
with either the Power Amplifier (SensorDAQ) or a PWM signal (LabQuest interface). The
motors speed can be regulated with a control, such as a Dial or a Slide, on the front panel.
Writing this portion of the program first will allow your students to check that their apparatus is
setup and working properly. Next modify the program to read and display the bar angle from the
Rotary Motion Sensor.
Part I Activate a DC motor and control its speed (SensorDAQ)
After students modify their propeller devices, they will need to write a LabVIEW program to
manually control the motor voltage with the Power Amplifier. Encourage students to ignore the
bar angle at this phase in order to allow them to check that their Power Amplifier has been wired
properly and is communicating with the interface.
Note: When you wire from the SensorDAQ screw terminal to the Power Amplifier Audio Input
LP connector, the voltage sent out from the SensorDAQ is doubled. While the SensorDAQ
alone can supply between 0 and 5 volts, the Power Amplifier doubles the output to 010 volts.
This voltage doubling is taken care of in the Power Amplifier Express VI. The voltage specified
in this Express VI is the voltage out of the Power Amplifier.
One example that satisfies the Challenge Design Requirements is displayed in the following
diagram. Notice that the stop (F)/stopped terminals on the Power Amp Express VI should be
wired as shown to ensure that the fan motor is turned off when program execution stops.

Figure 9 Sample program to power a motor with the Power Amplifier
Part I Activate a DC motor and control its speed (LabQuest interface)
LabQuest interface users can control the motor voltage by adjusting the duty cycle on a PWM
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 7T
signal. The Pulse Train Generation option is found in the Digital Express VI as shown below.
Notice that students can test the impact of a PWM signal on their motors speed by adjusting the
Duty Cycle in the configuration panel and then pressing the Run button at the top of the setup
window. You may also need to increase the Frequency depending on the weight of your bar. We
used a value of 100 Hz in our sample program.
Tip: The PWM signal is only available on the LabQuest if the DCU is connected to DIG 1 and is
only available on line D4 from the DCU. The motor must be wired between D4 and one of the
ground lines.

Figure 10 Configuration window for Pulse Train Generation
One example that satisfies the Challenge Design Requirements is displayed in the following
diagram. Notice that the stop (F)/stopped terminals on the Digital Express VI should be wired
as shown in order to ensure that the fan motor is turned off when program execution stops.

Figure 11 Sample program to power a motor with a PWM signal
Project 11 Teacher Information
P11 - 8T
Engineering Projects with NI LabVIEW and Vernier

Part II Read and display angle values
The Digital Express VI found in the Vernier functions palette can be used to perform data
collection with the Rotary Motion Sensor. The initial angle measurement is assumed to be 0, so
care should be taken when starting the program that the bar is not swinging.

Figure 12 Sample program to manually control the angle of a motorized propeller with
SensorDAQ

Figure 13 Sample program to manually control the angle of a motorized propeller with a
LabQuest interface

EXTREME CHALLENGE CONSTRUCTION TIPS
No additional materials are required for the Extreme Challenge.

EXTREME CHALLENGE PROGRAMMING TIPS
PID Control systems are a complicated concept and you will probably need to go over it with
your students. National Instruments has a good article titled PID Theory Explained on its web
site. You may want to refer students to it or other internet references on PID control systems.
Monitor voltage using a PID controller
Incorporating the mathematics for a PID controller is not difficult, but finding the proper
constants for the proportional, derivative, and integral input parameters can be tricky. Students
should program these inputs as adjustable front panel controls, rather than constants, for easier
PID tuning.
Propeller-Powered Pendulum
Engineering Projects with NI LabVIEW and Vernier P11 - 9T
There are several ways to program the PID equation in LabVIEW. The PID eqution that you will
be programming is:


dt
de
K dt t e K t e K t V
d i p


One way is to use the individual mathematical operators from the Numeric functions palette, as
shown in the figure below. Note that the text boxes sprinkled throughout the figure are non-
functioning labels used to aid readability. A Shift Register (located at the top of the diagram) is
used to store the current error so it can be used in the next iteration as the previous error. A
second Shift Register is used to store the sum of the errors. To make a Shift Register, right-click
the border of the While Loop and select Add Shift Register. Add a zero constant to initialize the
Shift Register for the first iteration of the loop. A Bundle function (found in Programming
Cluster, Class, & Variant) was added to allow the desired angle to be plotted along with the
measured angle on the Waveform Chart. History property nodes were created on the left side of
the program for both Waveform Charts to clear all previous plots when restarting the program.
On the right side of the program, the In Range and Coerce function (found in the Programming
Comparison palette) was used after all the PID calculations were completed to limit the input
to the Express VI: 0.110 V for the output voltage to the Power Amp Express VI (SensorDAQ
users) or 01 for the duty cycle to the second Digital Express VI (LabQuest interface users).

Figure 14 Sample program showing PID control of a
motorized propeller with a LabQuest interface

Project 11 Teacher Information
P11 - 10T
Engineering Projects with NI LabVIEW and Vernier


Figure 15 Sample program showing PID control of a motorized propeller with a SensorDAQ

EXTENSIONS
1. Connect a Vernier Temperature Probe to CH1 of the interface. Then, write a LabVIEW
program to swing the propeller to the right if the temperature is above a user-defined set
point or to the left if the temperature is below the set point. In order for the propeller to swing
in opposite directions, you must connect one motor wire to digital line D1 on the DCU and
the other motor wire to digital line D2 (there will be no connection to GND). When DCU
line D1 is activated, the motor will turn in one direction (either clockwise or
counterclockwise) and when DCU line D2 is activated, the motor will turn in the opposite
direction.
2. Write a program to allow the user the option of using manual control or automatic (PID)
control for the bar angle.
3. Modify the PID controller to allow the user to select different bar angles from a front panel
control.
4. Some versions of LabVIEW come with VIs for PID control. If you have access to these VIs,
have students try them out in place of the simple PID control system they built in the
Extreme Challenge. Search for PID.vi and PID Advanced.vi on your LabVIEW functions
palette.

Project
12
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P12 - 1
PID Ping-Pong

Ball Levitation


Levitation is a process in which an object is suspended against gravity by a physical force. Many
methods can be used as the levitating medium, including magnetic repulsion, viscous liquids,
sound waves, and air currents. In this Project, we will use an air stream provided by a fan to
provide the levitating force on a Ping-Pong ball. Controlling the Ping-Pong ball is not easy, but
you can build a good controls system using LabVIEW that can work well.
The photo above shows the setup for the Challenge.
Project 12
P12 - 2
Engineering Projects with NI LabVIEW and Vernier

PROJECT DESIGN REQUIREMENTS
In this Project, you will build a device to levitate a Ping-Pong ball in a long vertical tube using
the force of air. You will use a small DC fan to provide the lift force for the Ping-Pong ball. The
fan should be secured to the bottom of the tube in such a way that there is an air-tight seal
between the sides of the fan and the tube, but that the top and bottom of the fan are open to
provide air intake and exhaust. Your LabVIEW program should allow the user to control the
speed of the fan (the lift force on the ball) from the front panel via a voltage control to the fan
motor. When program execution ends, the fan should automatically turn off.
Note: There are two methods for powering the fan motor depending upon the interface you are
using. All LabQuest interfaces have two DIG ports, so the fan motor can be powered with the
Vernier Digital Control Unit (DCU). Since the SensorDAQ only has one DIG port, it will be
much simpler to power the fan motor using an analog voltage control and the Vernier Power
Amplifier.

MATERIALS
SensorDAQ or LabQuest interface Ping-Pong ball
LabVIEW ring stand
computer 3-finger clamp
USB cable Styrofoam block
small DC fan long hollow plastic tube


ADDITIONAL MATERIALS (SENSORDAQ ONLY)
Vernier Power Amplifier breadboard
Vernier Analog Proto Board Connector jumper wires


ADDITIONAL MATERIALS (LABQUEST INTERFACE ONLY)
Vernier Digital Control Unit (DCU) LabQuest or LabPro power supply

PROJECT SETUP
Build a levitation chamber
1. Cut a hole through the Styrofoam block that is the same diameter as the long plastic tube.
Insert the tube into one end of the block (it should fit snugly with no air leaks).
2. Insert or mount the DC fan to the other end of the Styrofoam block. The lead wires of the fan
should extend away from the tube and block.
3. Use a ring stand and 3-finger clamp to support the tube and block so that the tube is oriented
vertically, and the Styrofoam block is positioned 25 cm (13 in) above the ground to allow
air flow to the fan.
Connect the fan to the Power Amplifier (SensorDAQ)
1. Connect the positive (red) lead of the fan to the 10V (red) terminal on the Power Amplifier.
Connect the negative (black) lead of the fan to the GND (black) terminal.
PID Ping-Pong Ball Levitation
Engineering Projects with NI LabVIEW and Vernier P12 - 3
2. Insert a Vernier Analog Proto Board Connector into a breadboard.
3. Connect one end of a BTA cable to the port marked Audio Input on the Power Amplifier and
the other end into the Analog Proto Board Connector.
4. Use jumper wires to connect the SensorDAQ screw terminal to the Analog Proto Board
Connector, as shown in the figure below.

Figure 1 Analog Proto Board Connector pin-out to the SensorDAQ screw terminal
5. Connect the Power Amplifier to its external power source and flip the power switch to the
On position.
6. Connect the SensorDAQ to the computer.
Connect the fan to the DCU (LabQuest interface)
1. Plug the 9-pin cable into the socket on the side of the DCU.
2. Wire the motor to the DCU line 4 as shown in the figure below. You can find the color-coded
pin-out for the DCU cable on the label attached to the cord.

Figure 2 Wiring diagram for DCU-controlled circuit
3. Connect a power supply to the DCU.
4. Connect the DCU to channel DIG1 on the side of the LabQuest interface.
Note: Simply turning the voltage on or off can be done from either DIG channel, but sending a
PWM signal must be done from the first DIG port, line 4.
5. Connect the interface to the computer. If you are using a LabQuest interface with a power
button, make sure it is turned on.
Project 12
P12 - 4
Engineering Projects with NI LabVIEW and Vernier

PROJECT BACKGROUND INFORMATION
SensorDAQ
In this Project, the user will be controlling the rate at which the air moves past the Ping-Pong
ball, with a variable voltage control on the fan. The Vernier Power Amplifier should be used for
this Project, because it has the ability to output an analog signal unlike a digital device (such as
the Vernier Digital Control Unit). The Power Amplifier also allows you to drive loads that
typically draw more power than the signal source can deliver.
The Power Amp Express VI (found on the Vernier functions palette) should be used when
writing your LabVIEW program. This Express VI sends a DC voltage signal by default that can
be regulated with a front-panel control.
LabQuest interface
In this Project, you are asked to levitate a Ping-Pong ball using the force of air. LabQuest
interface users should use the Vernier Digital Control Unit (DCU) to provide power to the fan.
The DCU is an electronic device that allows you to control up to six digital output lines for
on/off control of motors and other DC electrical components. The DCU plugs into one of the
digital connections on the interface and is powered by a separate DC power supply. A 9-pin, D-
sub socket cable with bare wires on one end is supplied with the DCU for use in building
projects. There are connections for all six digital lines, plus a power connection and two ground
connections. The color code of the wires is identified on a label attached to the cable. Always
keep the power limitations of the DCU and your DCU power supply in mind. You should not
exceed 1000 mA total.
The user will be controlling the rate at which the air moves past the Ping-Pong ball with a
technique called pulse-width modulation (PWM). In PWM, a short pulse, typically 12
millisecond, is sent from the controller such that the voltage is on for a portion of the pulse and
then off for the remainder of the pulse. When these pulses are sent to the motor at a high
frequency, the average voltage to the motor is reduced and it operates at a slower speed.
The ratio of on time to total time is called the duty cycle. In the example shown below, the
pulse is on for 60% of the time. If the supply voltage is 10 volts, this results in an effective
voltage of 6 volts. The option for sending a PWM signal to the DCU, through line 4, is found in
the Digital Express VI. The duty cycle is designated as a decimal value between 0 and 1. Both
the duty cycle and frequency can be regulated through front-panel controls. However, in most
cases, only the duty cycle should be modified as your LabVIEW program is running.

Figure 3 Pulse-width modulated signal

PROJECT TIPS
1. One method of cutting the hole in the Styrofoam block is to push and twist the plastic tube
through it.
PID Ping-Pong Ball Levitation
Engineering Projects with NI LabVIEW and Vernier P12 - 5
2. The long tube should be vertically aligned when viewed from all directions to minimize
friction between the ball and the tube.
3. Provide 25 cm (13 in) of air space underneath the fan for air intake.
4. Avoid using the Abort Execution button to stop your VI or the fan may continue spinning.
5. Refer to Appendix C for additional information on programming the DCU, and the Digital
and Power Amp Express VIs.
6. Refer to Appendix E for additional information on the Vernier Power Amplifier, DCU, and
Analog Proto Board Connector.

PROJECT TROUBLESHOOTING
1. You can test-run your fan motor from the configuration window of the Power Amp or Digital
Express VIs to ensure that all of your electrical connections are working properly.
2. Check the direction of air flow from the fan. It should be blowing air up into the tube, not
exhausting air out the bottom of the tube.
3. Check for air leaks between the fan and the Styrofoam block.

CHALLENGE DESIGN REQUIREMENTS
Note: Do not attempt the Challenge until you have completed the Project Design Requirements.
Add a Vernier Motion Detector to the top of the tube. Then, modify your VI created in the
Project to levitate the Ping-Pong ball at an exact distance of 30 cm away from the Motion
Detector using Proportional-Integral-Derivative (PID) control. Your device should raise the ball
to this position as quickly as possible with a minimum of oscillation. Create a Waveform Chart
on the front panel to display a plot of the desired position of the ball and a second plot to display
the actual position of the ball. Place a second Waveform Chart on the front panel to display the
motor voltage (SensorDAQ) or the duty cycle (LabQuest interface).

ADDITIONAL MATERIALS
Vernier Motion Detector rod clamp


CHALLENGE SETUP
Connect a Motion Detector to the levitation device
1. Position the Motion Detector about 5 cm above the top of the tube using a rod clamp. The
gold circular sensor should be centered exactly above the tube opening and pointing
downward.
Tip: The Motion Detector has a pivoting head to aid in positioning the sensor. Simply rotate the
detector head away from the detector body.
Project 12
P12 - 6
Engineering Projects with NI LabVIEW and Vernier

2. If your Motion Detector has a sensitivity switch on the Motion Detector , set it to the Cart
setting. The sensitivity switch is located under the pivoting detector head.
3. Connect the Motion Detector to the unused DIG port on the interface.

CHALLENGE BACKGROUND INFORMATION
In the Challenge, you are asked to levitate the Ping-Pong ball at an exact position away from the
Motion Detector. You can use the Digital Express VI (found in the Vernier functions palette) to
monitor position readings with the Motion Detector. When using a front panel control, as in the
Project, the user can raise the ball to the desired position fairly quickly by increasing the voltage
to the fan for more lift and then decreasing the voltage to maintain that lift. However, in this
Challenge, the program needs a method of control in the absence of a human operator.
A Proportional-Integral-Derivative (PID) controller uses the weighted sum of three error terms to
quickly and smoothly adjust the ball to the desired position. The proportional term takes into
consideration how far away the Ping-Pong ball is from the desired position. As the difference
grows or shrinks, the influence of the proportional term grows or shrinks. The main problem
with proportional control alone is that the ball tends to oscillate up and down. You could
increase the voltage to the fan at a very slow rate to avoid oscillating the ball, but keep in mind
that your goal is to get the ball to its desired position as quickly as possible. Addition of the
integral term will accelerate the ball towards the desired position. However, since the integral
term is accelerating the process, it can cause the ball to overshoot and even fly out of the tube. A
derivative term is added to reduce the amount of overshoot. This equation can be shown as:


dt
de
K dt t e K t e K t V
d i p

where K
p
is the proportional constant, e(t) is the error, K
i
is the integral constant,

dt t e is the
summation of the error and the previous error, K
d
is the derivative constant, and
dt
de
is the time
rate of change of the error. For SensorDAQ users, V(t) is the output voltage to the fan motor. For
LabQuest interface users, V(t) represents the duty cycle.
This equation may appear intimidating, but you do not need an extensive background in
differential equations to use it in your LabVIEW program. All of the terms can be simplified to
basic arithmetic. Lets start with the error since it is used three times in the equation. The error
in this exercise is simply the difference (positive or negative) in centimeters between the actual
position of the ball in relation to the Motion Detector and the desired position. Remember, the
detector is above the ball, so you should not think of the balls position in terms of its height
above the floor.
e(t) = error = measured position desired position

If the ball is too low, the measured distance from the Motion Detector will be too large and the
error will be positive.

PID Ping-Pong Ball Levitation
Engineering Projects with NI LabVIEW and Vernier P12 - 7
Using one Shift Register in your LabVIEW program to store the current error value (and use it in
the next iteration as the previous error), and a second Shift Register to store the sum of the
errors, will allow you to compute (

dt t e ) (error + sum of errors) and de (error previous


error).
To get the rate of change in the error, we should really use the change in the error value divided
by the time between readings (dt). By default the Digital Express VI reads the Motion Detector
20 times a second, and therefore, dt = 0.05 seconds/sample.
The simplified result for the PID portion of the equation can now be written as:
05 . 0 / error previous error Kd error of sum error Ki error Kp

Figure 4 Calculating the Error, Change in Error, and Sum of Errors using LabVIEW

Tuning the PID equation
Tuning the PID equation is a matter of finding the optimal K coefficients that will yield a
responsive system with minimal overshoot or oscillation. The best approach is trial and error.
Make sure your equipment is in an isolated location so that if the Ping-Pong ball happens to fly
out of the tube, it will not hit other people or equipment. When you write your LabVIEW
program, place a Waveform Chart on the front panel to monitor the balls position in relation to
the desired position.
You can use a Bundle function (found in the Programming Cluster, Class, & Variant palette)
to plot both the desired and the actual ball positions on the same chart.
Project 12
P12 - 8
Engineering Projects with NI LabVIEW and Vernier


Figure 5 Plotting two values on a Waveform Chart with a Bundle function
1. Set all three K coefficients to zero.
2. As you run the program, increase the proportional coefficient (K
p
) until the ball begins to
oscillate a little bit up and down, but not wildly. Note that you are not trying to match the
position of the ball to the desired position at this stage.
Tip: From the Properties window, set the Data Entry Increment for the K constants to help you
in tuning your PID system. The value of the increment will depend on your system, but we found
the K
i
increment, in some cases, needed to be as small as 0.00001.
3. Next, cut K
p
in half and increase K
i
to accelerate the process. Note that the system will
probably continue to oscillate, but K
i
will quickly make the system unstable
4. Next increase K
d
until the system stabilizes to the desired position.
5. At this point, you should stop and restart your program taking note of the amount of
overshoot at the beginning of your system. Adjust the K
i
value and notice how it affects how
quickly the system reaches the desired position, and how much it overshoots. Adjust the K
d

value and note the overshoot and the ability to hold the desired position.
6. Continue stopping and restarting your system until the overshoot is as small as possible (an
adjustment in K
d
) and the system reaches the desired angle very quickly (an adjustment in
K
i
).

CHALLENGE TIPS
1. You may want to look up articles on PID control on the internet or in engineering books.
2. Make sure that you define the error as the difference between the measured position and the
desired position, so that the error comes out positive when the ball is too low.
3. Make sure that you have programmed the mathematics correctly or your system will be
unstable and impossible to tune properly.
4. Make sure that the Motion Detector is sensing the entire length of the tube. If the detector is
positioned too far above the tube, it will detect the lip of the tube and not the Ping-Pong ball.
PID Ping-Pong Ball Levitation
Engineering Projects with NI LabVIEW and Vernier P12 - 9
5. (LabQuest interface users) If you are having trouble getting the ball to the required position
while performing pwm output from the LabQuest, then consider trying a more powerful
power supply for the DCU. The DCU can accept external power supplies up to 12V.
6. Refer to Appendix E for additional information about the Vernier Motion Detector.

CHALLENGE TROUBLESHOOTING
A common mistake when tuning the PID system is to try to match the position of the ball to the
desired position when adjusting the K
p
coefficient. You may think you have tuned the system,
but in actuality you will notice a significant amount of overshoot or delay in reaching the desired
position. When adjusting the K
p
coefficient, the ball should exhibit a uniform oscillation about
the desired position. The addition of the K
i
and K
d
coefficients should be used to level out the
ball.
Project
12
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P12 - 1T
TEACHER INFORMATION
PID Ping-Pong

Ball Levitation
Encourage your students to work towards creating a simple, concise program. In the Project, the
user must be able to control the voltage applied to the fan in order to change the height of the
Ping-Pong ball. Your students should build and test a good working levitation device to
manually control the Ping-Pong ball before attempting to levitate the ball automatically with PID
control in the Challenge.

PROJECT CONSTRUCTION TIPS
The construction for a levitation device is not very complicated, but aligning the parts properly is
critical for your success. The easiest way to make a tight-fitting hole in the Styrofoam block for
the plastic tube, as shown in the figure below, is to use the tube itself. Simply position the tube
on top of the block, and then firmly push downward with a twisting motion. We used plastic
tubes that are sold for use in protecting fluorescent bulbs. It is the proper diameter for a Ping-
Pong ball to move up and down the tube with minimal friction. This method gave us an
acceptably tight fit with no air leaks.

Figure 1 Close-up of fan mount
Next, we inserted our fan into the bottom of the hole. If your fan is larger, you may need to
mount it to the underside of the Styrofoam block with some adhesive or caulk. Make sure the fan
is positioned correctly so that the air blows up into the tube and not out the bottom of the hole.
When setting up your device for testing, be sure to position the Styrofoam block so there is about
25 cm (12 in) of air space underneath the fan. We used a 3-finger clamp and ring stand to
support the top of the tube. You may need to use a level to make sure the tube is vertically
aligned.
Project 12 Teacher Information
P12 - 2T
Engineering Projects with NI LabVIEW and Vernier

PROJECT PROGRAMMING TIPS
SensorDAQ
In this Project, students will be sending a voltage to a DC fan using the Vernier Power
Amplifier. When you wire from the SensorDAQ screw terminal to the Power Amplifier Audio
Input LP connector, the voltage sent out from the SensorDAQ is doubled. While the
SensorDAQ alone can supply between 0 and 5 volts, the Power Amplifier doubles the output to
010 volts. This voltage doubling is taken care of in the Power Amplifier Express VI. The
voltage specified in this Express VI is the voltage out of the Power Amplifier.
One example that satisfies the Project Design Requirements is displayed in the following
diagram. Notice that the stop (F)/stopped terminals on the Power Amp Express VI should be
wired as shown in order to ensure that the fan motor is turned off when program execution stops.

Figure 2 Sample program for manual control of a fan using a SensorDAQ
LabQuest interface
LabQuest interface users can control the fan motor voltage by adjusting the duty cycle on a
PWM (pulse-width modulated) signal. The Pulse Train Generation option is found in the Digital
Express VI, as shown below. Notice that students can test the impact of a PWM signal on their
motors speed by adjusting the Duty Cycle in the configuration panel and then pressing the Run
button at the top of the setup window. You may also need to increase the Frequency depending
on the friction between the ball and the tube. We used a value of 100 Hz in our sample program.

Figure 3 Configuration window for Pulse Train Generation with the DCU
One example that satisfies the Project Design Requirements is displayed in the following
Ping-Pong Ball Levitation Chamber
Engineering Projects with Vernier & LabVIEW 12 - 3T
diagram. Notice that the stop (F)/stopped terminals on the Digital Express VI should be wired
as shown to ensure that the fan motor is turned off when program execution stops. Since this
system is quite nonlinear, the increment on the Duty Cycle control should be set to 0.01 or 0.001
to achieve good control.

Figure 4 Sample program for manual control of a fan with a LabQuest interface

CHALLENGE CONSTRUCTION TIPS
In the Challenge, students will be using a Motion Detector at the
top of the tube to measure the position of the Ping-Pong ball. If
your ring stand is long enough, you can add a rod clamp above
the 3-finger clamp to support the Motion Detector, as shown in
the figure to the right. Position the Motion Detector about 25 cm
(12 in) above the top of the tube with the gold circular sensor
centered exactly above the tube opening and pointing downward.
Make sure that the Motion Detector is sensing the entire length of
the tube. If the detector is positioned too far above the tube, it
will detect the lip of the tube and not the ball.
Note: (LabQuest interface users) The PWM signal is available
from the DIG1 port, on line D4 of the DCU.

CHALLENGE PROGRAMMING TIPS
Monitor voltage using a PID controller
The programming for the Challenge is significantly more involved than the programming for the
Project. One possible solution is shown in the figures below. Students should program some of
the terms in the equation (such as the K coefficients) as front panel controls to aid in tuning the
system. Note that the text boxes sprinkled throughout the figure are non-functioning labels used
to aid readability.
Figure 5 Close-up of Motion
Detector mount
Project 12 Teacher Information
P12 - 4T
Engineering Projects with NI LabVIEW and Vernier


Figure 6 Sample program for PID control of a fan using a SensorDAQ

Figure 7 Sample program for PID control of a fan using a LabQuest interface
The Digital Express VI was configured to monitor distance from the Motion Detector in
centimeters with a Sampling Rate of 20 samples/second. This corresponds to a change in error of
0.05 seconds/sample in the PID equation. A Bundle function (found in Programming Cluster,
Class, & Variant) was added to allow the desired position to be plotted along with the measured
position. A Property Node was also created for the Waveform Chart in order to clear all data
each time the program is rerun. A Shift Register (located at the top of the diagram on the border
of the While Loop) stores the current error so it can be used as the previous error in the next
iteration. A second Shift Register is used to store the sum of the errors.
To make a Shift Register, right-click the border of the While loop and select Add Shift Register.
Add a zero constant to initialize the Shift Register for the first iteration of the loop. Notice that
we used the In Range and Coerce function (found in the Programming Comparison palette),
after the PID calculations were completed, to limit the input to the Express VI: 010 V for the
output voltage to the Power Amp Express VI (SensorDAQ users) or 01 for the duty cycle to the
second Digital Express VI (LabQuest interface users).
National Instruments has a good article titled PID Theory Explained on its web site. You may
want to refer students to it or other internet references about PID control systems.

Ping-Pong Ball Levitation Chamber
Engineering Projects with Vernier & LabVIEW 12 - 5T
EXTENSIONS
1. Modify your PID controller to allow the user to choose between two different values for the
height of the Ping-Pong ball.
2. Write a LabVIEW program to allow the user to control the desired position of the Ping-Pong
ball using a Vernier Hand Dynamometer.
3. P controllers (Proportional), PD controllers (Proportional-Derivative), and PI controllers
(Proportional-Integral) are also used in real world applications. PI controllers are fairly
common in stable or shielded systems, since the derivative term is mainly used to counteract
measurement noise. PD controllers are not as common, because the absence of the integral
term may prevent the system from reaching the target value. Investigate the other three types
of controllers by eliminating the corresponding term(s) in the original PID equation and re-
tuning the system. Place a control on the front panel that will allow the user to choose
between one of the three controller types or to choose manual control.
4. Some versions of LabVIEW come with VIs for PID control. If you have access to these VIs,
have students try them out in place of the simple PID control system they built in the
Challenge. Search for PID.vi and PID Advanced.vi on your LabVIEW functions palette.
Appendix
A
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology A - 1
Using the CD

The CD located inside the back cover of this book contains the following:

Student Handouts Contains the word-processing files for each of the student projects in
this book. They are in Microsoft Word format and can be modified by the instructor.

LabVIEW VIs Contains functional .vi files for each of the student activities (Projects.
Challenges, and Extreme Challenges) in this book. These VIs can be used with any version
of LabVIEW from 2009 and newer. Instructors may want to give some of these VIs, or parts
of them, to their students to make Projects or Challenges easier. There are two different
versions, depending on the interface used:

SensorDAQ The folder SensorDAQ VIs is for use with the Vernier SensorDAQ
interface and versions of LabVIEW.

LabQuest The folder LabQuest VIs is for use with anyVernier LabQuest interface and
versions of LabVIEW.

USING THE WORD-PROCESSING FILES
Start Microsoft Word or another word processor capable of opening Microsoft Word files. Open
the file of your choice from the Chapters folder. Files can be opened directly from the CD or
copied onto your hard drive first. These files can be used with Microsoft Word 97 or newer. All
file names begin with the project number, followed by an abbreviation of the title.
This provides a way for you to edit the content and activities to match your situation, your
equipment, or your style of teaching. The files contain all figures, text, and tables in the same
format as printed in Engineering Projects with NI LabVIEW and Vernier.

Appendix
B
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology B - 1
Installing the Vernier Toolkit
This book requires that your Vernier functions palette includes an Analog Express VI, Digital
Express VI, Power Amplifier Express VI, and other VIs. The Vernier Toolkit that contains all of
these Express VIs was developed after the introduction of LabVIEW 2009. These files will not
work with earlier versions of LabVIEW.

SOFTWARE INSTALLATION
1. Install LabVIEW. If LabVIEW is already installed on your computer, check the version of
LabVIEW you are using. You must use LabVIEW version 2009 or newer.
2. Run the appropriate installer for the Vernier Toolkit. You can download the installers from
the Vernier website, www.vernier.com/labview/downloads.
3. (SensorDAQ and Windows only) If you are using a version of LabVIEW that is not the
Education Edition, you will need to install the SensorDAQ driver (NI-DAQmx) separately.
In order to work correctly, you will need to install NI-DAQmx 9.4 or newer.
4. The example VIs for the book are found on the CD at the back of the book. Once LabVIEW
and the Vernier Toolkit are installed you will be able to run the examples.



Appendix
C
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology C - 1
Vernier Functions Palette
OVERVIEW
Vernier offers several options for program development when building your engineering
projects. Over 100 Express VIs, subVIs, and low-level drivers specifically tailored to the
SensorDAQ and LabQuest interfaces are available on the LabVIEW functions palette. These
functions allow you to perform data collection and analysis with Vernier sensors, control motors,
and build digital systems, to name just a few examples.
The three most common tools that you will use to control Vernier sensors and accessories are the
Analog Express VI, Digital Express VI, and Power Amp Express VI. As the names imply, the
Analog Express VI controls all Vernier analog sensors (there are over 50), the Digital Express VI
controls some of the Vernier digital sensors, and the Power Amp Express VI controls the Vernier
Power Amplifier. Notice in the figure below that there are two separate Vernier palettesone for
LabQuest interfaces and one for the SensorDAQ interface. These palettes look almost identical
and contain similar Express VIs and subVIs, however you must select functions from the palette
that correspond to your interface to avoid a programming error. There are subtle differences in
the processing capabilities of the interfaces that require unique function calls.

Figure 1 Vernier functions palette
If your palette does not match the figure above, or you cannot find it, then the latest Vernier
Toolkit has not been installed. Delete any previous Vernier folders and reinstall the latest
Vernier Toolkit. See Appendix B for instructions.

NOTES ON SCREENSHOTS
You may find that the screenshots for this book do not exactly match what you see on your
screen. Minor differences in the screenshot may be due to differences between the SensorDAQ
and LabQuest interfaces, or between different versions of LabVIEW. Be flexible with the minor
differences; however, make sure that your Vernier functions palette contains the Express VIs and
subVIs described below.
Appendix C
C - 2
Engineering Projects with NI LabVIEW and Vernier

ANALOG EXPRESS VI
For data collection with Vernier analog sensors, the Vernier Analog Express VI is the best
option. When you place the Analog Express VI on the block diagram, a configuration window
like the one shown below will open.

Figure 2 Analog Express VI configuration window
The configuration window provides feedback on whether the interface is properly connected and
communicating with the computer. Vernier sensors that are connected to any of the BTA
channels are automatically detected and displayed with default calibration coefficients, proper
units, and a live sensor reading.
You can also choose to manually configure homemade or non-autoID Vernier sensors connected
to the BTA channels or sensors connected to the SensorDAQ screw terminal. After selecting
Manual, you must click the Add Channel button and select a sensor from a configuration
window. Reading the sensors raw voltage (0 to 5 V) is the most common choice. You can
convert raw voltage units to sensor units using the calibration coefficients listed next to the
channel. For sensors that exhibit a linear proportionality, K0 is the intercept and K1 is the slope.

Figure 3 Manual configuration for custom sensors
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 3
Default values for the Sample Rate and Duration of Experiment are always displayed at the
upper-left corner of the Analog Express VI configuration window, but you can adjust these
values by clicking the Set Timing button as shown below.

Figure 4 Set Timing button
When you click the Set Timing button, the Data Collection configuration window will open,
allowing you to modify the Duration and Sampling Rate to match your needs. Consider the
response time of your sensor and the rate at which conditions change in your Project when
setting these values. The appropriate sampling rate is one that is somewhat faster than the
shortest change in the measured quantity, but that does not generate an excessive number of
points.

Figure 5 Data Collection configuration window
Entering a Sampling Rate less than or equal to 200 samples/second will configure the Express VI
for Single Point sampling as shown in the sample program below. The Express VI must be
placed within a While Loop so that with each iteration of the loop, a single data point (the most
recent) will be available to be read and plotted. Notice the way the stop (F) and stopped
terminals are wired when placing the Express VI inside a While Loop. This is to ensure that
when all data points have been collected, or you click the stop button, the Express VI knows to
end data collection and shut down the hardware prior to stopping the loop and terminating the
program.
Appendix C
C - 4
Engineering Projects with NI LabVIEW and Vernier


Figure 6 Example program using the Vernier Analog Express VI for single-point sampling
Specifying a Sampling Rate greater than 200 samples/second will configure the Express VI for
Multi-Point Sampling, and data values will be delivered in a set after the collection interval. This
configuration does not require a While Loop, because unlike Single Point Sampling, the Express
VI does not allow the program to move forward until every data point has been collected and are
available to be plotted.

Figure 7 Example program using the Vernier Analog Express VI for multi-point sampling
Tip: When specifying Single Point Sampling, data points are plotted in real time on a Waveform
Chart; but when specifying Multi-Point Sampling, data sets are plotted on a Waveform Graph.
If you want multi-point sampling that is continuous, to create a repeating graph of data (like you
might see when using an oscilloscope), you should select the Repeat option from the Set Timing
configuration window and place the Analog Express VI in a loop. When this option is checked,
data collection will continue after the experiment length has expired.

Figure 8. Example program using the Vernier Analog Express VI
for continuous multi-point sampling in a loop
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 5

Figure 9 Analog Express VIs Repeat and Averaging options
The Averaging function causes the interface to collect a number of additional samples for each
sample interval, take the average, and use that average for the recorded data point. The
Averaging function tends to yield better results during data collection by smoothing out
extraneous noise read by the sensor. Averaging can be disabled in the SensorDAQ Analog
Express VI, but not in the LabQuest Analog Express VI, because averaging is done
automatically in the firmware of all LabQuest interfaces. It is generally recommended to keep
the averaging on.

DIGITAL EXPRESS VI
The Vernier Digital Express VI allows you to control a variety of Vernier digital instruments.
There is a subtle difference in appearance between the LabQuest and SensorDAQ Digital
Express VIs due to the number of digital channels available on the interfaces.

Figure 10 SensorDAQ and LabQuest Digital Express VIs
The SensorDAQ contains one digital channel that will accommodate a BTD connector; all
LabQuest interfaces contain two digital channels. The option to select from two digital channels
is available in the configuration window of the LabQuest Digital Express VI.
Appendix C
C - 6
Engineering Projects with NI LabVIEW and Vernier


Figure 11 LabQuest Digital Express VI showing two channel options
Tip: You can get the functionality of a second digital channel with the SensorDAQ by
connecting a Vernier Digital Proto Board connector to the SensorDAQ screw terminal. The
second digital channel must be programmed using LabVIEWs DAQ Assistant Express VI. See
Appendix F for programming information.
Notice the Run button in the upper-left corner of the configuration window. The Analog Express
VI provides live readings as feedback that sensors are connected and reading properly. To get
feedback from your digital devices, you must click the Run button.
The information and setup parameters in the configuration window are very different depending
upon the digital instrument and its application. You should learn to check the Message box in the
lower portion of the screen for important programming tips. In this book, we developed Projects
that use four Vernier digital instruments: the Motion Detector (Project 12), the Photogate
(Projects 5 and 7), the Digital Control Unit (Projects 2, 3, 4, 5, 6, 7, 8, 9, 11, and 12), and the
Rotary Motion Sensor (Project 11). The unique characteristics of each of these instruments are
described below.
Using the Motion Detector with the Digital Express VI
The Vernier Motion Detector is used to collect position, velocity, and acceleration data of
moving objects. The sensor includes a sensitivity switch allowing you to detect objects as close
as 15 centimeters or as far away as 6 meters. A pivoting head allows you to aim the sensor for
accurate measurements. The Motion Detector is used in Project 12, PID Ping Pong Ball
Levitation.
Tip: The Motion Detector emits short burst of ultrasonic sound waves from the gold foil of the
transducer when it is making measurements. You can hear a by-product of this ultrasound
production as a distinct audible clicking sound.
There are three parameters that can be modified in the Digital Express VI configuration window
when using the Motion Detector: the Sample Rate, the Collection Duration, and the
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 7
measurement Unit. Unlike the Analog Express VI, there is no Repeat option; you will need to
specify a sufficiently long data Collection Length. Notice there is also a position vs time graph
that will display data values in the configuration window if you press the Run button. (These
data values are purely for preliminary testing purposes and cannot be saved for use in other parts
of your program.)

Figure 12 Configuration window for the Motion Detector
Tip: SensorDAQ users who are using the Motion Detector in conjunction with another Vernier
analog sensor should check the box within the Configure Data Collection section.
A simple program using the Motion Detector for data collection is shown below. Notice the three
output options are Distance, Velocity, and Acceleration. If you are only interested in the
Distance measurement, you can hide the other two output terminals and simplify your block
diagram by clicking on the expansion node at the bottom of the Express VI. The Digital Express
VI must be placed inside a While Loop in order to collect data for your entire Collection Length.
As with the Analog Express VI, you should stop the Express VI before stopping the While Loop.

Figure 13 Example program using the Motion Detector
Appendix C
C - 8
Engineering Projects with NI LabVIEW and Vernier

Using the Photogate with the Digital Express VI
The Vernier Photogate is used for measuring the speed of an object or as a trigger for an object
passing through the arms of the gate. It can also be used as a laser gate for objects passing
outside of the arms of the gate with the addition of a visible pen laser (not supplied). The
Photogate is very useful in engineering projects that require careful timing between events, such
as Projects 5 and 7.
Tip: Learn to check the red LED on the top of the Photogate. When the Photogate is blocked, the
LED is illuminated.
The Photogate can be configured in one of four timing options: Continuous Counting, Single
Timed Count, Semi-Period Timing, and Period Timing. In Continuous Counting and Single
Timed Count modes, a count occurs every time the Photogate goes from a blocked to an
unblocked state. Single Timed Count is the better option if you are using a SensorDAQ and
require very accurate timing, because the time period is hardware-timed, rather than software-
timed. However the time period is limited to 30 seconds, and timing does not start immediately
due to the time required to setup and start the counter. Continuous Counting is the preferred
option if you are using a LabQuest interface or a strict time period is not required.

Figure 14 Configuration window for Photogate Continuous Counting
If the Digital Express VI is configured for continuous counting and placed inside a loop,
counting will continue without interruption until you stop the Express VI. It is important to wire
the stop (F) and stopped terminals as shown below in order to shut down the Photogate code
properly before terminating the program.

Figure 15 Sample program for Photogate Continuous Counting
Semi-Period Timing captures the time between a blocked-to-unblocked or an unblocked-to-
blocked states. In Vernier programs, this is referred to as Gate timing. Period Timing captures
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 9
the time between blocked-to-blocked states. In Vernier programs, this is called Pulse timing. If
the Number of Continuous Samples is greater than 1 (the maximum is 12), the Express VI will
return an array of time measurements as shown in the top-left corner of the configuration
window below.

Figure 16 Configuration window for Photogate Semi-Period Timing
Tip: Setting the Number of Continuous Samples to 1 will make the Digital Express VI appear to
run faster; however, be aware that during the time required to stop and restart the Photogate
within each loop iteration, some measurements may be missed.
In the sample program shown below, notice that when the Digital Express VI is configured for
Semi-Period or Period Timing, there is no stop (F) and stopped terminals, but rather a
timeout parameter. The timeout parameter is the length of time that the VI will wait for a
photogate event, before moving on. The default value is 10 seconds. When you stop the loop, the
Photogate will wait for one last trigger to complete its final measurement. However, if no trigger
is received, program execution will end after the allotted timeout period.

Figure 17 Example program using the Photogate
Using the Digital Control Unit with the Digital Express VI
The Digital Control Unit (DCU) is a versatile instrument that provides a digital (on/off) signal
with sufficient current to drive motors, illuminate light bulbs, power fans, and in general to
control just about any DC-powered experimental apparatus you can create. The Digital Express
VI was designed to simplify the use of the DCU for several different application areas, including
direct control of six output lines, pulse train generation, and control of servo and stepper motors.
This flexibility makes the combination of the Digital Express VI and the DCU particularly
powerful in the areas of experimental control and project development, such as those described
in Projects 2, 3, 4, 5, 6, 7, 8, 9, 11, and 12.
Appendix C
C - 10
Engineering Projects with NI LabVIEW and Vernier

Control Output Lines 16
Direct control of the six digital output lines is the most commonly chosen configuration when
using the DCU. You can think of the DCU as a set of six remote-controlled electronic switches
that can have any one of three positions. The line can be connected to the positive side of the
DCU power supply, to the negative side of the power supply, or left unconnected. If you connect
an electrical device (such as a motor or lamp) between the DCU line and a ground connection,
you can control whether it is on or off using this switch. If the switch is in the + position, current
will flow, and the device will be on. Either of the other two positions will turn the device off.
You do not have totally independent control of all six lines, but instead we compromised on a
table of 16 patterns that allow you to have independent control of the first three lines and limited
control of the other three lines. Notice that the first 12 patterns in the table (pattern 011) can be
considered the binary equivalent of the number.
DCU Output Patterns
Pattern Binary D1 D2 D3 D4 D5 D6
0 0000 - - - - X X
1 0001 + - - - X X
2 0010 - + - - X X
3 0011 + + - - X X
4 0100 - - + - X X
5 0101 + - + - X X
6 0110 - + + - X X
7 0111 + + + - X X
8 1000 - - - + X X
9 1001 + - - + X X
10 1010 - + - + X X
11 1011 + + - + X X
12 1100 X X X X - -
13 1101 X X X X + -
14 1110 X X X X - +
15 1111 X X X X + +

Table 1 DCU output patterns
You can test the 16 different patterns within the configuration window of the Digital Express VI.
Clicking the increment/decrement button next to the DCU pattern will allow you to see the LEDs
illuminate on the graphical display. Clicking the Run button will allow you to see the LEDs light
up through the clear plastic top of your DCU. You are given the option of having the lines stay
on indefinitely or for a fixed length of time.
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 11

Figure 18 Configuration window for DCU control of output lines
Choosing to keep the lines on indefinitely allows you to place the Express VI within a loop and
continuously update the lines as needed. The DCU Pattern is an input terminal on the Digital
Express VI and can be programmed as a constant or as a front panel control depending upon
your application. It is extremely important when using the Digital Express VI to control a DCU
output line that the stop (F) and stopped terminals are wired as shown in the figure below.
This ensures that all lines are turned off when program execution ends. You should also avoid
using the Abort Execution button when running your program as it will most likely leave one or
more DCU lines on.

Figure 19 Example program to turn on DCU output
line D1 for an indefinite amount of time
Generate a Pulse Train
Pulse trains can make a digital controller act somewhat like an analog controller by sending a
variable voltage signal very quickly. This is called Pulse-Width Modulation. The DCU has the
ability to generate a pulse train from output line D1 when the DCU is connected to a
SensorDAQ, or output line D4 when the DCU is connected to a LabQuest interface. Users must
connect their projects to the correct DCU line when using the pulse train feature.
In the configuration the duty cycle is a decimal number between 0 and 1, and indicates the ratio
of on time to total time. In the figure below, a duty cycle of 0.60 specifies that the pulse should
be on for 60% of the time. If the supply voltage is 5 volts, this translates to an effective voltage
of 3 volts. When you make changes to the Frequency and Duty Cycle parameters within the
configuration window, the graphical display for the Sample Pulse-Train Output changes
automatically.
Appendix C
C - 12
Engineering Projects with NI LabVIEW and Vernier


Figure 20 Configuration window to generate a pulse train with the DCU
The Frequency and Duty Cycle are input terminals on the Digital Express VI. The Duty Cycle
can be adjusted continuously through a front panel control; however, changing the Frequency
during program execution is a much more difficult task for the hardware and should be limited.
The stop (F) and stopped terminals should be wired as shown below to ensure the DCU
stops sending the pulse train before the loop terminates.

Figure 21 Example program to control the duty cycle of a pulse train
Control a Servo Motor
Servo motors are controlled by pulse-width modulation. In pulse-width modulation, the shaft of
the motor is oriented to specific angular positions within a 90 range by sending the servo a
square wave voltage pattern. The length of time that the square wave is at the high voltage
controls the shaft position. The servo motor will hold its position firmly as long as the square
wave continues.
In order to use the Digital Express VI, the servo motor must be wired to DCU line D1 if using a
SensorDAQ, or DCU line D4 if using a LabQuest interface. You can vary the Position of the
motor shaft in the configuration window and then click the Run button to test the positioning of
your particular servo motor (it turns and holds for about a second). The neutral position
corresponds to 0. The default values for the Servo Pulse-Width Parameters are set for the most
commonly used servo motors. These values can be modified, if necessary, to match the
manufacturers specifications.
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 13

Figure 22. Configuration window for controlling a servo motor
The Digital Express VI must be placed in a While Loop when you are controlling a servo motor
because the pulse train must be sent continuously for the motor to maintain the desired position.
Using a front panel control to adjust the position of the motor will make your program more
user-friendly. Be aware that both the stop (F) and stopped terminals on the Digital Express
VI must be wired to avoid an error during program execution.

Figure 23 Example program to control the position of a servo motor
Control a Stepper Motor
A stepper motor is a motor that rotates in discrete (individual) steps rather than continuous
movement. It is used in cases where exact control and positioning of a motion are required.
In order to use the Digital Express VI, your stepper motor must be wired to the first four output
lines on the DCU. To drive a stepper motor, the Express VI will send a pattern of on/off signals
to the DCU to activate the electromagnets inside the motor (5,9,10,6 for clockwise and
6,10,9,5 for counterclockwise). This default pattern sequence will work with many stepper
motors; however, it can be adjusted if necessary to match your manufacturers documentation.
Within the configuration window you have the option to set the total Number of Steps, the Step
Speed, and the Direction, or to create front panel controls for these parameters. Notice that the
Step Speed is actually a time measurement specifying how long a motor will wait before making
the next turn step; therefore, a lower number will result in a faster turn speed.
Appendix C
C - 14
Engineering Projects with NI LabVIEW and Vernier


Figure 24 Configuration window for controlling a stepper motor
For continuous movement, the Digital Express VI should be placed inside a loop. To make your
program stop in a timely manner, you may wish to set the Number of Steps to 1.

Figure 25 Example program to control the position of a stepper motor
Using the Rotary Motion Sensor with the Digital Express VI
The Vernier Rotary Motion Sensor is a bi-directional angle sensor designed to measure angular
displacement, velocity, and acceleration. Typical applications include measuring rotational
inertia, angular momentum, and period of a physical pendulum.
There are four parameters that can be modified when configuring the Rotary Motion Sensor:
Rotary Units (degrees, radians, or ticks), Initial Angle, Timing Interval, and Resolution. The
Rotary Motion Timing Interval is a software-timed period between rotation updates. The default
resolution is 360 counts per revolution (1 degree); the High Resolution option quadruples that to
1440 counts per revolution (1/4 degree). When you use the Rotary Motion Sensor for swinging
objects, such as a pendulum, you should always return the apparatus to its initial position before
starting the program because the initial position is assumed to correspond to the initial angle.
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 15

Figure 26 Configuration window for Rotary Motion Sensor
For continuous measurement, the Digital Express VI should be placed inside a loop. The stop
(F) and stopped terminals should be wired as shown below to ensure sensor measurements
are completed before terminating the loop.

Figure 27 Example program using the Rotary Motion Sensor

POWER AMP EXPRESS VI
The Vernier Power Amplifier has the ability to output a constantly varying signal, unlike a
digital device (such as the DCU) which provides strictly on/off control. The Power Amplifier
allows you to produce voltages up to 10 volts and to drive loads that require up to 1 ampere of
current.
For data collection or device control with the Power Amplifier, the Vernier Power Amp Express
VI should be used. If you are using a LabQuest interface (the LabQuest Mini does not have the
ability to output a waveform), there are several options to choose from for the Waveform,
including Sine, Square, Triangle, Ramp Up, Ramp Down, and DC Output. The SensorDAQ
Power Amp Express VI does not have a selectable Waveform option because the SensorDAQ
always sends a DC signal by default.

Figure 28 LabQuest Power Amp Express VI configuration window
Appendix C
C - 16
Engineering Projects with NI LabVIEW and Vernier

For continuous operation, the Power Amp Express VI should be placed inside a loop. The stop
(F) and stopped terminals should be wired as shown below to ensure the output voltage is
zeroed before the loop terminates.

Figure 29 Example program using the Rotary Motion Sensor

THE REST OF THE VERNIER PALETTE
We have provided a lot of detail about the Vernier Express VIs, but there are also many subVIs
available on the Vernier functions palette. These subVIs are available to support data logging,
controlling the DCU, and low-level calls to the interface.
The Data Logging palette includes subVIs that can be used to build data collection programs
without using any Express VIs. This can sometimes give you additional options and/or more
control of your program. Included in this collection is a palette of Physiology subVIs that can be
used for measurements such as blood pressure and heart rate.

Figure 30 The Data Logging subVIs on the Vernier functions palette
The DCU palette gives you more options for controlling the Digital Control Unit.

Figure 31 The DCU subVIs on the Vernier functions palette
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier C - 17
The Low Level Drivers palette includes subVIs that are more primitive. They could be used by
someone who wants to learn more about the details of how commands are sent to the interface
and how sensor readings are returned.

Figure 32 The Low Level Drivers subVIs on the Vernier functions palette
Appendix C
C - 18
Engineering Projects with NI LabVIEW and Vernier

The Low Level Drivers palette includes subVIs that are more primitive. They could be used by
someone who wants to learn more about the details of how commands are sent to the interface
and how sensor readings are returned.

Figure 32 The Low Level Drivers subVIs on the Vernier functions palette
Appendix
D
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology D - 1
Vernier Interfaces
OVERVIEW
Vernier offers several options for data collection and sensor management when building your
engineering projects. Four interfaces are supported in this book. Each interface was designed to
address different budgets, classroom setups, and project goals. All Vernier interfaces
recommended in this book have connectors that allow you to connect at least three Vernier
analog sensors with no external wiring or signal conditioning required. Vernier sensors are
equipped with auto-ID technology that allows the interface and software to read the sensor's
calibration coefficients, resulting in measurements that are in proper sensor units. Examples of
the many Vernier analog sensors available include voltage, pH, force, and heart rate sensors.
Each interface also includes at least one Vernier digital sensor connector. Examples of the digital
sensors that can be connected include motion detector, rotary motion, and photogate. In addition,
the Vernier Digital Control Unit (DCU) can be used in the digital channel to provide output for
controlling electrical devices with up to 1000 mA.
To help you decide which interface is right for you, we've included brief descriptions of each
interface and an overview comparison chart to distinguish their strengths. In addition, product
videos are available for review on our website.
Vernier Interface Comparison
Interface
# Analog
Channels
# Digital
Channels
Sampling
Rate
Power Features
SensorDAQ
3
plus 2 AI and
1 AO on
screw
terminal
1
plus 4 DIO
lines and 1
Pulse Output
line on screw
terminal
48,000
per sec
computer via
USB cable
detachable screw terminal
with 12 auxiliary channels
for customized projects
LabQuest 2
4 2 100,000
per sec
rechargeable
battery
Wi-Fi connectivity; color
touch screen; 7 built-in
sensors
Original
LabQuest
4 2 100,000
per sec
rechargeable
battery
color touch screen; 3 built-
in sensors
LabQuest Mini
3 2 100,000
per sec
computer via
USB cable
low cost

Table 1 Vernier interface comparison
SENSORDAQ
The Vernier SensorDAQ is a USB data-acquisition interface developed jointly by National
Instruments and Vernier Software & Technology. Like other Vernier interfaces, the SensorDAQ
has connectors that allow up to three Vernier analog sensors and one digital sensor or device to
connect with auto-ID recognition. The SensorDAQ has a fast sampling rate of up to
48,000 samples per second in a single channel. It is powered by the USB cable from the
computer.
Appendix D
D - 2
Engineering Projects with NI LabVIEW and Vernier


Figure 1 SensorDAQ analog and digital sensor ports
In addition to the sensor connectors, the SensorDAQ includes a removable screw terminal
connector. The screw terminal connector provides the versatility needed for customized data
acquisition and engineering control projects.

Figure 2 SensorDAQ screw terminal connector pin-out
The screw terminal channels include digital input/output, analog output, counter/timer, +5 volt
line, and two analog input channels. When used for output, the SensorDAQ provides a limited
current (up to 5 mA). The table below describes the signals available on the screw terminal.
SensorDAQ Screw Terminal
Terminal Signal Name Reference Direction Description
5,8,10 GND

Ground: Reference point for single-ended AI
measurements, bias current return point for
differential mode measurements, AO
voltages, digital signals at the I/O connector,
+5 VDC supply, and the +2.5 VDC reference.
11,12 AI <0..1> Varies Input Analog Input Channels 0 and 1: For
single-ended measurements, each signal is
an analog input voltage channel. For
differential measurements, AI 0 and AI 1
are the positive and negative inputs,
respectfully, of differential analog input
channel 0.
9 AO 0 GND Output Analog Output Channel 0: Supplies the
voltage output of AO channel 0.
1-4 P0.<0.3 GND Input or
Output
Digital I/O Signals: You can individually
configure each signal as an input or output.
6 +5 V GND Output +5 V Power Source: Provides +5 V power.
7 PFI 0 GND Input PFI 0: This pin is configurable as either a
digital trigger, an event counter input, pulse
generation output, or as a period, semi-
period, two edge separation timer.

Table 2 SensorDAQ screw terminals
Because it was designed specifically for engineering education, SensorDAQ is the perfect
interface to use with this book.
Vernier Interfaces
Engineering Projects with NI LabVIEW and Vernier D - 3
LABQUEST 2
The Vernier LabQuest 2 is the most powerful and intuitive interface for STEM education. The
wireless capabilities of LabQuest 2 provide unprecedented tools for collecting and analyzing
data on iPad and mobile devices, remotely viewing and controlling LabQuest 2 with a computer,
and emailing sensor data and graphs for later analysis at home. Verniers LabQuest 2 supports
hands-on, collaborative learning with individualized accountability.
The LabQuest 2 has a large, color touch screen with display capability in either portrait or
landscape orientation, and a high-contrast mode for outdoor visibility. It has 40 MB of on-board
data storage with further expansion through an SD/MMC card or USB drive. It is powered by a
lithium-ion rechargeable battery pack.
LabQuest 2 has six channels for Vernier sensors four analog and two digital. It has a fast
sampling rate of up to 100,000 samples per second in a single channel. LabQuest includes a
built-in GPS, 3-axis accelerometer, ambient temperature sensor, light sensor, and microphone, as
well as a stop watch, audio function generator, calculator, and note-taking application.

Figure 3 LabQuest 2 features
LabQuest 2 can be used as a stand-alone device, a computer interface, a controller for other
interfaces, or a portable device for field projects; however when using it with LabVIEW,
LabQuest 2 must be connected to a computer.
THE ORIGINAL LABQUEST
The original Vernier LabQuest is a powerful interface designed for versatility. It was created
with todays classroom in mind with its vivid color touch screen, durability, and ease of use.
LabQuest has 40 MB of on-board data storage with further expansion through an SD/MMC card
or USB drive. It is powered by a lithium-ion rechargeable battery pack.
LabQuest has six channels for Vernier sensors four analog and two digital. It has a fast
sampling rate of up to 100,000 samples per second in a single channel. LabQuest includes a
built-in air temperature sensor, microphone, and sound sensor, as well as a stop watch, audio
function generator, and note-taking application.
Appendix D
D - 4
Engineering Projects with NI LabVIEW and Vernier


Figure 4 The original LabQuest features
LabQuest can be used as a stand-alone device, a computer interface, or a portable device for field
projects; however when using it with LabVIEW, LabQuest must be connected to a computer.
LABQUEST MINI
The Vernier LabQuest Mini is an affordable, yet
powerful, interface for projects that dont require
the versatility of a standalone device. It has a
compact design and is USB-powered for quick and
easy setup. No external power source is required.
LabQuest Mini has five channels for Vernier
sensors (three analog and two digital) with a fast
sampling rate of up to 100,000 samples per second
in a single channel. It is the least expensive option
to use for the projects in this book.


Figure 5 LabQuest Mini
Appendix
E
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology E - 1
Vernier Sensors & Accessories
OVERVIEW
Vernier prides itself on having developed a comprehensive collection of more than 50 sensors
for use in your engineering projects. Vernier sensors are equipped with auto-ID technology that
allows the interface and software to read the sensor's calibration coefficients, resulting in
measurements that are in proper sensor units. The advantages of Vernier sensors include the low
price, high quality, compatibility with a variety of computer platforms, and support materials that
provide for ease of use. We have designed our products specifically with educators in mind.
Tip: All Vernier products are designed for educational use only. Our equipment is not designed
or recommended for research or incorporation into apparatus involved with any industrial or
commercial process such as life support, patient diagnosis, manufacturing, or industrial testing.

ANALOG SENSORS
Vernier has over 50 analog sensors that can be used with the SensorDAQ and LabQuest
interfaces. All Vernier analog sensors use British Telecom Analog (BTA) connectors when
plugging into Vernier interfaces. The analog sensors used in this book are described in the table
below.
Vernier Analog Sensors Used in This Book
Sensor Order Code Project Description
Blood Pressure Sensor BPS-BTA 9 Used to non-invasively measure
systemic arterial blood pressure in
humans. When used with LabVIEW, it
can calculate systolic and diastolic
blood pressure.
EKG Sensor EKG-BTA 8 Measures cardiac electrical potential
waveforms (voltages produced
during the contraction of the heart).
Instrumentation Amplifier INA-BTA 10 Steps up the voltage from circuits
and devices that produce small
voltage signals.
Light Sensor LS-BTA 6 Used for measurements of light
intensity in a variety of situations.
Surface Temperature Sensor STS-BTA
1, 2, 4
Designed for use in situations in which
low thermal mass or flexibility is
required. Special features include an
exposed thermistor that results in an
extremely rapid response time.

Table 1 Vernier analog sensors

Appendix E
E - 2
Engineering Projects with NI LabVIEW and Vernier

DIGITAL SENSORS
Vernier has almost a dozen digital sensors that can be used with the SensorDAQ and LabQuest
interfaces. All Vernier digital sensors use British Telecom Digital (BTD) connectors when
plugging into Vernier interfaces. The digital sensors used in this book are described in the table
below.
Vernier Digital Sensors Used in This Book
Sensor Order Code Project Description
Motion Detector MD-BTD 12 Used to collect position, velocity, and
acceleration data of moving objects. The Motion
Detector contains a sensitivity switch for long or
short-range measurements.
Photogate VPG-BTD 5, 7 Used for measuring the speed of an object or
as a trigger for an object passing through the
arms of the gate. When the gate is blocked,
the red LED will be illuminated.
Rotary Motion Sensor RMV-BTD 11 A bi-directional angle sensor designed to
measure rotational or linear position, velocity,
and acceleration.

Table 2 Vernier digital sensors

ACCESSORIES AND OTHER EQUIPMENT
Vernier also provides several accessories and other equipment which are quite useful for
engineering projects. Below is a summary table of these devices and their use in this book. The
sections that follow contain detailed descriptions of each item in the table.
Vernier Equipment and Accessories Used in This Book
Sensor Order Code Project Description
Digital Control Unit DCU-BTD 29,11,12 Used for digital (on/off) control of up to six output
devices.
Power Amplifier PAMP 11,12 Power amplifier with internal current sensor. Can
provide +/10 V and up to 1 A output.
Breadboard Cable BB-BTA 1,10 A handy device to connect a custom built sensor
to a Vernier interface via an analog sensor port.
Analog Proto Board
Connector
BTA-ELV 5,11,12 A connector used to connect a standard
prototyping board to a Vernier interface analog
sensor port. Also useful for connecting the
Power Amp to the SensorDAQ screw terminal
analog output.
Vernier Digital Proto Board
Connector
BTD-ELV 5,7,11 Provides an easy way to connect additional
Vernier digital BTD sensors to the SensorDAQ
screw terminals. The base of the connector is
designed to fit into any standard prototyping
board.

Table 3 Vernier equipment and accessories
Vernier Sensors & Accessories
Engineering Projects with NI LabVIEW and Vernier E - 3
DIGITAL CONTROL UNIT
The Vernier Digital Control Unit (order code DCU-BTD) is an electronic device that allows you
to control six digital output lines for on/off control of motors (Projects #5, 6, 7, 11, 12), light
bulbs (Projects #2, 6), LEDs (Project #3, 4, 8), pumps (Project #9), and other DC electrical
components. The DCU is a small box with a short cable and clear plastic top. The transparent top
of the DCU reveals six red LEDs and one green LED. The red LEDs indicate the status of the six
digital output lines (D1, D2, D3, D4, D5, and D6). The green LED should be on when a program
is running and the DCU is properly connected and powered. Learn to check the green LED. It
can warn you if things are not set up correctly, and it will keep you from wasting time when they
are not.

Figure 1 Vernier Digital Control Unit
There are two sockets on one side of the DCU box to accept a DC power supply (older DCU
units only have one socket). On the same side is a short cable with a BTD connector, which
plugs into the DIG port on the interface. On the opposite side of the box is a 9-pin D-sub socket
for connecting electronic devices that you build. There are connections for all six digital lines,
plus a power connection and two ground connections. A cable is supplied, with bare wires on
one end, for use in building projects. The DCU can control as many as six DC electrical devices.


Figure 2 DCU cable pin-out
When building devices, you should always keep the power limitations of the DCU in mind. Your
device should not exceed the electrical current limit of the power supply: 600 mA when using
the LabPro power supply and 1000 mA when using the LabQuest power supply. If you are using
a different power supply, check the electrical current rating. Always keep the power limitations
of the DCU in mind. You should not exceed 1000 mA total.

Appendix E
E - 4
Engineering Projects with NI LabVIEW and Vernier

POWER AMPLIFIER
While the DCU can be used for digital (on/off) control of electronic devices, the Vernier Power
Amplifier (order code PAMP) can control a single analog output circuit. The Power Amplifier
allows you to drive loads with 10 V and currents up to 1 A. Controlling the lift force on a
propeller (Project #11) and levitating a ping pong ball (Project #12) are good examples of
circuits that typically draw more power than the interface can deliver. The Power Amplifier also
has a built-in current sensor, so you can monitor the current output at the same time you control
the voltage.

Figure 3 Vernier Power Amplifier
The correct interface to use with the Power Amplifier depends on the application. Fast-response
engineering projects with feedback loops, motor speed control, and PID control are naturals for
the SensorDAQ. Projects that involve alternative waveforms (such as sine, square, triangle, and
sawtooth) or that provide precise AC waveforms for driving loads like speakers will require the
original LabQuest or LabQuest 2. The Power Amplifier cannot be used with the LabQuest Mini
due to the absence of an analog output line.
BREADBOARD CABLE
The Vernier Analog Breadboard Cable (order code BB-BTA) provides an easy way for students
to build their own sensor circuitry and input the signal into a Vernier interface for data
acquisition. One end of the cable is a standard British Telecom Analog (BTA) connector that
plugs into the interface. The other end of the cable is a prototyping board connector that exposes
the six sensor lines. The VRES and ID pins are special lines reserved for auto-identification of
Vernier sensors. They will not normally be used in student projects. There is also a similar cable
for making connections to the digital ports of Vernier interfaces, BB-BTD.)

Figure 4 Vernier Breadboard Cable pin-out
Vernier Sensors & Accessories
Engineering Projects with NI LabVIEW and Vernier E - 5
ANALOG PROTO BOARD CONNECTOR
The Vernier Analog Proto Board Connector (order code BTA-ELV) provides an easy way to
connect the Vernier Power Amplifier to the SensorDAQ screw terminals. The base of the
connector is designed to fit into any standard prototyping board.

Figure 5 Vernier Analog Proto Board Connector pin-out

DIGITAL PROTO BOARD CONNECTOR
The Vernier Digital Proto Board Connector (order code BTD-ELV) provides an easy way to
connect additional Vernier digital BTD sensors to the SensorDAQ screw terminals. The base of
the connector is designed to fit into any standard prototyping board.

Figure 6 Vernier Digital Proto Board Connector pin-out

Appendix
F
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology F - 1
SensorDAQ and the
DAQ Assistant
OVERVIEW
One of the unique features of the SensorDAQ interface is its screw terminal connector, which the
LabQuest interfaces do not have. The screw terminal connector was designed to allow you to
customize your projects by providing additional channels for digital and analog input/output, as
well as a +5 volt power source (200 mA current), three ground lines, and a counter/timer. The
counter/timer is configurable as a digital trigger, an event counter, a pulse generator, or a two-
edge separation timer. The inexpensive screw terminal connector is detachable, so there is no
need to disconnect student projects from it once they have been assembled.
Vernier has developed several proto board connectors that make it easy to build your own
sensors or connect commercial sensors and accessories. You also have the option of wiring your
device directly to the screw terminal.

USING THE DAQ ASSISTANT
You will need to use the DAQ Assistant Express VI (found in the Measurement I/O DAQmx
Data Acquisition palette) when programming devices with the SensorDAQ screw terminal.
The DAQ Assistant is a generic Express VI designed to accommodate many different pieces of
National Instruments hardware. This Express VI can be used to program the SensorDAQ screw
terminal. It cannot be used for the SensorDAQ sensor channels, or for programming the
LabQuest interfaces.

ANALOG OUTPUT SIGNALS
The SensorDAQ has the capability to generate an analog output signal. When the DAQ Assistant
is placed on the block diagram, a configuration window appears asking you to select the type of
task. To generate an analog signal with Vernier equipment you must always select the Voltage
option because the SensorDAQ does not support the option to control current output.

Figure 1 DAQ Assistant Analog Output configuration window
Appendix F
F - 2
Engineering Projects with NI LabVIEW and Vernier

Next you must select the channel. If the interface is connected to the computer and powered on,
the channel name (ao0 for the SensorDAQ interface) will appear in the configuration window.
Click the channel name ao0 and then click Finish.

Figure 2 Analog Output channel selection
The default settings as shown below should be retained in the final configuration window.

Figure 3 Analog output voltage settings
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier F - 3
A sample program that can be used to power a motor using the Vernier Power Amplifier is
shown below. Notice that a second DAQ Assistant has been placed outside the While Loop with
an input value of 0. The DAQ Assistant inside the While Loop will not reset the voltage to zero
when program execution ends; therefore, the second DAQ Assistant simply guarantees that the
motor will stop when the program ends.
Tip: If you are using the analog out terminal to control the Vernier Power Amplifier, use the
Power Amplifier Express VI instead of the DAQ Assistant.

Figure 4 Sample program using the DAQ Assistant for analog output

DIGITAL OUTPUT SIGNALS
In many of the Projects in this book we connect the DCU to the SensorDAQ digital channel. It is
also possible to connect the DCU to the screw terminal. This might be important if you are
already using the digital channel with another Vernier digital sensor. To connect the DCU,
simply provide a 5 volt source and Ground signal. Then wire one or all of the digital lines from
the screw terminal. Wiring is made easier by using the Vernier Digital Proto Board Connector.

Figure 5 Screw terminal pin-out for wiring the DCU

COUNTER/TIMER
When using the Photogate, you must acquire a signal with the Counter/Timer channel (screw
terminal 7). An important hardware consideration when wiring the photogate to the screw
terminal is how this signal affects the SensorDAQs digital channel. It is important to understand
that the SensorDAQ digital channel has two counters wired into that channel, one of which is
also the screw terminal counter. Therefore, when setting up a counter task, such as photogate
timing or pulse output, the digital channel has lines that are no longer available. This is clearly
seen when using a DCU connected to the digital channel and a photogate to the screw terminal.
The DCU loses the ability to turn lines 1, 2, 5 and 6 on/off using standard DCU output patterns.
Appendix F
F - 4
Engineering Projects with NI LabVIEW and Vernier

One workaround for this situation is to connect the photogate to the digital channel and wire the
DCU to the screw terminal.

Figure 6 Screw terminal pin-out for the Photogate
Using the Photogate as an Event Trigger
The Photogate can be used as an event trigger. When configuring the DAQ Assistant you will be
Acquiring a Signal using the Counter Input and choosing the Pulse Width option.

Figure 7 DAQ Assistant Counter Input configuration window
Next you must select the channel. If the SensorDAQ is connected to the computer and powered
on, the channel name ctr0 will appear in the configuration window.
When you click the Finish button, the configuration window for the final parameters (in this
case, Pulse Width) appears. You can use a shorthand notation on the Max and Min values for the
Signal Input Range when specifying small measurements. Adding an m after the number is
shorthand notation for milliseconds; adding a u after the number is shorthand notation for
microseconds. You can select Rising or Falling for the Starting Edge.
Vernier Functions Palette
Engineering Projects with NI LabVIEW and Vernier F - 5

Figure 8 DAQ Assistant Pulse Width Setup window
Using the Photogate for Period Timing
The Photogate can be used for timing measurements. When configuring the DAQ Assistant you
will be Acquiring a Signal using the Counter Input and choosing the Period or Semi-Period
option. Be aware that for this timing option the readings are not continuous, on setup and for
subsequent calls there may be at least a semi-period missed.
For more options with the screw terminal look over some of our low-level examples that do not
use the DAQ Assistant.

COMMON DAQ ASSISTANT ERRORS
The DAQ Assistant Express VI is a great way to quickly program the SensorDAQ screw
terminal channels. However, be aware that this Express VI, when configured, is specifically set
to run with the SensorDAQ connected to your computer. If you attach a different SensorDAQ,
the Express VI will not work. A common error message that occurs for this problem will say
something similar to the following:
Error -201003 occurred at DAQmx Create Channel (AO-Voltage-Basic).vi:2
Device cannot be accessed. Possible causes:

Device is no longer present in the system.
Device is not powered.
Device is powered, but was temporarily without power.
Device is damaged.

Ensure the device is properly connected and powered. Turn the computer off and on again. If
you suspect that the device is damaged, contact National Instruments at ni.com/support.

Device Specified: Dev4

Task Name: _unnamedTask<0>
Appendix F
F - 6
Engineering Projects with NI LabVIEW and Vernier

This error occurs because your computer gives each SensorDAQ a unique device number. The
DAQ Assistant is configured with this unique number. If you save a VI that uses the DAQ
Assistant, created with SensorDAQ device 1 (for example), and then attach a second SensorDAQ
(device 2), and run the saved VI, an error will occur. There is a way to manage the device
number assigned to the SensorDAQ. This is done with Measurement and Automation Explorer
(MAX), an application installed in the LabVIEW directory. It may be easier to delete the old
DAQ Assistant Express VI and recreate and reconfigure a new DAQ Assistant. The best option
is to keep a single SensorDAQ connected to each computer. Every computer will then have a
SensorDAQ that is named device 1, allowing all VIs to be shared between computers.
Two other issues to be aware of when using the DAQ Assistant in your programs are the timeout
and the Error Out terminals. The timeout is a terminal that appears when programming the screw
terminal counter for timing measurements. The timeout is the amount of time the DAQ Assistant
Express VI will wait for the action that causes the timing measurement. If the action never
occurs a timeout error will be sent on the Error Out terminal. Be aware that when the user ends
program execution (for example, by clicking a Stop button on the front panel), the program will
not stop until the timeout value has expired. The default value of 10 seconds may appear
excessively long and confusing to most users.

Figure 9 Sample program with the DAQ Assistant Express VI
In most programs, you must wire an indicator to the Error Out terminal, otherwise, when an error
does occur, like a timeout, the DAQ Assistant provides a popup error dialog that may confuse
the user. Wiring the Error Out terminal to an indicator stops the error dialog from appearing, and
is therefore the preferred method.

Figure 10 Front panel view of the Error Out indicator

Appendix
G
Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology G - 1
Equipment and Supplies
A list of equipment and supplies for all projects is given below. The amounts listed are for
individual workstations. They have been divided into nonconsumables and consumables. Most
consumables will need to be replaced each year. Most nonconsumable materials may be used
many years without replacement; however, you may wish to keep spare parts on hand for items
that are likely to become damaged during testing, such as light bulbs and LEDs. Substitutions
with similar functionality can be made. A list of suppliers is included at the end of this appendix.
This list is meant to serve as a starting point; many items can be purchased at your local hobby
store.
Nonconsumables
Item Amount Project
ball, Ping-Pong 1 12
ball, Ping-Pong with hole 1 3
ball, small rubber 1 7
bar, aluminum x x 8 1 10
bar, metal approx 50 cm long 1 11
block, Styrofoam 1 12
breadboard 1 1, 3, 5, 7*, 8, 10, 11*
clamp, 3-finger 1 12
clamp, lever or similar 1 10
clamp, rod 12 5, 11, 12
container, small 1 2
fan, small 5 VDC 1 2, 4, 12
filter, polarizing approx 5 cm diameter 2 6
jumper wire 14 3, 5, 7*, 8, 10, 11, 12*
lamp socket, miniature 1 2, 6
LED, bipolar 1 8
LED, red 1 4
LED, RGB (3-color) diffused lens 1 3
light bulb, miniature, W 1 2, 6
mass set 100500 g 1 10
motor, 5V DC 1 5, 11
motor, servo with horn 4.8 VDC 1 7
motor, stepper 5 VDC 1 6
multimeter 1 1
penny 5 10
potentiometer, 1 k 1 5
propeller, small 1 5, 11
pump and solenoid from blood pressure test 1 9
Appendix G
G - 2
Engineering Projects with NI LabVIEW and Vernier

kit
resistor 100 , W 1 4
resistor, precision 120 , 1%, W 2 10
resistor 220 13 3, 4, 8
resistor, precision 15 k, 1%, W 1 1
ring stand 1 5, 11, 12
rod, metal approx 15 cm long 1 11
small metal construction set misc 6, 7,11
strain gage 120 2 10
thermistor 1 1
tube, hollow plastic approx 1 m long 1 12
tubing, pneumatic or heavy-wall plastic 50 cm 9
valve, T-stem 2 9
*SensorDAQ users only

Consumables
Item Amount Project
adhesive (heat-conducting Epoxy or other) trace 4
electrode tab 3 8
tubing, heat-shrink 5 cm 4

Materials and Supplies
Engineering Projects with NI LabVIEW and Vernier G - 3
Suppliers
Carolina Biological Supply Co. LEGO

Education
2700 York Road P.O. Box 1707
Burlington, NC 27215 Pittsburg, KS 66762-1707
1-800-334-5551 1-800-362-4308
www.carolina.com www.LEGOeducation.com
Central Scientific NASCO
3300 Cenco Parkway 901 Janesville Ave.
Franklin Park, IL 60131 Fort Atkinson, WI 53538
1-800-262-3626 1-800-558-9595
www.cenconet.com www.homeschool-nasco.com
Digi-Key Corporation Omega Engineering
701 Brooks Avenue South P.O. Box 4047
Thief River Falls, MN 56701 Stamford, Connecticut 06907-0047
1-800-344-4539 1-800-622-2378
www.digikey.com www.omega.com
Electronix Express Pitsco
365 Blair Road PO Box 1708
Avenel, NJ 07001 Pittsburg, KS 66762-1708
1-800-972-2225 1-800-835-0686
www.elexp.com www.pitsco.com
Fisher Science Education Sargent-Welch Scientific Co
485 South Frontage Rd. PO Box 5529
Burr Ridge, IL 60521 Buffalo Grove, IL 60089
1-800-955-1177 1-800727-4368
www.fisheredu.com www.sargentwelch.com
Flinn Scientific Inc. Science Kit and Boreal Labs
PO Box 219 PO Box 5003
Batavia, IL 60510 Tonawnada, NY 14150
1-800-452-1261 1-800-828-7777
www.flinnsci.com www.sciencekit.com
Frey Scientific Wards Natural Science Establishment
100 Paragon Parkway PO Box 1712
Mansfield, OH 44903 Rochester, NY 14603
1-800-225-FREY 1-800-962-2660
www.freyscientific.com www.wardsci.com

Index

Engineering Projects with NI LabVIEW and Vernier Index - 1
Index
(by Experiment Number)
A
Accelerometer, 7
Actual angle, 11
Actual position, 12
Add channel, 1
Adhesion, 10
Air circulation, 2
Air currents, 11, 12
Air intake, 12
Air temperature, 2
Alligator clip, 8, 10
Ambient light, 3, 6
Ambient temperature, 4
Amplitude, 8, 9, 11, 12
Analog control system, 5
Analog controller, 11
Analog Express VI, Intro, 1, 2, 4, 6, 8, 9, 10,
App C
Analog output controller, 11
Analog Proto Board Connector, 11, 12,
App E
Angina, 8
Angle, 6, 7, 11
Anemometer, 4
Applied load, 10
Armature, 5
Array, 3, 6, 8, 9, 11
Artery, 9
Atrioventricular node, 8
Atrium, 8
Audio in, 5
Audio input, 11, 12
Audio out, 5
Auto-indexing, 8
Automatic control, 11
Axis of rotation, 11
Axle, 5

B
Baseline, 8
Beam, 10
Bias, 11, 12
Bicep muscle, 8, 9
Bipolar LED, 3, 8
Bipolar stepper motor, 6
Birthday candle, 4
Blade, 11
Block diagram, all
Blocked state, 5, 7
Blood pressure, 9
Blood Pressure Sensor, 9
BPM, 8, 9
Brachial artery, 9
Breadboard, 1, 3, 4, 7, 8, 11
Breadboard cable, 1, 10, App E
Broad-spectrum white light, 3
Brush, 5
BTA cable, 5, 11, 12
BTA connector, 1
BTD connector, 5, 11
Buffer region, 6
Burnout, 3

C
Calibration, 1, 4
Cantilever beam, 10
Cathode, 3
CD, App A
Cell membrane, 8
Celsius, 1
Channel, all
Charge, 8
Circuit, parallel, 2
Circuit, series, 3
Circuit, Wheatstone bridge, 10
Circulatory system, 9
Climate-controlled environment, 2
Coil, 6
Color balance, 3
Color mixer, 3
Commercial sensor, 1
Common ground, 3
Commutator, 5
Compression, 10
Conduction pathway, 8
Cones, 3
Index
Index - 2
Engineering Projects with NI LabVIEW and Vernier

Configuration window, all
Congestive heart failure, 9
Consumable, 1
Contraction, 8, 9
Control system, 1, 7, 11, 12
Controller response, 11
Conveyor belt, 6
Cuff, 9
Current, 3, 4, 5, 7, 8
Current-limiting resistor, 3, 4, 8
Current Probe, 5
Cut-off, 8
Cyanoacrylate glue, 10

D
DAQ Assistant Express VI, 5, 7, 11, App F
DAQmx driver, 11, App B, App F
DC motor, 5, 11, 12
DC signal, 5, 11, 12
DCU, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12
Deadband region, 2
Deflection, 8, 10
Derivative constant, 11, 12
Desired angle, 11
Desired position, 12
Diastolic pressure, 9
Differential Voltage Probe, 1
Diffuser, 3
Digital control system, Intro, 2, 5
Digital controller, 11
Digital Control Unit, Intro, 2, 3, 4, 5, 6, 7, 8,
9, 11, 12, App C, App E
Digital Express VI, Intro, 2, 3, 4, 5, 6, 7, 8,
9, 11, 12, App C
Digital Proto Board Connector, 5, 7, 11,
App E
Diode, 5
Dipole moment, 8
Discharge rate, 9
Discharge valve, 9
Distance, 6, 12
Dual-Range Force Sensor, 10
Duty cycle, 3, 5, 11, 12


E
EKG, 8
EKG Sensor, 8
Elastic modulus, 10
Electric field, 6
Electrical interference, 8, 10
Electrical short, 4, 10
Electrical signal, 1, 8
Electrocardiogram, 8
Electrode, 8
Electrode tab, 8
Electromagnet, 5, 6
Electromagnetic interference, 10
Electromagnetic wave, 6
Electromyogram, 8
Electronic interference, 8
EMG, 8
Energy, electrical, 5
Energy, heat, 4
Energy, mechanical, 5
Enum control, 1, 3, 5
Equipment, App G
Error, 11, 12, App F
Event trigger, 7
Excitation voltage, 10
Exhaust fan, 2
Exhaust rate, 9
Extensor muscle, 8
Eye blink, 8

F
Fahrenheit, 1
Feedback, 1
Feedback control system, 11
Field, electric, 6
Field, magnetic, 5
Filter, 6, 8
Force, 10, 11, 12
Formula Express VI, 1, 5, 10, 11, 12
Frequency, 3, 5, 11, 12
Friction, 12
Front panel, all
Fulcrum, 7

G
Gage factor, 10
Gain, 11, 12
GND, 1, 2, 3, 4, 5, 7, 9, 10, 11, 12
Gravity, 11, 12
Index

Engineering Projects with NI LabVIEW and Vernier
Index - 3

Greenhouse, 2, 7
Ground, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12

H
Half-bridge circuit, 10
Hand Dynamometer, 8, 12
Hand grip strength, 8
Heart rate, 8
Heat, 1, 2, 4
Heat sink, 4
Heating resistor, 4
High-pass filter, 8
Homemade sensor, 1
Hookes law, 10
Horn, servo, 7
Hot-wire anemometer, 4
Hue, 3
Human eye, 3
Human operator, 11, 12
HVAC system, 2
Hypertension, 9
Hysteresis, 2

I
Illumination, 3, 4
Impedance, 1
Inflation, 9
Input signal, 7, 11
Input voltage, 1, 5
Installation, App B
Instrumentation Amplifier, 10
Integral constant, 11, 12
Intensity, 3, 6
Interface, all
Interference, 8, 10
Inverse square, 6
Involuntary action, 8
Ion flow, 8
Isoelectric line, 8

K
K coefficient, 11, 12
Kelvin, 1


L
LabQuest and LabQuest 2, App D
LabQuest Mini, App D
LabVIEW, all
Law of Malus, 6
Lead, 3, 6, 8, 10, 12
LED, 2, 3, 4, 5, 6, 8, 9, 10, 11
Lens, 3
Levitation, 12
Lift, 11, 12
Light, 3, 6
Light emitting diode, 2, 3, 4
Light Sensor, Intro, 6, 7
Linear motion, 7
Load, 7, 10
Long-chain molecules, 6
Luer lock fitting, 9
Lux, 6

M
Magnet, 5, 6
Magnetic field, 5
Magnetic repulsion, 12
Malus, Law of, 6
Mandrel, ceramic, 1
Manual control, 11, 12
MAP, 9
Masseter muscle, 8
Mean arterial pressure, 9
Measured angle, 11
Measured position, 12
Measured strain, 10
Mechanical load, 7
Midpoint, 7
Moment of inertia, 10
Motion, 7, 11
Motion Detector, 12, App C
Motor, DC, 5, 11
Motor, servo, 7
Motor, stepper, 6
Motor coil, 6
Motor controller, 5
Mounting hole, 11
Multimeter, 1
Muscle, 8
Muscle contraction, 8
Muscle fatigue, 8
Muscle tissue, 8
Myocardial infarction, 8
Index
Index - 4
Engineering Projects with NI LabVIEW and Vernier


N
Negative temperature coefficient, 1
Nerve impulse, 8
Neuron, 8
Neutral axis, 10
Neutral position, 7
Noise, 8, 10
Non-consumable, 1
Nonlinear, 1
NTC thermistor, 1

O
Offset, 10
Offset voltage, 10, 11, 12
On-off control, 12
On-off control system, 2
On time, 3, 5
Open-loop control system, 2
Oscillating waveform, 9
Oscillation, 11, 12
Oscillometric method, 9
Output pattern, 2, 3, 4, 5, 6, 8, 9, 11
Output pulse, 3
Output signal, 11
Output voltage, 1, 10, 11, 12
Overshoot, 11, 12

P
P controller, 12
P wave, 8
Pacemaker, 8
Parallel circuit, 2, 5
PD controller, 12
Peak, 8, 9
Peak pressure, 9
Pendulum, 11
Period, 5
Periodic motion, 11
Photogate, 5, 7, App C, App F
Physical pendulum, 11
Physical property, 1
PI controller, 12
PID control, 11, 12
Pitch, 11
Pivot point, 7, 11
Pivoting head, 12
Pneumatics, 9
Point source, 6
Polarity, 2, 5, 6, 8, 9
Polarizing filter, 6
Position, 12
Potential, 8
Potentiometer, 5, 10
Power, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12
Power Amp Express VI, 11, 12, App C
Power Amplifier, 11, 12, App E
Power supply, all
Precision resistor, 1, 10
Pressure, 9, 11
Pressure differential, 11
Process, 11
Propeller, 2, 5, 11
Proportional constant, 11, 12
Proportional-Integral-Derivative control, 11,
12
Proto Board Connector, 5, 7, 11, 12
Prototype, 1
Pulse, 3, 5, 7, 8, 9, 11, 12
Pulse rate, 9
Pulse train, 3, 5, 7
Pulse width, 7
Pulse-width modulation, 3, 5, 7, 11, 12,
App C
Pump, 9
PWM, 3, 5, 7

Q
QRS wave, 8
Quadriceps muscle, 8
Quarter-bridge circuit, 10

R
Raw voltage, 1, 10
Reflection, 6
Reflex pulse, 8
Release valve, 9
Resistance, 1, 4, 5, 6, 7, 10
Resistor, 1, 2, 3, 4, 5, 8, 10
Resting state, 8
Retina, 8
RGB LED, 3
Rotary Motion Sensor, 11, App C
Rotational motion, 7
Index

Engineering Projects with NI LabVIEW and Vernier
Index - 5

Rotational speed, 5
Rotor, 5
RPM, 5

S
Screw, 11
Screw terminal, 5, 7, 10, 11, 12
Semiconductor, 1, 3
Sensitivity switch, 12
Sensor, 1, 12, App E
SensorDAQ, App D
Separation distance, 6
Series circuit, 3
Servo, 7
Servo horn, 7
Servo motor, 7, App C
Set point, 2, 4, 11
Shaft, motor, 2, 5, 6, 7, 11
Shielded system, 12
Shielding, 8, 10
Short, electrical, 4
Signal, 3, 5, 7, 8, 9, 10, 11, 12
Signal processing, 8
Smart system, 2
Solenoid, 9
Sound waves, 12
Spectrum, 3
Speed, 5, 6, 11, 12
Spindle, ceramic, 1
Square wave, 7
Stainless Steel Temperature Probe, 1
State, 5, 7, 8
Stator, 5
Steinhart-Hart equation, 1
Stepper motor, 6, App C
Strain, 10
Strain gage, 10
Strength, 8
Stroke, 9
SubVI, 1, 4, 5, 8, 9, 10
Super Glue, 10
Suppliers, App G
Supplies, App G
Surface electrode, 8
Surface Temperature Sensor, 1, 2, 4
Switch, 5, 11, 12
System, 1, 2, 5, 7, 9, 11, 12
Systolic pressure, 9

T
T-valve, 9
T wave, 8
Tachometer, 5
Target limit, 9
Temperature-controlled system, 2
Temperature, 1, 2, 4, 7, 10, 11
Temperature Probe, 11
Temperature sensor, 1
Tension, 10
Theoretical strain, 10
Thermistor, 1
Thermometer, 1
Thermostat, 2
Threads, 11
Threshold, 2, 4, 8, 10
Thrust, 11
Thumb screw, 11
Time rate of change, 11, 12
Timeout, 4, 5, 7
Tissue, 9
Tolerance, 1
Torque, 5, 7
Tracing, 8
Traffic light, 2
Transistor, 4
Tuning, 11, 12

U
Unblocked state, 5, 7
Uniform oscillation, 11, 12
Unipolar stepper motor, 6
Unit conversions, 1
Unpolarized light, 6
USB cable, all
User friendliness, 1, 6

V
Valve, 9
Variable resistor, 5, 10
Velocity, 11
Ventricle, 8, 9
Ventricular relaxation, 9
Vernier Toolkit, Intro, App A, App B, App C
Vibration, 10
Index
Index - 6
Engineering Projects with NI LabVIEW and Vernier

Viscous liquids, 12
Voltage divider, 1
Voltage drop, 5
Voltage excitation source, 10
Voltage Probe, 5
Voluntary action, 8

W
WAV file, 4
Wavelength, 3
Weighted sum, 11, 12
Wheatstone bridge circuit, 10
White light, 3
Wind speed, 4
Wiper arm, 5
Word Files, App A

Das könnte Ihnen auch gefallen