Intro to Elvis

Transcription

Intro to Elvis
Introduction to NI ELVIS
NI ELVIS II, Multisim, and LabVIEW
TM
Introduction to NI ELVIS
by Professor Barry Paton
Dalhousie University
Course Software Version 2.0
January 2009 Edition
Part Number 323777D-01
Copyright
© 2004–2009 National Instruments Corporation. All rights reserved.
Universities, colleges, and other educational institutions may reproduce all or part of this publication for educational use. For all other
uses, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording,
storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments
Corporation.
Trademarks
National Instruments, NI, ni.com, and LabVIEW are trademarks of National Instruments Corporation. Refer to the Terms of Use section
on ni.com/legal for more information about National Instruments trademarks.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have
no agency, partnership, or joint-venture relationship with National Instruments.
Patents
For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software,
the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/legal/patents.
Worldwide Technical Support and Product Information
ni.com
National Instruments Corporate Headquarters
11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100
Worldwide Offices
Australia 1800 300 800, Austria 43 662 457990-0, Belgium 32 (0) 2 757 0020, Brazil 55 11 3262 3599, Canada 800 433 3488,
China 86 21 5050 9800, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00, Finland 358 (0) 9 725 72511,
France 01 57 66 24 24, Germany 49 89 7413130, India 91 80 41190000, Israel 972 3 6393737, Italy 39 02 41309277,
Japan 0120-527196, Korea 82 02 3451 3400, Lebanon 961 (0) 1 33 28 28, Malaysia 1800 887710, Mexico 01 800 010 0793,
Netherlands 31 (0) 348 433 466, New Zealand 0800 553 322, Norway 47 (0) 66 90 76 60, Poland 48 22 328 90 10,
Portugal 351 210 311 210, Russia 7 495 783 6851, Singapore 1800 226 5886, Slovenia 386 3 425 42 00,
South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 (0) 8 587 895 00, Switzerland 41 56 2005151,
Taiwan 886 02 2377 2222, Thailand 662 278 6777, Turkey 90 212 279 3031, United Kingdom 44 (0) 1635 523545
For further support information, refer to the Additional Information and Resources appendix. To comment on National Instruments
documentation, refer to the National Instruments Web site at ni.com/info and enter the info code feedback.
Contents
Guide to Preparation for This Course
Lesson 1
NI ELVIS II Workspace Environment
Exercise 1-1
Exercise 1-2
Measuring Component Values .........................................................1-3
Building a Voltage Divider Circuit on the
NI ELVIS II Protoboard ...................................................................1-5
Exercise 1-3
Using the DMM to Measure Current................................................1-7
Exercise 1-4
Observing the Voltage Development of an RC Transient Circuit....1-8
Exercise 1-5
Visualizing the RC Transient Circuit Voltage..................................1-10
NI ELVIS II Challenge: Design a Burglar Alarm Using Multisim Simulation..........1-12
Lesson 2
Digital Thermometer
Exercise 2-1
Measurement of the Resistor Component Values ............................2-3
Exercise 2-2
Operating the Variable Power Supply..............................................2-4
Exercise 2-3
A Thermistor Circuit .......................................................................2-6
Exercise 2-4
Building an NI ELVIS Virtual Digital Thermometer.......................2-9
LabVIEW Challenge: Design a Passion Meter Using the Thermistor Circuit ...........2-12
Lesson 3
AC Circuit Tools
Exercise 3-1
Exercise 3-2
Exercise 3-3
Measurement of the Circuit Component Values ..............................3-3
Measurement of Component and Circuit Impedance Z ...................3-4
Testing an RC Circuit with the Function Generator and
Oscilloscope .....................................................................................3-7
Exercise 3-4
The Gain/Phase Bode Plot of the RC Circuit ...................................3-11
Multisim Challenge: Determine the Bode Plot of an RC Circuit ...............................3-14
Lesson 4
Op Amp Filters
Exercise 4-1
Measuring the Circuit Component Values .......................................4-3
Exercise 4-2
Frequency Response of the Basic Op Amp Circuit..........................4-4
Exercise 4-3
Measuring the Op Amp Frequency Characteristic ...........................4-7
Exercise 4-4
Highpass Filter..................................................................................4-9
Exercise 4-5
Lowpass Filter ..................................................................................4-12
Exercise 4-6
Bandpass Filter .................................................................................4-14
Multisim Challenge: Design a Second-Order Lowpass Filter ....................................4-17
© National Instruments Corporation
iii
Introduction to NI ELVIS
Contents
Lesson 5
Digital I/O
Exercise 5-1
Visualizing Digital Byte Patterns .....................................................5-3
Exercise 5-2
555 Digital Clock Circuit .................................................................5-5
Exercise 5-3
Building a 4-Bit Digital Counter ......................................................5-9
Exercise 5-4
LabVIEW Logic State Analyzer ......................................................5-11
Multisim Challenge: Design an 8-bit Digital Counter Circuit....................................5-14
Lesson 6
Magnetic Field Sensors
Exercise 6-1
Testing the Analog Magnetic Field Sensor with NI ELVIS Tools ..6-3
Exercise 6-2
Hysteresis Characteristic of a Magnetic Field Switch......................6-5
Exercise 6-3
Counting Pulses with a Magnetic Switch Sensor .............................6-7
Exercise 6-4
Building a Tachometer .....................................................................6-8
Exercise 6-5
Automatic Counting Using a LabVIEW Program............................6-10
Multisim Challenge: Design a Tachometer Circuit ....................................................6-12
Lesson 7
LEDs to the Rescue!
Exercise 7-1
Exercise 7-2
Exercise 7-3
Testing Diodes and Determining Their Polarity ..............................7-3
Characteristic Curve of a Diode .......................................................7-5
Manual Testing and Control of a Two-Way Stoplight
Intersection .......................................................................................7-8
Exercise 7-4
Automatic Operation of the Two-Way Stoplight Intersection .........7-11
Multisim Challenge: Design a Control Circuit for a Two-Way Stoplight
Intersection ...............................................................................................................7-12
Lesson 8
Free Space Optical Communications
Exercise 8-1
A Phototransistor Detector ...............................................................8-3
Exercise 8-2
Infrared Red Optical Source and Test Circuit ..................................8-6
Exercise 8-3
Free Space IR Optical Link (Analog) ..............................................8-8
Exercise 8-4
Amplitude and Frequency Modulation (Analog) .............................8-9
Exercise 8-5
Free Space IR Optical Link (Digital) ..............................................8-10
Multisim Challenge: Design a High-Speed Optical NRZ Data Link .........................8-12
Lesson 9
RF Wireless Communications
Exercise 9-1
Exercise 9-2
Exercise 9-3
Exercise 9-4
The Transmitter ................................................................................9-3
The Receiver.....................................................................................9-4
Testing the RF Transmitter and Receiver.........................................9-5
Building a Unique Test Signal with an Arbitrary
Waveform Analyzer .........................................................................9-7
Exercise 9-5
A Demonstration of Marconi’s RF Transmission Signal .................9-10
Circuit Challenge: Hearing Is Believing.....................................................................9-11
Introduction to NI ELVIS
iv
ni.com
Contents
Lesson 10
Mechanical Motion
Exercise 10-1 Start Your Engine .............................................................................10-3
Exercise 10-2 The Tachometer................................................................................10-4
Exercise 10-3 Building a Rotary Motion System....................................................10-6
Exercise 10-4 Testing the Rotary Motion System...................................................10-8
Exercise 10-5 A LabVIEW Measurement of RPM .................................................10-9
LabVIEW Challenge: Computer Automation of the Rotary Motion System.............10-12
Lesson 11
Digital Dice
Exercise 11-1
Exercise 11-2
Exercise 11-3
Exercise 11-4
Exercise 11-5
Exercise 11-6
Exercise 11-7
Exercise 11-8
Exercise 11-9
Multisim Dice Display Using Seven LEDs......................................11-5
Converting a Multisim Design into a Real Circuit...........................11-6
A Modulo 6 Counter.........................................................................11-7
Convert the Mod 6 Multisim Design into a Real Circuit .................11-10
Building the System Clock...............................................................11-11
Building a Real Clock Circuit on an NI ELVIS II Protoboard.........11-13
Building the Three- to Four-Line Encoder.......................................11-14
Building and Testing the Digital Dice Encoder ...............................11-16
Electronic Dice .................................................................................11-17
Appendix A
Additional Information and Resources
© National Instruments Corporation
v
Introduction to NI ELVIS
Guide to Preparation for This Course
Throughout this course the NI ELVIS hardware platform is often referred to
as Dev3 in the Device field on instruments and physical channel name. This
naming convention to identify the device is given to NI hardware and often
defaults to Dev1. Be mindful of this; select the correct Device name that
corresponds to your connected instrument when using NI ELVIS with Soft
Front Panels, LabVIEW and Multisim.
Here is a set of instructions to change the device identifier:
1. Open Measurement & Automation Explorer (MAX).
2. Under My System, expand Devices and Interfaces.
3. Expand NI-DAQmx Devices.
4. Select the device name referring to your NI ELVIS workstation and
right-clicking the device and selecting Rename from menu.
5. Type in the name that you would like, Dev3, Dev1 or MyELVIS for
example, press enter when complete.
6. Close MAX.
You have just renamed your device!
A Word from the Author
In 2003, National Instruments introduced a new approach to designing,
testing, and teaching electronic circuits. For the first time, you could take
advantage of a complete suite of standard test instruments on your computer
and directly interface these instruments to circuits built on a small test
station called the National Instruments Educational Laboratory Virtual
Instrumentation Suite (NI ELVIS). Its small footprint and flexibility made it
a popular choice for analog and digital circuit courses, a natural interface to
many fixed instruments, and an effective demonstration station in the
classroom.
NI ELVIS II, together with its new driver software, NI ELVISmx, is even
better. It features a lighter weight, better control layout, more interfacing
ports, an integrated data acquisition device, and Hi-Speed USB
connectivity. This means that if you have NI ELVISmx software installed on
multiple computers, you can use your NI ELVIS II with your office desktop,
your home computer, your laptop in the classroom, or even on a friend’s
computer.
The purpose of this document is to introduce many of the new features of
NI ELVIS II and review some of the early features that have been improved.
We have added new experiments and challenges and integrated NI Multisim
© National Instruments Corporation
vii
Introduction to NI ELVIS
Guide to Preparation for This Course
intuitive circuit schematic and capture software into the NI ELVIS
environment. Now you can take your design from paper or the blackboard
and simulate it within Multisim as a classic schematic diagram on the
NI ELVIS or NI ELVIS II breadboard layout. Once the design is mature,
you can build the real circuit on an NI ELVIS II protoboard and test it with
the same design tools (soft front panel [SFP] instruments) you used to hone
the design. The best part is you can flip back and forth from the real circuit
to the design circuit until you get it just right.
Then you can use it for that special classroom demonstration, for the
technician to build, or as a protoboard for production. You can do all of this
with a laptop and the new NI ELVIS II system on a footprint about same size
as your laptop.
This is the way we should be teaching courses – with high-quality design
tools and lots of hands-on activities. In the classroom, NI ELVIS brings the
material alive. In the lab, NI ELVIS shifts the design paradigm from “what
if” to “let’s try it.”
How You Can Use These Labs
We have designed these labs as a starting point for your own curriculum
design, demonstrations in the classroom, and method to inspire students to
be imaginative and creative in their projects.
Labs 1 through 5 introduce the main software (SFP) instruments featured in
DC, transient, and AC measurements. Both analog and digital circuits are
used. Lab 2, which incorporates a temperature sensor, makes a great
classroom demonstration. Multisim is introduced as a design tool to help
students further understand the circuits used in these labs.
Labs 6 through 10 take a small system approach to investigate magnetic
fields, infrared communications, RF communications, and motion. Here,
Multisim is used as the design tool to simulate the small systems or to
enhance the lab.
Lab 11 features the design approach to circuits and interfacing. A design
problem is taken from a paper design and transferred into a virtual circuit
within Multisim. Using the wide range of Multisim components (more than
3,000), you can design just about any circuit. Once the design is complete,
you can transfer it to NI ELVIS as the “real” design. Using the same
NI ELVIS II tools, you can hone your design by flipping back and forth from
the real circuit to the virtual circuit using the same set of NI ELVIS
diagnostic testing tools. Once the design is complete, it is ready for
production.
Introduction to NI ELVIS
viii
ni.com
NI ELVIS II Workspace Environment
1
The NI ELVIS II environment consists of the following components:
Hardware workspace for building circuits and interfacing experiments
NI ELVIS II software (created in NI LabVIEW software), which includes
the following:
• Soft Front Panel (SFP) instruments
• LabVIEW Application Programmatic Interface (API)
• Multisim Application Programmatic Interface (API)
With the APIs, you can achieve custom control of and access to NI ELVIS II
workstation features using LabVIEW programs and simulation programs
written within Multisim.
Figure 1-1. NI ELVIS II Workstation
Goal
This lab introduces NI ELVIS II by showing how you can use the
workstation to measure electronic component properties. Then you can
build circuits on the protoboard and later analyze them with the NI ELVIS II
suite of SFP instruments. This lab also shows how you can use Multisim to
design and simulate a circuit before building the circuit on the NI ELVIS II
workstation and controlling it with a LabVIEW program.
© National Instruments Corporation
1-1
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
Required Soft Front Panels (SFPs)
•
Digital Ohmmeter DMM[Ω],
•
Digital Capacitance Meter DMM[
•
Digital Voltmeter DMM[V]
]
Required Components
Introduction to NI ELVIS
•
1.0 kΩ resistor, R1, (brown, black, red)
•
2.2 kΩ resistor, R2, (red, red, red)
•
1.0 MΩ resistor, R3, (brown, black, green)
•
1 μF capacitor, C
•
Project resistors – 7.5 kΩ, 1 kΩ, 2 kΩ, 4 kΩ, and 8 kΩ nominal values
1-2
ni.com
Lab 1
Exercise 1-1
NI ELVIS II Workspace Environment
Measuring Component Values
1. Connect the NI ELVIS II workstation to your computer using the
supplied USB cable. The box USB end goes to the NI ELVIS II
workstation and the rectangular USB end goes to the computer. Turn on
your computer and power up NI ELVIS II (switch on the back of
workstation). The USB ACTIVE (orange) LED turns ON. In a moment,
the ACTIVATE LED turns OFF and the USB READY (orange) LED
turns ON.
2. On your computer screen, click on the NI ELVISmx Instrument
Launcher Icon or shortcut. A strip of NI ELVIS II instruments appears
on the screen. You are now ready to make measurements.
Figure 1-2. NI ELVISmx Instrument Launcher Icon Strip
3. Connect two banana-type leads to the digital multimeter (DMM) inputs
[VΩ
] and [COM] on the left side of the workstation. Connect the
other ends to one of the resistors.
4. Click on the DMM icon within the NI ELVISmx Instrument Launcher
to select the digital multimeter.
Figure 1-3. Digital Multimeter, Ohmmeter configuration
© National Instruments Corporation
1-3
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
You can use the DMM SFP for a variety of operations such as voltage,
current, resistance, and capacitance measurements. Use the notation
DMM[X] to signify the X operation.
The proper lead connections for this measurement are shown on the DMM
front panel.
5. Click on the Ohm button [Ω] to use the digital ohmmeter function,
DMM[Ω]. Click on the green arrow [Run] box to start the measurement
acquisition. Measure the three resistors R1, R2, and R3.
Fill in the following data:
R1 _______ (1.0 kΩ nominal)
R2 ______ (2.2 kΩ nominal)
R3 _______ (1.0 MΩ nominal)
To stop the acquisition, click on the red square [Stop] box.
Note If you click on the Mode box, you can change the {Auto} ranging to {Specify
Range} and select the most appropriate range by clicking on the Range box.
End of Exercise 1-1
Introduction to NI ELVIS
1-4
ni.com
Lab 1
Exercise 1-2
NI ELVIS II Workspace Environment
Building a Voltage Divider Circuit on the
NI ELVIS II Protoboard
1. Using the two resistors, R1 and R2, assemble the following circuit on the
NI ELVIS II protoboard.
Figure 1-4. Voltage Divider Circuit
2. Connect the input voltage, Vo, to the [+5 V] pin socket.
3. Connect the common to the [GROUND] pin socket.
4. Connect the external leads to the DMM voltage inputs [VΩ ] and
[COM] on the side of the NI ELVIS workstation and the other ends
across the 2.2 kΩ resistor.
5. Check the circuit and then apply power to the protoboard by pushing the
prototyping board power switch to the upper position [–]. The three
power indicator LEDs, +15 V, –15 V, and +5 V, should now be lit and
green in color.
Figure 1-5. Power LED Indicators on NI ELVIS II protoboard.
© National Instruments Corporation
1-5
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
Note If any of these LEDS are yellow while the others are green, the resettable fuse for
that power line has flipped off. To reset the fuse, turn off the power to the protoboard.
Check your circuit for a short. Turn the power back on to the protoboard. The LED
flipped should now be green.
6. Connect the DMM[V] test leads to Vo and measure the input voltage
using the DMM[V] function. Press [Run] to acquire the voltage data.
V0 (measured) _______________
According to circuit theory, the output voltage, V2 across R2, is as
follows:
V2 = R2/(R1+R2) * Vo.
7. Using the previous measured values for R1, R2 and Vo, calculate V2.
Next, use the DMM[V] to measure the actual voltage V2.
V2 (calculated) ________________
V2 (measured) ________________
8. How well does the measured value match your calculated value?
End of Exercise 1-2
Introduction to NI ELVIS
1-6
ni.com
Lab 1
Exercise 1-3
NI ELVIS II Workspace Environment
Using the DMM to Measure Current
According to Ohm’s law, the current (I) flowing in the above circuit is equal
to V2/R2.
1. Using the measured values of V2 and R2, calculate this current.
2. Perform a direct current measurement by moving the external lead
connected to [VΩ
] to the current input socket (A). Connect the other
ends to the circuit as shown below.
Figure 1-6. Circuit Modification to measure Current
3. Select the function DMM[A] and measure the current.
I (calculated) ________________
I (measured) ________________
4. How well does the measured value match your calculated value?
End of Exercise 1-3
© National Instruments Corporation
1-7
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
Exercise 1-4
Observing the Voltage Development of an
RC Transient Circuit
Using the DMM[
] function, measure the 1 μF capacitor.
1. Connect the capacitor leads to the Impedance Analyzer inputs, [DUT+]
and [DUT–], found on the left lower wiring block of a NI ELVIS II
protoboard.
2. For capacitance and inductance measurements, the protoboard must be
energized to make a measurement. Switch the protoboard power ON.
3. Click on the capacitor button [ ] to measure the capacitor C with the
DMM[ ] function. Press the Run button to acquire the capacitance
value.
C_______(μf)
4. Build the RC transient circuit as shown in the following figure. It uses
the voltage divider circuit where R1 is now replaced with R3 (1 MΩ
resistor) and R2 is replaced with the 1 μF capacitor C. Move your DMM
leads to input sockets [VΩ
] and [COM]. The other ends go across
the capacitor.
Figure 1-7. RC Transient Circuit
5. Select DMM[V] and click on RUN.
6. When you power up the circuit, the voltage across the capacitor rises
exponentially. Set the DMM voltage range to {Specify Range} [10 V].
Turn on the protoboard power and watch the voltage change on the
digital display and on the %FS linear scale.
Introduction to NI ELVIS
1-8
ni.com
Lab 1
NI ELVIS II Workspace Environment
7. It takes about a few seconds to reach the steady-state value of Vo. When
you power off the circuit, the voltage across the capacitor falls
exponentially to 0 V. Try it!
This demonstrates one of the special features of the NI ELVIS II digital multimeter
it can still be used even if the power to the protoboard is turned off.
Note
End of Exercise 1-4
© National Instruments Corporation
1-9
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
Exercise 1-5
Visualizing the RC Transient Circuit Voltage
1. Remove the +5 V power lead and replace it with a wire connected to the
variable power supply socket pin [SUPPLY+]. Connect the output
voltage, VC, to the analog input socket pins, [AI 0+] and [AI 0–], as
shown in the following figure.
Figure 1-8. RC Transient circuit on NI ELVIS II protoboard
Close NI ELVIS II and launch LabVIEW.
From the NI ELVIS II program library folder, select RC Transient.vi.
This program uses LabVIEW APIs to turn the variable power supply to
a set voltage of +5 V for 5 s and then to reset the VPS voltage to 0 V for
5 s while the voltage across the capacitor is measured and displayed in
real time on a LabVIEW chart.
Introduction to NI ELVIS
1-10
ni.com
Lab 1
NI ELVIS II Workspace Environment
Figure 1-9. Charging and Discharging Waveform of the RC Transient circuit
This type of square wave excitation dramatically shows the charging and
discharging characteristics of a simple RC circuit.
2. Take a look at the LabVIEW diagram window to see how this program
works.
Figure 1-10. LabVIEW Block Diagram for the program RC Transient.vi
In the first frame of the four-frame sequence, the NI ELVISmx Variable
Power Supplies VI (virtual instrument) outputs +5.00 V to the RC circuit on
the NI ELVIS II protoboard. The next frame measures 50 sequential voltage
readings across the capacitor at 1/10-second intervals. In the for loop, the
DAQ Assistant takes 100 readings at a rate of 1000 S/s and passes these
values to a cluster array (thick blue/white line). From the cluster, the data
array (thick orange line) is passed on to the Mean VI. It returns the average
value of the 100 readings. The average is then passed to the chart via a local
variable terminal <<RC Charging and Discharging>>. The next frame sets
© National Instruments Corporation
1-11
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
the VPS+ voltage equal to 0 V. The last frame measures another 50 averaged
samples for the discharge cycle. This program records one complete cycle
of the charging and discharging of a RC circuit. To repeat the cycle,
continuously place the above program inside a while loop.
NI ELVIS II Challenge: Design a Burglar Alarm Using Multisim
Simulation
Design a burglar alarm for a house requiring three entry sensors and one
window sensor. If the alarm system is activated, sound the alarm as soon as
one of the sensors detects an open door or window. Signal to the front panel
displays which door or window is open and sound an alarm.
Aside: In practice, this is a simple system requiring only two wires be
connected to each door or window from a central alarm system. In your
smart system, a loop design requires only one wire where each sensor switch
shorts out or opens a sensor address resistor. The magnitude of the resistor
defines which sensor (door or window) has been opened.
Launch Multisim and open the file Alarm Design Version 0.
Figure 1-11. Multisim Smart Sensor Design
Introduction to NI ELVIS
1-12
ni.com
Lab 1
NI ELVIS II Workspace Environment
The ON position of these switches (left side) signals when the door is
closed. Click the switch to close or open a door or window.
Your design consists of a power supply (+5 V), a digital multimeter, five
resistors, and four switches. The four resistors, 1 kΩ, 2 kΩ, 4 kΩ, and 8 kΩ,
are placed at the door or window locations with the resistor value as the
“address” of that location. The circuit is a simple loop with the switches
placed across the address resistors to simulate the opening and closing of a
window or door. Finally, the resistor, R5, limits the current when all the
switches are closed. The current limiting resistor value is taken as half of the
value of all the address resistor values added in series (7.5 kΩ).
To view the circuit operation, click on Run and open (1) and close (0) each
switch, one at a time, using the mouse cursor.
Fill in the following table:
R1
0
1
0
0
0
1
R2
0
0
1
0
0
1
R3
0
0
0
1
0
1
R4
0
0
0
0
1
1
Voltage
0.00
3.33
Each switch when opened generates a unique voltage, which, when read by
the voltmeter, reveals which window or door is open.
Now that the design is complete, you can transfer the design into the real
world as a test circuit built on an NI ELVIS II protoboard.
Select five resistors as close to the design values as you have available.
Launch NI ELVIS DMM[Ω] and measure the value for each of your chosen
resistors.
Fill in the following table of Real Resistor values:
R1 _____________ (kΩ)
R2 _____________ (kΩ)
R3 _____________ (kΩ)
R4 _____________ (kΩ)
R5 _____________ (kΩ)
© National Instruments Corporation
1-13
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
Now go back to Multisim and replace the nominal resistor values with the
measured (real-world) resistor values by double-clicking on each resistor in
turn and entering the measured value. This becomes your new Alarm Design
Version 1.
Figure 1-12. Real World Sensor Design
You can now repeat your measurements of the predicted voltage readings
when a window or a door is opened or closed.
Introduction to NI ELVIS
1-14
ni.com
Lab 1
NI ELVIS II Workspace Environment
Use these resistors and five jumpers or push button switches to construct a
circuit similar to the one shown on a NI ELVIS II protoboard in the
following figure.
Figure 1-13. Real World Sensor Circuit on NI ELVIS II protoboard
Use the DMM[V] to verify its operation is similar to your real-world
Multisim design, version 1.
LabVIEW Demonstration
LabVIEW is a powerful programming language that you can use for many
tasks including the measurement and control of circuits built on an
NI ELVIS II protoboard. With one modification to the above circuit, you can
route the alarm voltage levels to a LabVIEW program.
Connect the voltage + pin (orange wire) to [AI 0+] socket pin and the
GROUND to [AI 0–] socket pin. You can leave the DMM[V] connected if
you wish to monitor the sensor voltage. The digital multimeter uses a
different data acquisition card than NI ELVIS II analog inputs use.
Imagine running the NI ELVIS suite of SFPs at the same time as a
LabVIEW program is running.
© National Instruments Corporation
1-15
Introduction to NI ELVIS
Lab 1
NI ELVIS II Workspace Environment
Launch LabVIEW and open the program House.vi for a unique view of the
burglar alarm system.
Figure 1-14. LabVIEW Front Panel House.vi
To operate the program, click on Run. If NI ELVIS II is connected and
turned ON and power is applied to the protoboard, actions on the protoboard
are signaled on the LabVIEW front panel. Each switch is mapped to a
particular window or door. When open, an entry port appears black. Any
open door or window sets off a red alarm along the eves trough. To end the
program, click on the Alarm Off front panel slide switch
Figure 1-15. The LabVIEW Block Diagram for the Program House.vi
Introduction to NI ELVIS
1-16
ni.com
Lab 1
NI ELVIS II Workspace Environment
The DAQ Assistant is programmed to read 100 consecutive voltage values
at a rate of 1000 S/s. From the data cluster (blue/white line), select the array
of voltages. The Mean.vi calculates the average value of this set of readings
and sends it to the voltage trigger ladder. Whenever the voltage level falls
between two limiting values (orange boxes), the corresponding condition is
signaled on the front panel. The limiting values are picked as halfway
between two neighboring trigger levels. The four-input OR function sets off
the alarm if any door or window is opened.
This design only detects the first occurrence of an open window or door. If
you add a few more rungs to the limiting ladder, you can detect multiple
openings and closings.
© National Instruments Corporation
1-17
Introduction to NI ELVIS
2
Digital Thermometer
Figure 2-1. LabVIEW Front Panel for a Digital Thermometer
A thermistor is a two-wire device manufactured from a semiconductor
material. It has a nonlinear response curve and a negative temperature
coefficient. Thermistors make ideal sensors for measuring temperature over
a wide dynamic range and are useful in temperature alarm circuits.
Goal
This lab introduces the NI ELVIS II variable power supply (VPS). You can
use it with the workstation side panel controls or the virtual controls on your
computer screen, or you can embed it inside a LabVIEW program. The VPS
excites a 10 kΩ thermistor in a voltage divider circuit. The voltage measured
across the thermistor is related to its resistance, which, in turn, is related to
its temperature. This lab demonstrates how you can use LabVIEW controls
and indicators together with NI ELVIS APIs to build a digital thermometer.
© National Instruments Corporation
2-1
Introduction to NI ELVIS
Lab 2
Digital Thermometer
Required Soft Front Panels (SFPs)
•
Digital ohmmeter DMM[Ω]
•
Digital voltmeter DMM[V]
•
Variable Power Supply (VPS)
Required Components
Introduction to NI ELVIS
•
10 kΩ resistor, R1, (red, black, orange)
•
10 kΩ thermistor, RT
2-2
ni.com
Lab 2
Exercise 2-1
Digital Thermometer
Measurement of the Resistor Component Values
1. Launch NI ELVIS II.
2. Select digital multimeter (DMM) from the SFP strip of instruments.
3. Click on the Ohm button.
4. Connect the test leads to DMM [VΩ
] and [COM] side sockets.
5. Measure the 10 kΩ resistor and then the thermistor.
6. Fill in the following chart:
10 kΩ Resistor _________________ Ohms
Thermistor _________________ Ohms
7. With the thermistor still connected, place the thermistor between your
finger tips to heat it up and watch the resistance change. It is especially
interesting to watch the changes on the display bar scale (%FS).
The fact that the resistance decreases with increasing temperature (negative
temperature coefficient) is one of the key characteristics of a thermistor.
Thermistors are manufactured from semiconductor material whose
resistivity depends exponentially on ambient temperature and results in a
nonlinear response. Compare the thermistor response with an RTD
(100 Ω platinum resistance temperature device) shown in the following
figure.
Figure 2-2. Resistance-Temperature Curve of a Thermistor and an RTD
End of Exercise 2-1
© National Instruments Corporation
2-3
Introduction to NI ELVIS
Lab 2
Digital Thermometer
Exercise 2-2
Operating the Variable Power Supply
Complete the following steps to set a voltage level on one or both of the
variable power supplies.
1. From the strip menu of SFPs, select the [VPS] icon. There are two
controllable power supplies with NI ELVIS II, 0 to –12 V and 0 to +12 V,
each with a 500 ma current limit.
Figure 2-3. Virtual SFP for Variable Power Supplies
In the default mode, you can control the VPS with the virtual panel
shown above. Set the output voltage on the virtual knob and click on the
[Run] box. The output voltage is shown (blue in color) in the display
area above your chosen power supply. When you click on the stop
button, the output voltage is reset to zero on the protoboard.
To sweep the output voltage through a range of voltages, make sure that you have
clicked the [Stop] button. Select the Supply Source (+ or –), Start Voltage, Stop Voltage,
Step Size, and Step Interval, and click on [Sweep].
Note
For manual operation, click on the Manual box and use the knobs on the
right side of the NI ELVIS II workstation to set the output voltages. To
view the output voltage in the display area, click on the white box now
appearing next to the LabVIEW label.
Introduction to NI ELVIS
2-4
ni.com
Lab 2
Digital Thermometer
2. Connect the leads from the protoboard strip connector sockets labeled
Variable Power Supplies [Supply +] and [Ground] to the DMM voltage
inputs.
3. Select DMM[V] and click on RUN. Select VPS front panel and click on
RUN.
4. Rotate the virtual VPS control for Supply + and observe the voltage
changes on the DMM[V] display.
Note
You can use the [RESET] button to quickly reset the voltage back to zero.
5. Click on the Manual box to activate the real controls on the right side of
the workstation. The virtual controls are grayed out. Observe that the
green LED Manual Mode on the NI ELVIS II workstation is now lit.
6. Rotate the + voltage supply knob and observe the changes on the DMM.
Note
VPS– works in a similar fashion except the output voltage is negative.
End of Exercise 2-2
© National Instruments Corporation
2-5
Introduction to NI ELVIS
Lab 2
Digital Thermometer
Exercise 2-3
A Thermistor Circuit
Complete the following steps to build and test the thermistor circuit.
1. On the workstation protoboard, build a voltage divider circuit with the
10 kΩ resistor and a thermistor. The input voltage is wired to [Supply +]
and [Ground] sockets. The voltage across the thermistor goes to the
DMM[V] leads.
To VPS[+]
10 k Ω
To DMM
Thermistor
To Gnd
To Ground
Figure 2-4. Temperature Measuring circuit using a Thermistor
Figure 2-5. Real Thermistor circuit on NI ELVIS protoboard
Introduction to NI ELVIS
2-6
ni.com
Lab 2
Digital Thermometer
2. Make sure the Variable Power Supply voltage levels are set to zero.
Apply power to the protoboard and observe the voltage levels on the
DMM display. Increase the voltage from 0 to +5 V. The measured
voltage across the thermistor, VT, should increase to about 2.5 V.
3. Reduce the power supply voltage to +3 V. This ensures that the
self-heating (Joule heating) inside the thermistor does not affect the
reading of the external temperature.
4. Heat the thermistor with your finger tips and watch the voltage decrease.
You can rearrange the voltage divider equation to calculate the
thermistor resistance as follows:
RT = R1 * VT /(3 –VT)
At an ambient temperature of 25 °C, the thermistor resistance should be
about 10 kΩ.
With this equation, called a scaling function, you can convert the
measured voltage into the thermistor resistance. You can easily measure
VT with the NI ELVIS II DMM or within a LabVIEW program (VI).
In LabVIEW, the above scaling equation is coded as a subVI and looks
like the following block diagram.
Figure 2-6. Block Diagram for Scaling Function
The thermistor response curve demonstrates the relationship between device
resistance and temperature. It is clear from this curve that a thermistor has
the three following characteristics:
•
The temperature coefficient ΔR/ΔT is negative.
•
The response curve is nonlinear (exponential).
•
The resistance varies over many decades (refer to Figure 2-2).
You can produce a calibration curve by fitting a mathematical equation to
the response curve (see Appendix at the end of this chapter). LabVIEW has
many mathematical tools to fit such a relationship. When you find the
© National Instruments Corporation
2-7
Introduction to NI ELVIS
Lab 2
Digital Thermometer
correct equation, you can calculate the temperature for any resistance within
the calibrated region. The following calibration VI is typical for a thermistor
and demonstrates how you can use the LabVIEW formula node to evaluate
mathematical equations.
Figure 2-7. For this thermistor, the calibration equation is
R = 29.95798 exp(–0.04452 T).
End of Exercise 2-3
Introduction to NI ELVIS
2-8
ni.com
Lab 2
Exercise 2-4
Digital Thermometer
Building an NI ELVIS Virtual Digital
Thermometer
The digital thermometer program Digital Thermometer.vi activates the VPS
to power up the thermistor circuit. It then reads the voltage across the
thermistor, converts it into a temperature, and displays its value in a variety
of formats on the front panel.
Measurement, scaling, calibration, and display occur in sequence within the
while loop. VoltsIn.vi measures the thermistor voltage. Scaling.vi converts
the measured voltage to resistance according to the scaling equation above.
Convert R-T.vi uses a known calibration curve to convert the resistance into
temperature. Finally, the temperature is displayed on the LabVIEW front
panel as a number, meter reading, and thermometer display. The Wait
function of 100 ms ensures that the voltage is sampled every one-tenth of a
second.
All of these actions occur within the while loop until you click the [Stop]
button on the front panel.
Figure 2-8. Block Diagram for Digital Thermometer Program
Thermistors like resistors create heat (Joule heating) as a current passes
through them. For a thermistor that is trying to report the external
temperature, this self-heating can be a problem. The trick is to minimize the
current so that the temperature effects outside the thermistor dominate the
© National Instruments Corporation
2-9
Introduction to NI ELVIS
Lab 2
Digital Thermometer
self-heating. For your 10 kΩ thermistor, a driving voltage of +3 V meets this
requirement. With a LabVIEW Express VI, you can program the VPS on the
NI ELVIS II workstation. The value 3 in the orange box sets a +3.0 V output
on VPS+. One extra line, green in color, connected to the STOP icon ensures
the VPS is reset to zero volts when the program ends.
Complete the following steps to open and view the components and code in
the digital thermometer VI:
1. From the Hands-On NI ELVIS II library folder, open Digital
Thermometer.vi.
2. Open the block diagram (Window»Show Block Diagram) and subVIs
(double-click on the icons) to view the program flow and see how the
subVIs and the Read and Convert functions are coded.
With the calibration curve for your thermistor, you can update the subVI
(Convert R-T) with the proper equation and use it to achieve a functioning
digital thermometer.
If you want to write your own program, find the VPS API function in the
Functions palette (Functions»Measurement I/O»NI ELVISmx»NI
ELVISmx Variable Power Supplies).
Introduction to NI ELVIS
2-10
ni.com
Lab 2
Digital Thermometer
Figure 2-9. Functions Palette
End of Exercise 2-4
© National Instruments Corporation
2-11
Introduction to NI ELVIS
Lab 2
Digital Thermometer
LabVIEW Challenge: Design a Passion Meter Using the
Thermistor Circuit
When an individual becomes embarrassed, excited, or just plain hot, blood
flows to the skin to keep body’s core temperature constant a sort of an
internal air conditioning. The in-rush of blood to the skin appears as a
reddened patch, and the skin temperature of that patch becomes hot to the
touch. Telling a joke can lead to burning earlobes for some people. By
placing the thermistor on that reddened part, you can measure this
temperature rise.
Design a LabVIEW program to measure the body skin temperature. The
normal body temperature is 38.5 °C. Use this value as the maximum scale
reading on a LabVIEW thermometer control. Use the ambient room
temperature (25 °C) as the lower limit. Be creative with your front panel
labels.
From the Hands-On NI ELVIS II library folder, open Passion Meter.vi
Figure 2-10. Front Panel for Passion Meter.vi
Try placing the sensor between your thumb and forefinger for yourself and
a group of your friends. You will be surprised at the range of finger
temperatures. Have fun!
Introduction to NI ELVIS
2-12
ni.com
Lab 2
Digital Thermometer
Appendix: Building a Calibration Curve
The thermistor manufacturer’s calibration curve can provide an average
calibration curve, but for precise measurements or for an unknown
thermistor, you will need to find your own calibration curve. This appendix
provides a three step process, using Multisim and LabVIEW programs to aid
in building a subVI to convert the measured resistance into temperature for
your temperature sensor.
Step 1. Take Measurements of Know Temperatures
A. Measure 0 Degrees Centigrade
Attached lead wires to your sensor. To water proof your sensor, slip a
hollow tube over the leads and seal the leads with silicon seal glue. Bind
your sensor to a calibrated sensor such as an alcohol thermometer or an
Analog Devices AD590 electronic thermometer. Place the thermometer
and sensor into a metal cup or a glass beaker. Place some ice and water
into the cup. By stirring, you can form a reference temperature point
close to 0 degrees centigrade. This happens when the ice and water are
in equilibrium with each other. Measure this point.
B. Measure 100 Degrees Centigrade
Once the iced melts, place the cup onto a stove element or Bunsen
burner and heat the water up to the boiling point. This may take 5 – 10
minutes. Measure the resistance at select temperature points and create
a table of Resistance and Temperature as shown in the following table.
Resistance (W)
Temperature (C)
1854
0
—
5
—
—
—
—
3128
100
C. Simulate Measurements in Multisim
To demonstrate this step, a Multisim program simulates a real RTD
(Resistance Temperature Detector), a Honeywell ‘linear’ temperature
sensor TD5A. Load the Multisim program Temperature Sensor. Click on
Run (green triangle). Using the mouse or the key ‘T’ (to add 5 degrees)
or shift ‘T’ (to subtract 5 degrees), you can change the temperature of
the sensor. The Ohmmeter reads the appropriate values.
© National Instruments Corporation
2-13
Introduction to NI ELVIS
Lab 2
Digital Thermometer
Figure 2-11. Multisim example using the ohmmeter to measure resistance
Fill in the Resistance-Temperature Table from 0 to 100 degrees C in steps of
10 degrees in the following table.
Resistance (W)
Temperature (C)
0
10
20
30
40
50
60
70
80
90
100
Introduction to NI ELVIS
2-14
ni.com
Lab 2
Digital Thermometer
Step 2. Fitting an Equation to the Measure Data Points
LabVIEW has many analysis VIs for fitting 2D data points to an
approximate mathematical function. This is known as curve fitting.
In this step, you can use the LabVIEW linear fit function to fit a straight line
(R = m*T + b) to the TD5A sensor data. The fitted line is characterized with
just two parameters, the slope (m) and the intercept (b).
Load the LabVIEW program Linear Fit.vi. Fill in all the blank data
locations in the input array and click on RUN.
Figure 2-12. Graph of measured expected calibration data points
This program creates a graph of all the input data points (yellow dots) and
performs the Least Squares Fit to a straight line (red line) by estimating the
slope and intercept of the measured data.
© National Instruments Corporation
2-15
Introduction to NI ELVIS
Lab 2
Digital Thermometer
Step 3. Building a Conversion of Resistance to Temperature subVI
In a real circuit, the Resistance is the property being measured or calculated
and the Temperature is the desired measurement unit. Because of the
relationship you calculated in step 2, you can rearrange the equation to
calculate the temperature given any resistance and implement it using the
method below in Figure 2-13.
T = (R – b)/m
Figure 2-13. Block Diagram used to calculate Temperature of a given Resistance
Load the LabVIEW program Linear R-T.vi to view a simple subVI to
convert your sensor measurement into temperature. This VI can also be used
as a sub-VI in a digital thermometer program employing a TD5A sensor to
take live temperature radings.
Figure 2-14. Front Panel for calibration VI for Linear RTD Type TD5A
For a Thermistor Temperature Sensor, the resistance of a thermistor varies
exponentially with the temperature. In step 2 use a LabVIEW Exponential Fit function
found in Programming»Mathematics»Fitting palette.
Note
Introduction to NI ELVIS
2-16
ni.com
3
AC Circuit Tools
Figure 3-1. Scope SFP showing two channel capability
Many electronic circuits contain alternating current (AC). Designing good
circuits requires tools to measure components, impedance values, and tools
to display circuit properties. With good AC tools and minimal circuit
knowledge, you can modify any circuit to achieve optimal response.
Goal
This lab introduces the NI ELVIS II tools for AC circuits: a digital
multimeter, function generator, oscilloscope, impedance analyzer, and Bode
analyzer.
Required Soft Front Panels (SFPs)
•
Digital Multimeter using Ohmmeter/Capacitance (DMM[Ω/
•
Function Generator (FGEN)
•
Oscilloscope (Scope)
•
Impedance Analyzer (Imped)
•
Bode Analyzer (Bode)
© National Instruments Corporation
3-1
])
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
Required Components
Introduction to NI ELVIS
•
1 kΩ resistor, R, (brown, black, red)
•
1 μF capacitor, C
3-2
ni.com
Lab 3
Exercise 3-1
AC Circuit Tools
Measurement of the Circuit Component Values
Complete the following steps to obtain the values of the circuit components:
1. Launch the NI ELVIS II Instrument Strip.
2. Select Digital Multimeter.
3. Connect test leads to the DMM [VΩ
] and [COM].
4. Use DMM[Ω] to measure the resistor, R.
5. Use DMM[
] to measure the capacitor, C.
6. Fill in the following chart:
Resistor R _________________ kΩ (1 kΩ nominal)
Capacitor C _________________ μF (1 μF nominal)
7. Close the DMM.
End of Exercise 3-1
© National Instruments Corporation
3-3
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
Exercise 3-2
Measurement of Component and Circuit
Impedance Z
For a resistor, the impedance is the same as the DC resistance. You can
represent it on a 2D plot as a line along the x-axis, which is often called the
real component. For a capacitor, the impedance (or more specifically, the
reactance), XC is imaginary, depends on frequency, and is represented as a
line along the y-axis of a 2D plot. It is called the imaginary component.
Mathematically, the reactance of a capacitor is represented by:
XC = 1/jωC
where ω is the angular frequency (measured in radians/sec) and j is a symbol
used to represent an imaginary number. The impedance of an RC circuit in
series is the sum of these two components where R is the resistive (real)
component and XC is the reactive (imaginary) component.
Z = R + XC = R + 1/jωC Ω
Impedance can also be represented as a phasor vector on a polar plot with:
Magnitude = (R2 + XC2)
and
Phase θ = tan–1 (XC / R)
A resistor has a phasor along the real (x) axis. A capacitor has a phasor along
the negative imaginary (y) axis. Recall from complex algebra that
1/j = –j.
Introduction to NI ELVIS
3-4
ni.com
Lab 3
AC Circuit Tools
Complete the following steps to visualize this phasor in real time:
1. Select Impedance Analyzer (Imped) from the NI ELVISmx
Instrument Launcher.
Figure 3-2. Phasor Vector for an RC circuit at 1000 Hz
2. Place your components on the NI ELVIS II protoboard.
3. Connect jumpers from Impedance Analyzer DUT+ and DUT– to the
nominal 1 kΩ resistor.
4. Turn on power to the NI ELVIS II protoboard and click on Run.
5. Verify that the resistor phasor is along the real axis and its Phase is zero.
6. Connect the Impedance jumpers to the capacitor.
7. Verify that the capacitor phasor is along the negative imaginary axis and
its Phase is 270 or –90 degrees.
8. The default measurement frequency is 1000 Hz. Adjust the frequency
value and observe that the reactance (length of the phasor) gets smaller
when you increase the frequency and larger when you decrease the
frequency. Recall |Xc| = 1/ωC.
9. Connect the Impedance jumpers across the capacitor and resistor in
series. The phasor has now both a real and imaginary component.
10. Change the measurement frequency from 100, to 500, to 1000, to 1500
Hz and watch the phasor move.
11. Adjust the frequency until the magnitude of the reactance |Xc| equals the
magnitude of the resistor, R. At this special frequency, the phasor phase
reads 315 or –45 degrees.
12. What is the magnitude of the phasor ____________?
© National Instruments Corporation
3-5
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
13. Answer: |R| 2
14. Close the Impedance Analyzer window.
End of Exercise 3-2
Introduction to NI ELVIS
3-6
ni.com
Lab 3
Exercise 3-3
AC Circuit Tools
Testing an RC Circuit with the Function
Generator and Oscilloscope
Complete the following steps to build and test the RC circuit.
1. On the workstation protoboard, build a voltage divider circuit, using a
1 μF capacitor and a 1.0 kΩ resistor.
2. Connect the RC circuit inputs to function generator [FGEN] and
[Ground] pin sockets on the protoboard.
Figure 3-3. Real RC components connected to the FGEN
The power supply for an AC circuit is often a function generator. Use it
to test your RC circuit.
© National Instruments Corporation
3-7
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
3. From the NI ELVISmx Instrument Launcher, select FGEN icon.
Figure 3-4. FGEN front panel
The FGEN SFP has controls, which can do the following:
•
select the waveform type (sine, triangle, or square)
•
set the frequency by rotating the Frequency dial or entering the
frequency into a text box [Hz]
•
select the waveform amplitude and any offset using the Amplitude and
DC Offset controls
Function Generator real controls (Frequency) and (Amplitude) are also
available on the right side of the NI ELVIS II workstation. As with the
variable power supply, you can enable manual control by clicking on the
Manual Mode box [ ]. A green LED on the right side of the workstation
comes on to indicate manual control. The Frequency and Amplitude knobs
are now active and the virtual controls are grayed out on the NI ELVISmx
Function Generator window.
Note The Function Generator also provides some special operations such as signal
modulation (AM or FM) or frequency sweeping. You will use these features in a later lab.
4. Set the Function Generator to Sine wave, 2000 Hz, 2 Vpk–pk. Click on
Run.
Introduction to NI ELVIS
3-8
ni.com
Lab 3
AC Circuit Tools
You can use the Scope SFP to visualize and analyze the voltage signals
of the RC circuit.
5.
From the NI ELVISmx Instrument Launcher, select the Scope icon.
Figure 3-5. Sine wave displayed on the Scope front panel
The scope instrument SFP is similar to most oscilloscopes, but the
NI ELVIS II oscilloscope can automatically connect inputs to a variety
of sources, features built-in AC measurements and waveform cursors,
and can easily log a waveform pattern.
6. Connect test leads from the CH0 BNC connector on the left side of the
NI ELVIS II workstation across the 1 kΩ resistor in your RC circuit.
Apply power to the protoboard and click on the oscilloscope [Run]
button.
7. You see a sine wave on the oscilloscope. Set the controls as follows:
•
Scale CH0 500 mV/div
•
Coupling CH0 AC
•
Time base 500 μs/div
•
Trigger (Edge), Source (Chan 0 Source), Level (V) (0.1)
Check out the Channel 0 measurements RMS, Freq, and Vpk–pk at the bottom
of the waveform screen. You can activate cursors to measure time-related
parameters such as period, duty cycle, and time intervals.
8. Play with the FGEN controls (virtual or real) and observe the changes
on the oscilloscope window.
© National Instruments Corporation
3-9
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
9. Connect another set of test leads from Scope CH1 to the Function
Generator SYNC pin socket and GROUND on the protoboard. SYNC is
a TTL 5 V signal often used for triggering.
10. Click the Scope CH1 enable box [ ]. You see a new signal (blue in color)
and at TTL levels. For reference, see the oscilloscope picture at the start
of this lab, Figure 3-1.
11. The RC circuit is a passive highpass filter with a low-frequency cutoff
point near 160 Hz. You can visualize the filter parameters using the
FGEN Sweep Frequency feature. Set the oscilloscope at the above
settings. Set the FGEN controls to the following:
–
Start Frequency 5 Hz
–
Stop Frequency 5 kHz
–
Step 50 Hz
Click on the Function Generator [Stop] button and then click on the
[Sweep] button.
12. Observe how the filtered signal CH 0 changes with respect to the SYNC
CH 1 signal in both amplitude and phase as the frequency is swept.
At low frequencies, the signal CH 0 is smaller in amplitude and not in
phase with the SYNC signal. At higher frequencies, the amplitude is
close to the function generator amplitude and the two signals are in
phase.
13. Close the Function Generator and Oscilloscope windows.
End of Exercise 3-3
Introduction to NI ELVIS
3-10
ni.com
Lab 3
Exercise 3-4
AC Circuit Tools
The Gain/Phase Bode Plot of the RC Circuit
A Bode plot defines in a very real graphical format the frequency
characteristics of an AC circuit. Amplitude response is plotted as the circuit
gain measured in decibels as a function of log frequency. Phase response is
plotted as the phase difference between the input and output signals on a
linear scale as a function of log frequency.
Complete the following steps to build an RC circuit and measure the gain
and phase Bode plots of the circuit.
1. From the NI ELVISmx Instrument Launcher, select Bode icon.
With the Bode Analyzer, you can scan over a range of frequencies –
from a start frequency to a stop frequency in steps of Δf. You can also
set the amplitude of the test sine wave. The Bode Analyzer uses the
function generator SFP to generate the test waveform. You must connect
FGEN output sockets to your test circuit and to [AI 1+] and Ground
[AI 1–]. The output of the circuit under test goes to [AI 0+] and Ground.
You can find more information by clicking the HELP button on the
lower right corner of the Bode Analyzer window.
2. Rebuild the RC circuit on the NI ELVIS II protoboard, similar to the
following circuit and make the connections as described above.
Figure 3-6. RC components connections for Bode Measurements
© National Instruments Corporation
3-11
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
3. Verify that your circuit is connected as above. Turn on the protoboard
power and click on the [Run] button.
Figure 3-7. Bode Analyzer front panel measurements of an RC circuit
4. Click on the [ ] Cursors On box. You can step through your measured
data points and view the magnitude and phase at each frequency
measured.
5. Note the frequency where the signal amplitude has fallen to –3 dB. The
phase at this point should read approximately 45 degrees. This
frequency is called the lowpass cutoff point.
6. Both the oscilloscope and the Bode analyzer SFPs have a Log button.
When activated, the data presented on the graphs is written to a
spreadsheet file on your hard drive. You can now read this data for
further analysis with Excel, LabVIEW, NI DIAdem, or some other
analysis or plotting program.
7. Click on the [Log] button and save your data set.
Introduction to NI ELVIS
3-12
ni.com
Lab 3
AC Circuit Tools
View an example data set like the one below when you click the Log button
after a frequency scan.
End of Exercise 3-4
© National Instruments Corporation
3-13
Introduction to NI ELVIS
Lab 3
AC Circuit Tools
Multisim Challenge: Determine the Bode Plot of an RC Circuit
Verify that the Bode plot as predicted with NI Multisim is a good
representation of the real Bode plot found in Exercise 3-4.
1. Launch the Multisim program RC.
2. Double-click the Bode icon to bring up the Bode results window.
3. Run the program to get a feel for the shape of the Bode plots.
4. Ensure the scales are set to the same as in Exercise 3-4.
5. Double-click, in turn, the Resistor and the Capacitor and enter the
component values found in Exercise 3-1.
6. Run the program a second time.
Figure 3-8. Amplitude versus log Frequency of a Multisim RC Circuit
7. On completion, click on the [Save] button. This saves the Multisim Bode
plot data as an Excel file.
8. Overlay, in Excel, your data set from Multisim with the data set taken in
Exercise 3-4 for the real circuit on NI ELVIS II.
This exercise demonstrates how you can compare a circuit designed with
Multisim with the real circuit built on NI ELVIS II.
Introduction to NI ELVIS
3-14
ni.com
4
Op Amp Filters
Figure 4-1. Frequency Characteristics of a BandPass Filter
Adding a few capacitors and resistors to the basic operational amplifier
(op amp) circuit can yield many interesting analog circuits such as active
filters, integrators, and differentiators. Filters are used to pass specific
frequency bands, integrators are used in proportional control, and
differentiators are used in noise suppression and waveform generation
circuits.
Goal
This lab uses the NI ELVIS II suite of instruments to measure the
characteristics of lowpass, highpass, and bandpass filters. Simulate these
filters using Multisim with the measured component values. In the lab
challenge at the end of this chapter, Multisim is used to design a second
order active filter.
© National Instruments Corporation
4-1
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Required Soft Front Panels (SFPs)
•
Digital multimeter (DMM[Ω,
•
Function generator (FGEN)
•
Oscilloscope (Scope)
•
Impedance analyzer (Imped)
•
Bode analyzer (Bode)
])
Required Components
Introduction to NI ELVIS
•
10 kΩ resistor, R1, (brown, black, orange)
•
100 kΩ resistor, Rf , (brown, black, yellow)
•
1 μF capacitor, C1
•
0.01 μF capacitor, Cf
•
741 op amp
4-2
ni.com
Lab 4
Exercise 4-1
Op Amp Filters
Measuring the Circuit Component Values
Complete the following steps to measure the values of the individual
components:
1. Launch NI ELVIS II.
2. Select the DMM icon from the Instrument Measurement strip.
3. Select DMM[Ω] to measure the resistors.
4. Select DMM[
] to measure the capacitors.
5. Fill in the following information.
R1 ___________ Ω (10 kΩ nominal)
Rf ___________ Ω (100 kΩ nominal)
C1 ___________ μF (1 μf nominal)
Cf ___________ μF (0.01 μf nominal)
6. Close the DMM.
End of Exercise 4-1
© National Instruments Corporation
4-3
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Exercise 4-2
Frequency Response of the Basic Op Amp Circuit
Complete the following steps to build and perform measurements on an op
amp.
1. On the workstation protoboard, build a simple 741 inverting op amp
circuit with a gain of 10 as shown in Figure 4-2.
Figure 4-2. Schematic Diagram of a 741 Inverting Op Amp Circuit with a Gain of 10
The circuit looks like Figure 4-2 on the NI ELVIS II protoboard.
Figure 4-3. 741 Inverting Op Amp Circuit with a Gain of 10 on an NI ELVIS
protoboard
Introduction to NI ELVIS
4-4
ni.com
Lab 4
Op Amp Filters
Note The op amp uses both the +15 and –15 VDC power supplies. These are found on
the protoboard pin sockets labeled as “DC Power Supplies +15V, –15V & GROUND.”
2. Connect the function generator [FGEN] pin socket to the op amp
input V1.
3. Connect the [Ground] pin socket to pin 3 of the op amp.
4. Connect the op amp output voltage, Vout, to the oscilloscope BNC input
connector [CH1 & Ground].
5. From the NI ELVISmx Instrument Launcher, select the function
generator (FGEN) icon and the oscilloscope (Scope) icon.
Note By default, on the oscilloscope, the Channel 0 Settings Source is set to Scope Ch
0 and the Channel 1 Settings Source is set to Scope Ch 1. These are your op amp input
and output signals, respectively.
6. To view the signals, click on the enable boxes.
7. On the function generator panel, set the following parameters:
Waveform: Sine wave
Peak Amplitude: 0.2 pp
Frequency: 1000 Hz
DC Offset: 0.0 V
8. Check your circuit and then apply power to the NI ELVIS II protoboard.
9. Click on [Run] for both the FGEN and Scope SFPs.
10. Set the trigger to Edge, CH 0, Level 0.0 and the Time/Div to 1 ms.
11. Measure the amplitude of the op amp input (CH 0) and output (CH 1) on
the oscilloscope window.
© National Instruments Corporation
4-5
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Figure 4-4. Inverting Op Amp input and output signals
Note
The output signal is inverted as expected with respect to the input signal.
12. Calculate the voltage gain (the amplitude ratio, CH1/CH0).
13. Try a range of frequencies from 100 Hz to 10 kHz.
How do your measurements agree with the theoretical gain of (Rf/R1)?
Is the ratio still the same at 100 kHz?
14. Close the FGEN and Scope windows.
End of Exercise 4-2
Introduction to NI ELVIS
4-6
ni.com
Lab 4
Exercise 4-3
Op Amp Filters
Measuring the Op Amp Frequency Characteristic
The best way to study the AC characteristic response curve of an op amp is
to measure its Bode plot. The Bode plot is basically a plot of gain (dB) and
phase (degrees) as a function of log frequency. The transfer function for an
inverting op amp circuit is given by:
Vout = – (Rf/R1) V1
where Vout is the op amp output and V1 is the op amp input (the amplitude
of FGEN in your circuit). The gain is the quantity (Rf/R1). The minus sign
inverts the output signal with respect to the input signal. On a Bode plot, one
expects a straight line with a magnitude of 20 x log (gain). For a gain of 10,
the Bode amplitude should be 20 dB.
Complete the following step to measure the Bode plot of the Op Amp
circuit:
1. From the NI ELVISmx Instrument Launcher, select Bode Analyzer
(Bode) icon.
2. Connect the signals, input (V1) and output (Vout), to the analog input pins
as follows:
V1+
AI 0+
(from the FGEN output)
V1–
AI 0–
(from GROUND)
Vout+
AI 1+
(from the op amp output)
Vout–
AI 1–
(from GROUND)
3. On the Bode analyzer, set the scan parameters as follows:
Start: 5 (Hz)
Stop: 20000 (Hz)
Steps: 10 (per decade)
4. Apply power to the protoboard.
5. Click [Run] and observe the Bode plot for the inverting op amp circuit.
6. Take a close look at the phase response.
© National Instruments Corporation
4-7
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Figure 4-5. Bode Plot Measurements of an Inverting Op Amp
with a gain of 10
The gain (20 dB) is flat and independent of frequency until approximately
10,000 Hz, where it starts to roll off as shown in Figure 4-5. This Bode plot
is typical for a 741 op amp inverting circuit. At high frequencies, the
amplifier response depends on its internal circuitry as well as any external
components.
End of Exercise 4-3
Introduction to NI ELVIS
4-8
ni.com
Lab 4
Exercise 4-4
Op Amp Filters
Highpass Filter
A low frequency cutoff point, fL, for a simple RC series circuit is given by
the equation:
2πfL = 1/(RC)
where fL is measured in hertz. The low-frequency cutoff point is the
frequency where the gain (dB) has fallen by –3 dB. This (–3 dB) point
occurs when the impedance of the capacitor equals that of the resistor.
1. Add a 1 μF capacitor, Cl, in series with the 1 kΩ input resistor, R1, in the
op amp circuit as shown in Figure 4-6.
Figure 4-6. Highpass Op Amp Filter Circuit Design
The highpass op amp filter equation has a low-frequency cutoff point, fL,
where the gain has fallen to –3 dB. In other words, when Xc = R:
2πfL = 1/ (R1C1)
© National Instruments Corporation
4-9
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Figure 4-7 shows this circuit on an NI ELVIS protoboard.
Figure 4-7. Highpass Op Amp Filter on NI ELVIS protoboard
2. Run a second Bode plot using the same scan parameters as in
Exercise 4-3.
3. Observe that the low-frequency response is attenuated while the
high-frequency response is similar to the basic op amp Bode plot.
Figure 4-8. Bode Measurement of Highpass Op Amp circuit
Introduction to NI ELVIS
4-10
ni.com
Lab 4
Op Amp Filters
4. Use the cursor function to find the low-frequency cutoff point, that is,
the frequency at which the amplitude has fallen by –3 dB or the phase
change is 45 degrees.
5. Compare your results with the following theoretical predication:
2πfL = 1/ (R1C1)
End of Exercise 4-4
© National Instruments Corporation
4-11
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Exercise 4-5
Lowpass Filter
The high-frequency roll-off in the op amp circuit is due to the internal
capacitance of the 741 chip being in parallel with the feedback resistor, Rf.
If you add an external capacitor, Cf, in parallel with the feedback resistor,
Rf, you can reduce the upper frequency cutoff point. It turns out that you can
predict this new cutoff point from the following equation:
2πfU = 1/(Rf Cf)
Complete the following steps to perform an additional frequency
measurement on the op amp circuit:
1. Short the input capacitor (do not remove it because you will use it in
Exercise 4-6).
2. Add the feedback capacitor, Cf, (0.01 μf) in parallel with the 100 kΩ
feedback resistor.
Figure 4-9. Lowpass Op Amp Filter Circuit Design
Introduction to NI ELVIS
4-12
ni.com
Lab 4
Op Amp Filters
3. Run a third Bode plot using the same scan parameters.
Figure 4-10. Bode Measurement of Lowpass Op Amp circuit
Figure 4-10 shows that the high-frequency response is attenuated much
more than the basic op amp response.
4. Use the cursor function to find the high-frequency cutoff point, that is,
the frequency at which the amplitude has fallen by –3 dB or the phase
change is 45 degrees.
5. Compare your results with the following theoretical prediction:
2πfU = 1/ (Rf Cf)
Note Note the 90-degree phase change from the very low-frequency range to the
upper-frequency range. This is as expected for a single-pole RC filter stage.
End of Exercise 4-5
© National Instruments Corporation
4-13
Introduction to NI ELVIS
Lab 4
Op Amp Filters
Exercise 4-6
Bandpass Filter
If you allow both an input capacitor and a feedback capacitor in the op amp
circuit, the response curve has both a low-cutoff frequency, fL, and a
high-cutoff frequency, fU. The frequency range (fU – f L) is called the
bandwidth. For example, a good stereo amplifier has a bandwidth of at least
20,000 Hz.
Figure 4-11 shows a bandpass filter on an NI ELVIS II protoboard.
Figure 4-11. Bandpass Op Amp circuit on NI ELVIS protoboard
1. Remove the short on C1.
Figure 4-12. Bandpass Op Amp Filter Circuit Design
Introduction to NI ELVIS
4-14
ni.com
Lab 4
Op Amp Filters
2. Run a fourth Bode plot using the same scan parameters.
Figure 4-13. Bode Measurement of Bandpass Op Amp circuit
Using the cursors, draw a line between the –3 dB points. All frequencies
with an amplitude above this line are contained within the frequency pass
band.
How does this bandwidth measurement agree with the theoretical prediction
of (fU – fL)?
© National Instruments Corporation
4-15
Introduction to NI ELVIS
Lab 4
Op Amp Filters
For Further Study
The generalized op amp transfer curve is given by the following phasor
equation
Vout = –(Zf/Z1)Vin
where the impedance values for the four circuits are:
Table 4-1. Impedance Values for the Four Op Amp Circuits
Op Amp
Zf
Z1
Gain
Basic
Rf
R1
R f /R 1
Highpass
Rf
R1 + XC1
Rf /(R1 + XC1)
Lowpass
Rf + XCf
R1
(Rf + XCf)/R1
Bandpass
Rf + XCf
R1 + XC1
(Rf + XCf)/(R1 + XC1)
At any frequency, you can use the impedance analyzer (Imped) to measure
the impedances Zf and Z1. A LabVIEW program can calculate the ratio of
two complex numbers. The magnitude of the ratio |Zf /Z1| is the gain.
You could also use the impedance analyzer to find the frequencies where R1 equals
XC1 and Rf equals XCf to verify that the lower- and upper-frequency cutoff points from
the Bode plot are equal to these frequencies.
Note
Introduction to NI ELVIS
4-16
ni.com
Lab 4
Op Amp Filters
Multisim Challenge: Design a Second-Order Lowpass Filter
In Exercise 4-5, you built a lowpass filter with a single capacitor in the
feedback loop. At high frequencies beyond the cutoff point, the gain falls off
linearly with a slope of 6 dB/octave. Some applications require a sharper
roll-off. You can accomplish this using a filter design with two or more
capacitors in the filter design.
1. Design a second-order lowpass filter with a –3 dB cutoff point, fc,
at 1000 Hz.
Figure 4-14. Multisim solution of a Second-order Op Amp Filter
This filter has two cutoff points
fc1 = (R1||R2)/(2πC1) and fc2 = (2πR3C2)–1
In the special case when fc1 = fc2 = fc, the gain expression for this filter
becomes
–R3 ⁄ ( R1 + R2 )
G = -----------------------------------2
1 + (f ⁄ fc)
2. Pick resistors and capacitors to satisfy the special case requirement that
fc1 = fc2 = 1000 Hz
© National Instruments Corporation
4-17
Introduction to NI ELVIS
Lab 4
Op Amp Filters
3. Launch the Multisim program Two Pole Active Filter.
4. Double-click on the Bode analyzer icon to open a results window.
5. Run this program and view the Bode plot.
Figure 4-15. Frequency Response of a Second-order Op Amp Filter
6. From the graph of the gain, estimate the slope of the roll-off curve
(should be 40 dB/decade).
7. Modify this program with your component values.
8. Compare the slope of the roll-off curve with the previous result in
Exercise 4-5 for a single-pole lowpass filter.
9. If you have the time and components, try building a real two-pole circuit
on the NI ELVIS II protoboard.
How well does the Bode plot of the theoretical design match your real
circuit? Refer to the Lab 3 Multisim Challenge to recall how to overlay in
Excel a theoretical design curve with a measured real curve.
Introduction to NI ELVIS
4-18
ni.com
5
Digital I/O
Digital electronics is the heart and soul of modern computers. The ability to
set and read digital lines is essential to digital circuit diagnostics.
Figure 5-1. Four bit Digital Counter Circuit on NI ELVIS II Protoboard
Goal
This lab focuses on NI ELVIS II digital tools, such as a digital clock, digital
counter, and a logic state analyzer, to study digital circuits.
Required Soft Front Panels (SFPs)
•
Digital writer (DigOut)
•
Digital reader (DigIn)
•
FGEN (TTL outputs)
•
Oscilloscope (Scope)
© National Instruments Corporation
5-1
Introduction to NI ELVIS
Lab 5
Digital I/O
Required Components
Introduction to NI ELVIS
•
10 kΩ resistor, RA, (brown, black, orange)
•
100 kΩ resistor, RB, (brown, black, yellow)
•
0.1 μF capacitor, C
•
1 μF capacitor, C
•
555 timer chip
•
7493 4-bit binary counter
5-2
ni.com
Lab 5
Exercise 5-1
Digital I/O
Visualizing Digital Byte Patterns
The NI ELVIS II protoboard has a bank of eight green LEDs with input pin
sockets labeled LED <0..7>. You can use them as visual indicators of digital
logic states (On = HI and Off = LO).
Complete the following steps to output a digital pattern using the Digital
Writer:
1. Wire the LEDs <0..7> to the corresponding socket pins labeled
DIO <0..7>.
For example, connect DIO 0 alias line 0 to the pin socket LED <0>. Only
one lead is required because the grounds are connected internally within
NI ELVIS II.
Note
The digital I/O lines are located on the right side of the protoboard.
2. Launch the NI ELVISmx Instrument Launcher.
3. Select the Digital Writer (DigOut) icon.
A new digital logic diagnostic window opens, so you can set/reset any
of the digital lines to a HI or LO state. By default, the digital I/O lines
<0..7> are selected from the three 8-bit ports in the Lines to Write box.
Figure 5-2. Dig Out front panel window
© National Instruments Corporation
5-3
Introduction to NI ELVIS
Lab 5
Digital I/O
The digital output lines are labeled 0 to 7 reading right to left in the
Manual Pattern box. You can set/reset (HI/LO) any bit by clicking on the
top or bottom portion of the virtual switch. Collectively, these 8 bits
constitute a byte that can be read in a binary, octal, hexadecimal, or
decimal format, or in an SI notation in the display box above the
switches. By clicking on the grayed-out portion, you can set the radix
(format) of this indicator.
Figure 5-3. LabVIEW indicators for Binary, Hexadecimal or Decimal Displays
4. After you have set a digital pattern, turn on the power to the protoboard
and click Run (green arrow) to send the pattern to the parallel output
digital I/O lines <0..7>, which in turn are passed on to the green LEDs.
You can set the Generation Mode to output a single pattern or to continuously
output the pattern. In continuous operation, the hardware is updated continuously with
the current pattern.
Note
The set pattern is echoed on the line states (blue LED indicators) of the
Bus State on the SFP. Also, with the Action buttons of the SFP, you can
toggle, rotate, or shift the bit pattern right or left.
5. Press the Stop button (red box) to cease updating the port.
In testing a digital circuit, you can select from several commonly used
patterns for diagnostic checks.
6. Click the Pattern selector on the SFP to view the options available.
Manual
Load any 8-bit pattern
Ramp (0 – 255)
Computer Instruction INC
Alternating 1/0s
Computer Instruction INVERT
Walking 1s
Computer Instruction SHIFT LEFT LOGIC
7. Try to output each bit pattern.
8. Close the Digital Writer window.
End of Exercise 5-1
Introduction to NI ELVIS
5-4
ni.com
Lab 5
Exercise 5-2
Digital I/O
555 Digital Clock Circuit
You can configure a 555 timer chip, together with resistors RA, RB,
and capacitor C (1 μF), to act as a digital clock source.
Figure 5-4. 555 Digital Clock Circuit
Complete the following steps to build and perform measurements on a 555
digital clock circuit:
1. Using the DMM[Ω] and DMM[
complete the following table.
], measure the component values and
RA ______________________ Ω (nominal 10 kΩ)
RB ______________________ Ω (nominal 100 kΩ)
C ______________________ μF (nominal 1 μΩ)
© National Instruments Corporation
5-5
Introduction to NI ELVIS
Lab 5
Digital I/O
2. Build the clock circuit on the protoboard as shown below.
Figure 5-5. 555 Timer chip Configured as a Digital Oscillator
Power (+5 V) goes to pins 8 and 4, and GROUND goes to pin 1. The
timing chain of RA, RB, and C straddles the power supply. It has a
connection between the resistors going to pin 7 and a connection
between RB and C going to pins 2 and 6.
3. Wire the 555 output pin 3 to one of the port pin sockets, DIO <0>.
4. From the NI ELVISmx Instrument Launcher, select the Digital Reader
(DigIn) icon.
By default the second 8-bit port is set to input (Lines to Read 8-15).
5. Configure Lines to Read to (0-7), enable power to the protoboard, and
click Run.
Introduction to NI ELVIS
5-6
ni.com
Lab 5
Digital I/O
Figure 5-6. Digital Writer reading bit 0, line DIO <0>
The Digital Reader allows the current state of a parallel input port to be
read on demand (single shot) or continuously. You should see the state of
line 0 flashing. If not, click on the Stop button and use the DMM[V] to
check voltage levels on the 555 pins (stop the Digital Reader first).
With the clock circuit running, you can now make some useful digital circuit
measurements.
The 555 timer oscillator circuit has a Period T of
T = 0.695 (RA + 2 RB) C (seconds)
The 555 timer oscillator frequency is related to the period by
F = 1/T (Hz)
The 555 timer oscillator circuit has an On time of
T = 0.695 (RA + RB) C (seconds)
The 555 timer oscillator circuit has a Duty Cycle (On time/period) of
DC = (RA+ RB) / (RA + 2 RB)
6. Close all SFPs and launch the Oscilloscope (Scope) icon.
© National Instruments Corporation
5-7
Introduction to NI ELVIS
Lab 5
Digital I/O
7. Connect the front panel BNC CH 0 input leads to pin 3 of the 555 timer
chip and any ground. Click Run. You should now be observing the
digital waveform on Channel 0 of the oscilloscope.
8. Select Trigger Type: Edge, Source: Chan 0 Source and Level (V) to 1.0.
Your signal should be a TTL signal with an amplitude of 4 V or more,
and the signal should be steady.
9. Observe the frequency in the scope window for CH 0.
10. Click on the Cursors On box and note that C1 and C2 are set to CH 0.
11. By clicking and dragging the cursors, measure the period, the on time,
and the duty cycle. Calculate the frequency from the period
measurement.
12. Fill in the following table:
T = __________________ (seconds)
Ton = __________________ (seconds)
DC = __________________
F = __________________ (Hz)
13. Compare your measurements with the previous theoretical predictions.
14. Close any SFPs.
End of Exercise 5-2
Introduction to NI ELVIS
5-8
ni.com
Lab 5
Exercise 5-3
Digital I/O
Building a 4-Bit Digital Counter
Complete the following steps to build a 4-bit digital counter.
1. Insert a 7493 four-bit binary ripple counter into the protoboard next to
the 555 digital clock circuit. The 7493 chip contains a divide-by-two and
a divide-by-eight counter.
2. Configure the chip as a divide-by-16 counter by connecting a jumper
wire from pin 12 (Q1) to pin 1, Clock 2 (C2), on the 7493 chip, as shown
in Figure 5-7.
Figure 5-7. Schematic Diagram 4-bit Binary Counter
3. On the 7493 binary counter chip, connect +5 V power to pin 5 and
ground to pin 10.
4. Ensure that 0set inputs pins 2 and 3 are grounded.
5. Connect the outputs Q1, Q2, Q4, and Q8 to the LED and digital input
ports of the NI ELVIS II protoboard using the following mapping
scheme:
© National Instruments Corporation
Q1 pin 12
to
DIO<0> and LED<0>
Q2 pin 9
to
DIO<1> and LED<1>
Q4 pin 8
to
DIO<2> and LED<2>
Q8 pin 11
to
DIO<3> and LED<3>
555 pin 3
to
DIO<7> and LED<7>
5-9
Introduction to NI ELVIS
Lab 5
Digital I/O
6. Connect the 555 digital clock output (pin 3) to the 7493 Clock 1 (C1)
input (pin 14). For this exercise C = 0.1 μF in the circuit above.
7. Power the protoboard and watch the binary counts accumulate on the
LEDs.
8. Launch the NI ELVISmx Digital Reader (DigIN) icon. Monitor the
binary states on the computer screen, and, at the same time, see the states
on the green LEDs on the protoboard.
9. Close the NI ELVISmx Instrument Launcher.
End of Exercise 5-3
Introduction to NI ELVIS
5-10
ni.com
Lab 5
Exercise 5-4
Digital I/O
LabVIEW Logic State Analyzer
The previous exercises have covered only the state of digital outputs at one
point in time. This exercise shows how you can form a timing diagram by
stringing sequential states together sampled uniformly in time. Plotting
several digital lines together on the same graph generates a digital timing
diagram as illustrated in Figure 5-8.
A binary counter has a unique timing diagram where the falling edge of the
previous bit causes the next bit to toggle.
Figure 5-8. Timing Diagram of a four bit Binary Counter
Using the LabVIEW APIs for the digital I/O, you can build a simple 4-bit
logic state analyzer. The Digital I/O palette is located in Functions»
Programming»Measurement I/O»NI ELVISmx»NI ELVISmx Digital
Reader.
© National Instruments Corporation
5-11
Introduction to NI ELVIS
Lab 5
Digital I/O
Figure 5-9. Location of NI ELVISmx Digital Reader
Launch LabVIEW 8.5 and then open Binary CounterMx.vi from the
Hands-On-NI ELVIS II library folder.
On the diagram panel, the NI ELVISmx Digital Reader has been initialized
to use lines 0 to 7 (blue ring constant) for input from the protoboard.
Note In this example, the NI ELVIS USB communication port is Device 3. Depending
on how many DAQ cards you have in you computer, it could be Device 1, 2, or 3. With
only the NI ELVIS USB port available, it would be Device 1.
Introduction to NI ELVIS
5-12
ni.com
Lab 5
Digital I/O
Figure 5-10. Block Diagram for the program Binary CounterMx.vi
The 4-bit logic state analyzer samples NI ELVIS lines <0..7> and presents
the line states as a Boolean array (thick green line). The index arrays extract
bits <0..3> (Q1, Q2, Q3, Q4) to the respective trace indicators and then into
a numeric value (0 or 1) for bundling with the other traces for the timing
diagram plot. With the many LabVIEW chart format options, you can
present the data in a timing diagram format.
A copy of the data also goes to the AND gate, where bits <4..7> are set to
zero. The resultant data is converted to a numeric (0 to 15) and presented on
the front panel.
End of Exercise 5-4
© National Instruments Corporation
5-13
Introduction to NI ELVIS
Lab 5
Digital I/O
Multisim Challenge: Design an 8-bit Digital Counter Circuit
Design an 8-bit decimal counter with two 7-segment displays. Use a 555
timer IC to generate the clock signal.
1. Launch Multisim and open 555 Timer Binary Counter from the
NI ELVIS II program library. In this program, is simulated the same
circuit elements used in Exercise 5-3, Building a 4-Bit Digital Counter.
Figure 5-11. Multisim schematic of the visualization of a 4-bit Binary Counter
2. Double-click on the scope icon XSC2. A 4-channel oscilloscope display
appears.
3. Run this simulation by clicking on the green arrow. Observe that the
4-channel display is similar to the real circuit built on an NI ELVIS II
protoboard. Stop the simulation by clicking on the red square.
4. Open a second program called Decimal Counter. This program replaces
the binary counter with a decimal counter (7490N), adds a 7-segment
driver (7447N) IC, and adds a 7-segment display. Note that the current
limiting resistors for the 7-segment LEDs are found in the resistor pack.
Introduction to NI ELVIS
5-14
ni.com
Lab 5
Digital I/O
5. Run this program to see a single-digit counter with a 7-segment display.
Figure 5-12. Decimal Reading of a 4-bit Binary Counter
6. Stop the simulation and add a second 7490N, a 7448N, a resistor pack
330 Ω, and a 7-segment display to the Multisim circuit. You can
implement this with a simple copy and paste of the components already
on the circuit diagram. Alternatively, you can find a list of components
by browsing to Place»Component.
7. Connect the output QD of the first counter chip (7490N) to the input
INA of the second counter chip (7448N). Together these chips form a
two-digit counter counting from 00 to 99.
8. Connect the other virtual wires to the added chips to build a two-digit
decimal counter.
9. Run the simulation.
© National Instruments Corporation
5-15
Introduction to NI ELVIS
6
Magnetic Field Sensors
+
–
X
X
X
X
X
X
B in
X
X
X
X
– –q
X
X
Vd
X
X
X
X
X
X
–––––––––––––
F
X
X
X
X
X
X
I
I
X
X
X
X
X
X
X
X
X
X
X
X
+++++++++++++
I
Figure 6-1. How the Hall Effect Works!
In 1879, Erwin Hall discovered that when a current flows through a block of
semiconductor material in the presence of a magnetic field, a voltage is
generated across it. He found that this voltage, now named after him, is
proportional to the vector cross product of the current flowing through the
sensor and the magnetic field. The proportionality constant γ is a property
of the Hall effect sensor.
VH = γ I × B
This means that you can use a Hall probe to measure current, magnetic field,
or the angle between the sensor axis and an external field direction. Today,
integrated Hall effect sensors have an internal constant current source and
an operational amplifier (op amp) to buffer the output signal. These sensors
are inexpensive, robust, and can be interfaced to both analog and digital
circuits.
Goal
This lab focuses on using NI ELVIS tools to study the properties of Hall
effect sensors. During the lab, build a simple gaussmeter and a digital
counter interface using a linear Hall effect sensor and a Hall effect switch,
respectively. Complete the Multisim challenge to learn how to design a
tachometer circuit using a Hall effect switch as the sensor.
© National Instruments Corporation
6-1
Introduction to NI ELVIS
Lab 6
Magnetic Field Sensors
Required Soft Front Panels
•
DMM[V]
•
Oscilloscope (Scope)
•
LabVIEW VIs for the digital counter
Required Components
•
Small magnet
•
Linear magnetic field sensor: Allegro A3240UA or equivalent
•
Hall effect switch: Allegro A3212UA or equivalent
Contact Allegro at www.allegro.com and request a free sample of these
sensors.
Introduction to NI ELVIS
6-2
ni.com
Lab 6
Exercise 6-1
Magnetic Field Sensors
Testing the Analog Magnetic Field Sensor with
NI ELVIS Tools
The Allegro devices have only three terminals, +Vcc power, ground, and the
Hall output.
1. Insert a linear Hall device (A3240) into the protoboard.
2. Connect the power +5 V pin socket to +Vcc (pin 1).
3. Connect the GROUND on the protoboard to the Ground (pin 2) of the
Hall chip.
4. Connect the DMM [VΩ
COM lead to Ground.
] lead to the Hall Voltage (pin 3) and the
Figure 6-2. Pin configuration for integrated Hall sensors
5. Launch the NI ELVISmx Instrument Launcher and select DMM[V].
6. Bring a small magnet (field intensity of several hundred gauss) in close
proximity to the Hall sensor face. In the absence of a magnetic field, the
sensor reads one-half of +Vcc or about +2.5 V. As the magnet is moved
closer to the sensor, the Hall voltage either rises greater than 2.5 V or
falls to less than 2.5 V, depending on the magnet polarity. The south end
of the magnet causes a rise and the north end causes a fall. The sensor
saturates near +5 or 0 V in a field in excess of ±500 gauss. The Hall
voltage is quite nonlinear when measured with respect to the distance
between the sensor and the magnet face.
7. To observe this relationship, make distance and voltage measurements
and plot your observations. The distance between adjacent pin socket
holes is 1/10 of an inch. The protoboard pin sockets make a good ruler.
8. Place the magnet on the protoboard directly in front of the sensor and
measure the Hall voltage in 0.1 or 0.05 in. increments over a distance of
about 1 inch.
© National Instruments Corporation
6-3
Introduction to NI ELVIS
Lab 6
Magnetic Field Sensors
9. Record each reading in a table of Hall voltage and distance.
10. Plot the Hall voltage versus distance using data from your table.
Figure 6-3. Hall Effect Voltage versus Distance
The plot should be similar to the graph in Figure 6-3. The response is
nonlinear, which demonstrates the importance of knowing the operating
distance between the sensor and the magnet.
End of Exercise 6-1
Introduction to NI ELVIS
6-4
ni.com
Lab 6
Exercise 6-2
Magnetic Field Sensors
Hysteresis Characteristic of a Magnetic Field
Switch
Complete the following steps to perform measurements on the Hall effect
switch and determine its hysteresis characteristics.
1. Replace the linear sensor (A3240) with the Hall effect switch A3212.
The circuit connections are the same as those of the linear circuit.
2. Repeat the measurements for Hall voltage versus distance for both
increasing and decreasing distances.
Note Some Hall effect switches are Open Collector and require a 1 kΩ pull-up resistor
to be connected between the Hall effect switch output and the power supply line.
3. Plot the data for both moving away from and moving toward the sensor
on the same set of axes. It should look similar to Figure 6-4.
Figure 6-4. Hall Effect Switch Voltage versus Distance
The Hall switch is a digital sensor whose output is either HI (~ +5 V) or LO
(0.8 V). The output is always HI for B greater than a critical field Bmax, and
LOW for any field less than a critical field Bmin. A graph of Hall voltage
versus distance from the sensor demonstrates hysteresis between
approaching the sensor and moving away from the sensor. The difference
between the two limits:
h = Bmax – Bmin
is a measure of the noise immunity of the sensor.
For example, the Hall switch requires a field B>Bmax to switch from LO to
HI. Once in the HI state, the Hall switch requires a field B<Bmin to switch
© National Instruments Corporation
6-5
Introduction to NI ELVIS
Lab 6
Magnetic Field Sensors
from HI to LO. In your earlier test, these critical fields, Bmax and Bmin,
are translated into a distance DLO to HI (3/10 of an inch) and LHI to
LO (4/10 of an inch), respectively.
4.
Close the digital multimeter.
End of Exercise 6-2
Introduction to NI ELVIS
6-6
ni.com
Lab 6
Exercise 6-3
Magnetic Field Sensors
Counting Pulses with a Magnetic Switch Sensor
Complete the following steps to perform a pulse count measurement using
a Hall effect switch:
1. Place the magnet far enough away from the sensor so it is in the
LO state.
2. Move the South end of a magnet to approach the sensor. The measured
magnetic field eventually exceeds Bmax and the logic state toggles HI.
Then, as the magnet is pulled away and the magnetic field becomes less
than Bmin, the logic state switches back to the LO state. The entire
sequence, LO-HI-LO, generates a positive pulse. Repeating this
operation numerous times generates a train of positive pulses.
3. Select oscilloscope (Scope) from the NI ELVISmx Instrument
Launcher.
4. Connect the BNC connector (CH0) to the output signal from the Hall
effect switch (pins 3 and 2).
5. On the oscilloscope panel, select
Source: Scope CH 0
Trigger: Type (Edge), Source (Chan 0)
Level (V): ~ 1.0 V
6. Observe the Hall voltage on channel 0 as you rapidly move the magnet
toward and away from the sensor. With the oscilloscope trace on a
longtime base (100 ms/div), you can observe the pulse train.
End of Exercise 6-3
© National Instruments Corporation
6-7
Introduction to NI ELVIS
Lab 6
Magnetic Field Sensors
Exercise 6-4
Building a Tachometer
An angle shaft encoder, a tachometer, and a dwell sensor all use magnetic
switches to generate pulses. Counting pulses accumulates events. Counting
pulses within a select time interval measures frequency.
Figure 6-5. Homemade Tachometer Apparatus
Complete the following steps to build a simple tachometer using a DC
motor, a CD disk, a small magnet, and a Hall effect switch.
1. Affix an old CD to the rotor of a DC motor. Near the perimeter of the
CD, glue a small rare earth magnet to the upper surface. Place your Hall
effect switch below the CD so that the magnet passes over the switch as
it rotates.
2. Connect the DC motor to the output of the variable power supply
(Supply + and Ground) pin sockets on the protoboard.
3. Launch the variable power supply VPS from the NI ELVISmx
Instrument Launcher. Click on the box Supply + Manual. It is easier to
control the DC motor speed with the real VPS knob on the right side of
the NI ELVIS II workstation than with the virtual voltage knob on the
VPS front panel.
4. Apply a moderate voltage (1 to 2 V) to your motor.
5. Using the same oscilloscope setting as in Exercise 6-3, observe the pulse
stream as the CD spins.
6. Record the pulse frequency from the Scope panel at the bottom of the
oscilloscope screen window. This is the tachometer reading.
Introduction to NI ELVIS
6-8
ni.com
Lab 6
Magnetic Field Sensors
7. (Optional) Record a number of tachometer readings at a variety of motor
voltages. A plot of the tachometer measurements versus motor drive
voltage produces a calibration curve for your motor.
8. Close all SFPs and remove the voltage probe.
End of Exercise 6-4
© National Instruments Corporation
6-9
Introduction to NI ELVIS
Lab 6
Magnetic Field Sensors
Exercise 6-5
Automatic Counting Using a LabVIEW Program
Complete the following steps to build an automatic pulse counter driven by
LabVIEW.
1. Connect the output of the Hall effect switch to the NI ELVIS II counter
inputs:
Hall Output (pin 3) Æ PFI 8/CTRO_SOURCE
Hall Ground (pin 1) Æ GROUND
Figure 6-6. Counting Apparatus on the NI ELVIS II Protoboard
2. Launch LabVIEW.
3. From the Hands-On NI ELVIS II library folder, select Hall
CounterMx.vi.
With this simple program, you can accumulate counts as a magnetic
field that is passed in and out from the Hall effect switch or over the Hall
effect switch using the tachometer circuit. Dividing the accumulated
counts by the elapsed (count) time generates the average time per count
or the frequency.
Introduction to NI ELVIS
6-10
ni.com
Lab 6
Magnetic Field Sensors
Figure 6-7. Block Diagram for the program CounterMx.vi
NI ELVIS II has access to the NI data acquisition (DAQ) device
counters. This program uses the DAQ Assistant to set up the DAQ for
counting pulses on input pin (CTRO_Source). The difference between
the two [Tick Count] functions measures the counting interval.
End of Exercise 6-5
© National Instruments Corporation
6-11
Introduction to NI ELVIS
Lab 6
Magnetic Field Sensors
Multisim Challenge: Design a Tachometer Circuit
Open in Multisim a program called HallEffectSensors found at Open
Samples»Educational Sample Circuits»Miscellaneous.
Study the circuit carefully. You can use the A and B keys to increase the
magnetic field or speed parameters, respectively, for the two circuits. To
decrease these parameters, use <Shift-A> or <Shift-B>. Double-click the
oscilloscope icon XSC2 to view the oscilloscope traces.
Figure 6-8. Multisim example program HallEffectSensors.ms10
Using the program in Figure 6-8 as a guide, design your own tachometer
program. Input is the rate of rotation, and the output of the Hall effect switch
is counts. Accumulating counts over a fixed period of time (about 1 second)
yields counts/second or the frequency of counts.
Introduction to NI ELVIS
6-12
ni.com
7
LEDs to the Rescue!
Figure 7-1. Stoplights with LabVIEW Indicators
Have you ever sat in your car stopped at a city intersection waiting for the
stoplight to change and wondering how long the red light will last?
Sometimes it seems like forever. Using a stop watch at a simple two-way
intersection, you will find red lasts for 30 seconds, green lasts for 25
seconds, and yellow lasts for 5 seconds. In some states, these times may be
two, three, or four times as long, but the ratios are always the same.
A property of an electronic diode is that in one direction current flows easily
(forward biased), while in the other direction current flow is blocked. Light
emitting diodes (LEDs) have the same property, but in the forward-biased
region light is given off and in the reverse-biased region the LED is dark.
Today, LEDs are used as the primary light elements in stoplights, so
understanding how they operate is useful.
Goal
This lab focuses on using NI ELVIS II to illuminate diode properties,
diode test methods, bit patterns for a two-way stoplight intersection, and
the use of NI ELVIS II APIs in a LabVIEW program to run the stoplights
automatically. A Multisim challenge encourages the reader to design a
two-way stoplight intersection using discrete transistor-transistor logic
(TTL) ICs.
© National Instruments Corporation
7-1
Introduction to NI ELVIS
Lab 7
LEDs to the Rescue!
Required Soft Front Panels (SFPs)
•
Digital diode tester (DMM[
])
•
Two-wire current-voltage analyzer (2-Wire)
•
Digital writer (DigOut)
Required Components
Introduction to NI ELVIS
•
Silicon diode
•
Six LEDs (2 red, 2 yellow, and 2 green)
•
Six 220 Ω resistors
7-2
ni.com
Lab 7
Exercise 7-1
LEDs to the Rescue!
Testing Diodes and Determining Their Polarity
A semiconductor junction diode is a polar device with a band on one end
which indicates the cathode. The other end is called the anode. While there
are many ways to indicate this polarity in the packaging of a diode, one thing
is always the same—a positive voltage applied to the anode results in the
diode being forward-biased so that current can flow. You can use NI ELVIS
II to determine the diode polarity.
Complete the following steps to set up NI ELVIS II for diode and polarity
tests:
1. Launch the NI ELVISmx Instrument Launcher and select DMM.
2. Click on the diode test button [
]. Click on Run.
3. Connect one of the LEDs to the workstation banana sockets DMM
[VΩ
] and [COM].
When you apply a positive voltage to the cathode, the diode blocks the
current. The display, which reads the same value as it does when no diode is
connected (open circuit), shows the word OPEN (see Figure 7-2).
Figure 7-2. Reverse-biased Diode Reading
© National Instruments Corporation
7-3
Introduction to NI ELVIS
Lab 7
LEDs to the Rescue!
When you apply the positive voltage to the anode, the diode allows current
to flow. The display reads a voltage level less than the open circuit value
(1.250 V) and shows the word GOOD (see Figure 7-3).
Figure 7-3. Forward-biased Diode Reading
For example, a silicon rectifying diode in the forward-bias direction
displays a voltage ~0.6 V and shows the word GOOD. In the reverse-bias
direction, the display reads the open circuit value (~1.250 V) and shows the
word OPEN.
Note You can use this simple test to determine the polarity of a colored LED. Connect
a red LED to your test leads. In one direction, you see light (forward-biased) and, in the
other direction, no light (reverse-biased). The DMM display does not change, but there
is enough current to produce some light. Check closely the LED is dimly lit and may be
difficult to see with bright lights in the room. When the LED is lit, the red lead connection
is the anode.
The way this works is that the display shows the voltage required to generate
a small current flow of about 1 mA. In the forward-bias region, this voltage
level is usually smaller than the open circuit voltage. In the reverse-bias
direction, no current flows and the tester displays the open circuit voltage,
about 1.250 V. For LEDs, the voltage threshold is often larger than the open
circuit voltage. The 1 mA test is not sufficient to discern the forward-bias
test (GOOD), but it is enough to generate a low light intensity.
End of Exercise 7-1
Introduction to NI ELVIS
7-4
ni.com
Lab 7
Exercise 7-2
LEDs to the Rescue!
Characteristic Curve of a Diode
The characteristic curve of a diode, that is, a plot of the current flowing
through the device as a function of the voltage across the diode, best
displays the diode’s electronic properties.
Complete the following steps to display the characteristic curve of a diode:
1. Place a silicon diode across the DMM/Impedance Analyzer pin sockets
DUT+ and DUT–. The anode diode pin goes to the + input. For
reference, the flat side of the LED is the cathode.
2. Launch the NI ELVISmx Instrument Launcher and select the Two-Wire
Current-Voltage Analyzer (2-Wire). A new SFP opens so you can
display the characteristic (I-V) curve for the device under test. This SFP
applies a test voltage to the diode from a starting voltage level to an
ending level in incremental voltage steps, all of which you can select.
3. For a silicon diode, set the following parameters:
Start
–2 V
Stop
+2.0 V
Increment
0.05 V
4. Set the maximum current in either direction to ensure the diode does not
operate in a current region where damage may occur. Check the diode
specifications.
5. Click on Run and see the I-V curve appear.
© National Instruments Corporation
7-5
Introduction to NI ELVIS
Lab 7
LEDs to the Rescue!
Figure 7-4. Current-VoltageCharacteristic Curve of a Silicon Diode
In the reverse-bias direction, the current should be very small (μA) and
negative. In the forward-bias direction, you should see that above a
threshold voltage, the current rises exponentially to the maximum
current limit.
6. Change the Display buttons [Linear/Log] to see the curve plotted on a
different scale.
7. Try the Cursor operation. It gives the (I,V) coordinate values as you
move the cursor along the trace.
The threshold voltage is related to the semiconductor material of the diode.
For silicon diodes, the threshold voltage is about 0.6 V, and for germanium
diodes, it is about 0.3 V. One way to estimate the threshold voltage is to fit
a tangent line in the forward-bias region near the maximum current (refer to
Figure 7-5). The point where the tangent intersects the voltage axis defines
the threshold voltage. Observe the (I,V) characteristic curve for a light
emitting diode. For this LED, the threshold voltage given by the intersection
of the tangent with the voltage axis is about 1.56 V.
Introduction to NI ELVIS
7-6
ni.com
Lab 7
LEDs to the Rescue!
Figure 7-5. Current-Voltage Curve of a Red LED with Tangent Line
8. Using the Two-Wire Current-Voltage Analyzer, determine the
threshold voltage for a red, yellow, and green LED, and complete the
chart below.
Red LED ____________ V
Yellow LED ____________ V
Green LED ____________ V
Do you see a trend?
End of Exercise 7-2
© National Instruments Corporation
7-7
Introduction to NI ELVIS
Lab 7
LEDs to the Rescue!
Exercise 7-3
Manual Testing and Control of a Two-Way
Stoplight Intersection
Complete the following steps to build and manually test and control a
two-way stoplight intersection.
1. Install two each of red, yellow, and green LEDs on the NI ELVIS II
protoboard, positioned as a two-way stoplight intersection.
Figure 7-6. LED layout of a Two-way Stoplight Intersection
Each LED is controlled by one binary bit on one of the 8-bit parallel
ports on the protoboard. Use digital I/O bit sockets DIO <0..7>.
2. Connect the pin socket DIO <0> to the anode of the red LED in the
North-South (Up-Down) direction.
3. Connect the other end of the LED through a 220 Ω resistor to digital
ground (not pictured).
Note
Introduction to NI ELVIS
The resistor is used to limit the current through the LED.
7-8
ni.com
Lab 7
LEDs to the Rescue!
4. Connect the remaining colored LEDs in a similar fashion.
Here is the complete mapping scheme.
DIO <0> Red
N-S direction
DIO <4> Red
E-W direction
DIO <1> Yellow
N-S direction
DIO <5> Yellow
E-W direction
DIO <2> Green
N-S direction
DIO <6> Green
E-W direction
5. From the NI ELVISmx Instrument Launcher, select Digital Writer
(DigOut).
6. Using the vertical slide switches, select any 8-bit pattern and output that
pattern to the NI ELVIS II digital lines. Recall that Bit 0 is connected to
the pin socket on the protoboard labeled DIO <0>.
7. Set the Generation Mode to (Run Continuous) and Pattern to
(Manual), as shown in Figure 7-7.
8. To activate the port, click on the Run button.
Figure 7-7. Digital Writer for Testing LEDs
When all switches (Bits 0-2 and 4-6) are HI, all the LEDs should be lit.
When all these switches are LO, all the LEDs should be off.
You can now use these switches to find out which 8-bit codes are necessary
to control the various cycles of a stoplight intersection.
© National Instruments Corporation
7-9
Introduction to NI ELVIS
Lab 7
LEDs to the Rescue!
Here are some clues for an intersection. The basic operation of a stoplight is
based on a 60-second time interval with 30 seconds for red, followed by
25 seconds for green, followed by 5 seconds for yellow. For example, in a
two-way intersection, the yellow light in the North-South direction is on
while the red light in the East-West direction is on. This modifies the
30-second red timing interval to two timing intervals: a 25-second cycle
followed by a 5-second cycle. There are four timing periods (T1, T2, T3,
and T4) for two-way stoplight intersection operation.
9. Study the following chart to see how a two-way stoplight intersection
works.
Direction
N-S
E-W
Lights
Bit#
RYG
012
RYG
456
8-Bit Code Decimal Value
T1
25 s
001
100
00010100
20
T2
5s
010
100
_________
_________
T3
25 s
100
001
_________
_________
T4
5s
100
010
_________
_________
10. Use the Digital Writer to determine which 8-bit codes need to be written
to the digital port to control the stoplights in each of the four timing
intervals.
For example, timing period 1 requires the code 00101000. Computers
read the bits in the reverse order (least significant bit on the right). This
code then becomes 00010100. In the white box above the Manual
Pattern Line switches display, you can read the radix of the switch
pattern in binary {00010100}, decimal {20}, or hexadecimal {14}.
11. Click on the black ^ to left of the white display box to change the radix.
You can use this feature to determine the numeric codes for the other
timing intervals T2, T3, and T4. If you output the 8-bit code for each of
the timing intervals in sequence, you can manually operate the
stoplights.
Note You can also change the radix in the Line States display by clicking on the white x
beside the Numeric Value display.
Repeating this four-cycle sequence automates your intersection.
End of Exercise 7-3
Introduction to NI ELVIS
7-10
ni.com
Lab 7
Exercise 7-4
LEDs to the Rescue!
Automatic Operation of the Two-Way Stoplight
Intersection
Complete the following steps to automate the timing cycle on the stoplight
circuit.
1. Close NI ELVIS II SFPs and launch LabVIEW 8.5.
2. Open the program StopLightsMx.vi. There is only one control on the
front panel a Boolean switch used to stop the operation of the stoplights.
3. Switch to the block diagram (Window»Show Block Diagram).
4. Observe the four-cycle sequence generated by the for loop.
The NI ELVISmx Digital Writer API is the structure that outputs the
light code to the stoplights. This API expects the input code to be an
8-bit Boolean array. For example, the first timing interval T1 requires
the code 20 (twenty decimal). Its value is placed in the first element of
an integer array labeled Lights Pattern. You must transfer the other
integer codes from the table in Exercise 7-3 into the three blank elements
of the Lights Pattern array.
Figure 7-8. Block Diagram for Automated Operation of a Two-way
Stoplight Intersection
In operation, one of the elements of the Lights Pattern array is selected
on the boundary of the for loop (inner loop) and converted into an 8-bit
Boolean array. In a similar way, the appropriate time delay is selected at
the for loop boundary and passed to the Wait function.
The timing intervals are stored in the four elements of the Time Delay
array. To speed up operation, the 25-second time interval is reduced to 5
seconds and the 5-second time interval is reduced to 1 second.
End of Exercise 7-4
© National Instruments Corporation
7-11
Introduction to NI ELVIS
Lab 7
LEDs to the Rescue!
What’s Cool!
LEDs are amazing devices. If you multiply the threshold voltage, VT, times
the electronic charge, e, the product is energy that is close to the band
gap energy of the semiconductor material used to manufacture the
semiconductor diode. Further, in the forward-biased region, the light from
the LED has an energy of hc/λ, where h is Planck’s constant, c is the speed
of light, and λ is the wavelength of the center of the energy distribution.
Conservation of energy yields the equation:
eVT ~ hc/λ
From the LED specifications, you can determine the wavelength or the LED
color. For example, red LEDs have a wavelength of about 560 nm. From the
I-V characteristic curve of the LED (see Exercise 7-2), you can measure the
threshold voltage VT. If you plot VT versus 1/λ for the three different colored
LEDs, you find a straight line with a slope approximately equal to (hc/e),
a mixture of three fundamental constants of nature.
Multisim Challenge: Design a Control Circuit for a Two-Way
Stoplight Intersection
Modern-day stoplights use a cluster of red, yellow, or green LEDs to
produce the stoplight signals. In this lab, you have learned about the
electrical and optical characteristics of visible LEDs. You have used colored
LEDs to form a simple two-way stoplight intersection and a LabVIEW
program to control the light sequences. With Multisim, you can design a
stoplight controller using discreet logic ICs. A stoplight program requires a
shift register and variable delays. Recall that the red light is on for (25 + 5)
seconds, the green light for 25 seconds, and the yellow light for 5 seconds.
Load the Multisim program called Stop Light Timing. Study the operation
carefully.
This program uses two 7474 Dual D edge-triggered flip-flop ICs to form a
4-bit shift register. It uses a special clock circuit to generate the timing
sequence 25, 5, 25, 5 seconds. This program controls only one set of red,
yellow, and green stoplights. Your challenge is to modify the program so
that it can control two sets of stoplights in a two-way stoplight intersection.
Introduction to NI ELVIS
7-12
ni.com
Free Space Optical Communications
8
Figure 8-1. Free Space Infrared Optical Digital Communications Link
Many homes today have several remote controllers lying around the house
such as those controlling televisions, stereos, and DVD players. Do you
know how these controllers work? The secret is an infrared optical data link,
which is a type of free space optical communication link.
Goal
This lab uses an infrared optical source to communicate information over
free space to a phototransistor detector. Explore several modulation schemes
including amplitude modulation and nonreturn-to-zero (NRZ) digital
modulation. For the Multisim challenge at the end of this lab, simulate the
free space optical link built on the NI ELVIS II protoboard.
© National Instruments Corporation
8-1
Introduction to NI ELVIS
Lab 8
Free Space Optical Communications
Required Soft Front Panels (SFPs)
•
Two-wire current-voltage analyzer (2-Wire)
•
Three-wire current-voltage analyzer (3-Wire)
•
Function generator (FGEN)
•
Oscilloscope (Scope)
•
Digital writer (DigOut)
Required Components
1.
•
220 Ω resistor (red, red, brown)
•
470 Ω resistor (yellow, violet, brown)
•
1 kΩ resistor (brown, black, red)
•
22 kΩ resistor (red, red, orange)
•
0.01 μF capacitor
•
0.5 μF capacitor
•
IR emitter (LED)
•
IR detector (phototransistor)1
•
2N3904 NPN transistor
•
555 timer chip
RS276-142 IR emitter and detector pair are available at www.radioshack.com.
Introduction to NI ELVIS
8-2
ni.com
Lab 8
Exercise 8-1
Free Space Optical Communications
A Phototransistor Detector
Understanding how a phototransistor works starts with understanding
transistor characteristic curves. A transistor is basically a current-controlled
amplifier. A small base current controls the current flowing through the
transistor from the collector to the emitter.
Complete the following steps to determine the characteristic curve of a
transistor.
1. Insert a 2N904 transistor on an NI ELVIS II protoboard.
2. Connect the emitter, base, and collector leads to pin sockets DUT–,
DUT+, and BASE, as shown in Figure 8-2.
Figure 8-2. Connections for 3-Wire Transistor Curve Tracer Measurements
Note
Base Æ Base, DUT– Æ Emitter, and DUT+ Æ Collector Leads
3. Launch the NI ELVISmx Instrument Launcher and select the
Three-Wire Current-Voltage Analyzer (3-Wire).
4. Power on the protoboard.
5. Set the Base Current and Collector Voltage as shown in Figure 8-3 and
click on Run.
© National Instruments Corporation
8-3
Introduction to NI ELVIS
Lab 8
Free Space Optical Communications
Figure 8-3. Typical characteristic curves for a 2N3904 Transistor
The graph displays the collector current versus collector voltage for
different values of the base current. You can set many parameters for the
collector voltage and the base current ranges. When running, this SFP first
outputs a base current, then outputs the collector voltage, and finally
measures the collector current. Data points (I,V) are plotted as sequential
points with the same base current connected with a line. You can see the
curves develop as the program proceeds, resulting in a family of [IV] curves
with different base currents. Observe that for a given collector voltage, the
collector current increases with an increase in base current.
A phototransistor has no base lead. Instead, light falling on the transistor
generates a base current proportional to the light intensity. For example,
with no light, the phototransistor might follow the bottom (yellow) curve.
For a low-light level, the middle (red) curve might be generated, and, at a
higher-light intensity, the upper (green) curve might be found. For collector
voltages greater than 0.4 V, the collector current follows the light intensity
falling on the base region in an almost linear fashion. To build an optical
detector, all that is needed is a power supply, a current limiting resistor, and
a phototransistor, as shown in Figure 8-4.
Introduction to NI ELVIS
8-4
ni.com
Lab 8
Free Space Optical Communications
Figure 8-4. Phototransistor Detector Circuit
6. Close any SFPs.
End of Exercise 8-1
© National Instruments Corporation
8-5
Introduction to NI ELVIS
Lab 8
Free Space Optical Communications
Exercise 8-2
Infrared Red Optical Source and Test Circuit
The optical transmitter is made up of just two components, an infrared (IR)
LED (forward-biased) and a current limiting resistor.
Complete the following steps to test and analyze an IR LED and build a
simple optical link:
1. Connect the IR LED to the DMM/Impedance Analyzer pin sockets
[DUT+] and [DUT–]. Make sure the LED anode (short lead) is
connected to [DUT–].
2. From the NI ELVISmx Instrument Launcher, select the Two-Wire
Current-Voltage Analyzer (2-Wire). Set voltage sweep parameters to
Start 0.0 V
Stop +2.0 V
Increment 0.05 V
3. Click Run.
The [IV] curve for the infrared diode is developed and displayed.
Figure 8-5. IR LED I-V Characteristic Curve
For voltages greater than about 0.9 V, the IR LED emits light in the
forward-bias region. Light is emitted at a wavelength of 950 nm, outside the
spectral range of human eyesight and in the near infrared region. The LED
Introduction to NI ELVIS
8-6
ni.com
Lab 8
Free Space Optical Communications
specs tell you that the maximum allowed current is more than 100 mA,
making IR LEDs about 10 times brighter than normal visible LEDs. The
intensity of the IR LED gives the remote controllers a great amount of range.
Connecting the LED in series with a 220 Ω resistor and a +5 V power supply
produces a current of about 11 mA, yielding about 10 mW of invisible
optical power. It takes a special detector like your phototransistor to see it.
4. Build the LED transmitter circuit and the phototransistor detector circuit
on the protoboard, as shown in Figure 8-6.
Figure 8-6. Free Space IR Transmitter-Detector Circuit
5. Connect the output of the function generator pin socket (FGEN) to the
IR LED anode pin.
6. Connect the output of the phototransistor to the pin socket [AI 0+] and
Ground to [AI 0–].
Taken together, these circuits form a simple optical data link. Figure 8-7
shows this circuit on the NI ELVIS II protoboard.
Figure 8-7. Free Space IR Communications Link on NI ELVIS Protoboard
7. Close any SFPs.
End of Exercise 8-2
© National Instruments Corporation
8-7
Introduction to NI ELVIS
Lab 8
Free Space Optical Communications
Exercise 8-3
Free Space IR Optical Link (Analog)
Complete the following steps to test your free space optical link:
1. From the NI ELVISmx Instrument Launcher, select Function
Generator (FGEN) and Oscilloscope (Scope). The function generator
provides the analog signal to be transmitted. The oscilloscope monitors
the input signal on CH 0 and the output signal on CH 1.
To transmit an analog signal on the LED, you need to bias the LED into
the forward-biased region with a bias voltage greater than the turn-on
voltage (~1 V).
2. On the FGEN SFP, set the Offset voltage to +1.5 V.
3. Set the additional parameters on the FGEN SFP
Amplitude:0.5 V
Waveform:Sine
Frequency:1000 Hz
4. Run the function generator and oscilloscope, and observe the
transmitted and received signals.
5. Change the offset voltage and amplitude levels. When the received sine
wave starts to distort, the transmitter becomes nonlinear.
6. Find the best offset voltage value where the signal amplitude shows
minimum distortion. The IR optical link is now ready to send data.
7. Leave the function generator and oscilloscope SFPs open.
End of Exercise 8-3
Introduction to NI ELVIS
8-8
ni.com
Lab 8
Exercise 8-4
Free Space Optical Communications
Amplitude and Frequency Modulation (Analog)
Complete the following steps to test a free space optical link:
1. On an NI ELVIS II protoboard, wire the analog output pin sockets
[AO 0] and [AO 1] to the function generator pin sockets amplitude
modulation [AM] and frequency modulation [FM], respectively.
2. Launch LabVIEW. Select Modulation.vi from the Hands-On
NI ELVIS II library.
This program sends a DC signal from the NI ELVIS II analog output to
the modulation input of the function generator to produce an amplitude
or frequency modulated signal. The modulated signal is converted to an
intensity modulate light signal that is sent across your free space optical
link. The phototransistor detects it and converts it back into an electrical
signal. You have just built an elementary free space optical
communication link for analog signals.
3. Close any SFPs and LabVIEW.
End of Exercise 8-4
© National Instruments Corporation
8-9
Introduction to NI ELVIS
Lab 8
Free Space Optical Communications
Exercise 8-5
Free Space IR Optical Link (Digital)
IR remote controllers use a special encoding scheme called NRZ. A HI level
is signaled by a tone burst of 40 kHz square waves while a LO level is
signaled by the absence of any signal. A tone burst is generated using the
555 timer circuit shown in the Figure 8-8 circuit. A digital switch is
connected to pin 4 [RESET], so that when the switch is HI, a tone burst is
generated. When the switch is LO no oscillations occur.
To demonstrate the modulation scheme, use a 1.0 kHz tone burst so it is easy
to see on the oscilloscope.
Figure 8-8. Tone Burst Oscillator connected to Optical Link
Complete the following steps to build the gated digital oscillator.
1. Build a gated oscillator using a 555 timer chip and the following
components:
RA: 1.0 kΩ
RB: 1.0 kΩ
C: 0.5 μF
2. Connect pin 4 on the 555 timer chip to the digital line (DI 0) on the
NI ELVIS II protoboard.
3. Connect the oscillator output pin 3 to the IR LED anode pin.
4. Connect the output of the detector circuit to the oscilloscope (CH 0)
BNC socket.
5. Connect pin 1 of the 555 timer chip to Ground.
Introduction to NI ELVIS
8-10
ni.com
Lab 8
Free Space Optical Communications
6. From the NI ELVISmx Instrument Launcher, select Oscilloscope
(Scope) and Digital Writer (DigOut).
7. For the oscilloscope, select Scope CH 0 as Source, Trigger on Edge,
CH 0 Source, Level 1.0 V.
In operation, every time you set Bit 0 (DO 0) of the Digital Writer to HI, a
1 kHz signal appears on the oscilloscope. No signal is presented when Bit 0
is LO.
Try some of the other digital patterns like Walking 1s or Ramp, and view the
modulation scheme on the oscilloscope panel.
In remote controllers, the encoding scheme is slightly more complicated. If
you are interested in building a computer-controlled IR remote transmitter,
refer to Sensors, Transducers and LabVIEW by Barry E. Paton for details.
Figure 8-9. Tone Burst Oscillator Controlled from a Digital Line (red lead)
End of Exercise 8-5
© National Instruments Corporation
8-11
Introduction to NI ELVIS
Lab 8
Free Space Optical Communications
Multisim Challenge: Design a High-Speed Optical NRZ Data Link
Code the digital IR optical data link circuit of Exercise 8-5 with Multisim.
Use the NI ELVIS II schematic format for the virtual circuit. Determine the
bit rate that you can send using this circuit.
How can you improve the bit rate performance? Change the components in
the design to generate a high-speed digital optical link.
Introduction to NI ELVIS
8-12
ni.com
RF Wireless Communications
9
Figure 9-1. Guglielmo Marconi
Midday at Signal Hill near St. John’s, Newfoundland, in Canada, Guglielmo
Marconi pressed his ear to a telephone headset connected to an experimental
wireless receiver. About 1,700 miles away at Poldhu, Cornwall, in England,
his coworkers were about to send the Morse code letter s, which is three
dots. Faintly, but clearly “psht-psht-psht” pause “psht-psht-psht” came
through the earphone. The date was December 12, 1901, and the first
transatlantic message had just been sent and received.
Goal
In this lab, use a paper clip antenna to send this classic message and other
waveforms over a wireless radio frequency (RF) link. The NI ELVIS II
function generator is the transmitter and a high-gain op amp is the receiver.
The classic message is formulated using the NI ELVIS II arbitrary
waveform generator.
© National Instruments Corporation
9-1
Introduction to NI ELVIS
Lab 9
RF Wireless Communications
Required Soft Front Panels (SFPs)
•
Oscilloscope (Scope)
•
Arbitrary waveform generator (ARB)
Required Components
Introduction to NI ELVIS
•
1 kΩ resistor (brown, black, red)
•
100 kΩ resistor (brown, black, yellow)
•
741 op amp or field-effect transistor (FET) op amp 753
•
7408 digital IC
•
Paper clips
9-2
ni.com
Lab 9
Exercise 9-1
RF Wireless Communications
The Transmitter
Complete the following steps to build a simple transmitter antenna from a
paper clip:
1. Straighten a paper clip and cut it into a piece about 2.5 in. long.
2. Push one end of the paper clip into the output pin socket of the function
generator.
When FGEN is running, the output voltage leaks from the pin socket to
the paper clip antenna and radiates a small RF signal. A similar antenna
about a centimeter away can pick up this signal and amplify it to a higher
signal level. Use this transmitter in Exercise 9-2.
Figure 9-2. RF Transmitter-Receiver circuit with Antennas
3. Initially, use a sine wave to test the transmitter by setting the SFP
function generator to sine waveform, 2.5 V amplitude, and 10000 Hz
frequency.
End of Exercise 9-1
© National Instruments Corporation
9-3
Introduction to NI ELVIS
Lab 9
RF Wireless Communications
Exercise 9-2
The Receiver
Complete the following steps to build a simple receiver antenna from a
paper clip:
1. Bend a second paper clip into step shape, with the long side about
2.5 in., the step height about 0.25 in., and the step width about 0.5 in.
2. Insert the short end of the paper clip into a pin socket. The midsection
supports the antenna on the protoboard, so you can rotate the antenna
about the short end. The long side sits vertically and is parallel to the
transmitter antenna (see Figure 9-2).
3. Build a high-gain amplifier using a 741 op amp or 753 FET op amp in
the simple inverting configuration.
Figure 9-3. RF Receiver Op Amp Circuit
4. Connect a 1 kΩ resistor to the – input (pin 2).
5. Connect a 100 kΩ bias resistor to the + input (pin 3).
6. Connect the other end of the resistors to AIGND.
7. Connect a 100 kΩ resistor as the feedback resistor Rf from pin 2 to pin 6.
8. To power the circuit, connect +15 V on pin 7 and –15 V on pin 4.
Nominally the op amp has a gain of 101. You can use other resistor
combinations for higher gains.
9. The receiver antenna is connected to the input (pin 3).
10. Connect the op amp output pin 6 to the oscilloscope.
End of Exercise 9-2
Introduction to NI ELVIS
9-4
ni.com
Lab 9
Exercise 9-3
RF Wireless Communications
Testing the RF Transmitter and Receiver
Complete the following steps to use a sine wave signal to test the
transmitter-receiver pair.
1. Check the circuit you built in Exercise 9-2 and power on the protoboard.
2. Move the receiver antenna a few millimeters from the transmitter
antenna.
3. Connect the oscilloscope BNC connector channel (CH0) to the op amp
output, pin 6, and ground.
4. Connect the oscilloscope BNC connector channel (CH1) to the function
generator pin socket (SYNC).
5. Typical oscilloscope settings are:
Channel 0: 10 to 500 mV
Channel 1: 2 V/div
Trigger source: Channel 1
6. Decrease Channel 0 scale (V/div) until you see a sine wave.
If you cannot see a signal right away, touch the two antenna tips with
your fingertip. This simulates the high impedance of the atmosphere and
allows a small signal to propagate.
7. Adjust the FGEN amplitude and frequency until you get a good signal.
8. Measure the signal level as you separate the receiver antenna from the
transmitter antenna. You can easily measure the separation with a ruler.
You can quickly get an idea of how rapidly the signal level falls off with
distance; a long antenna helps in receiving distant signals. Marconi, at
Signal Hill, used a kite to carry his antenna hundreds of feet up into the
atmosphere.
Now that the transmitter-receiver is working, it is time to duplicate
Marconi’s classic message.
Marconi’s first RF transmitter consisted of a spark gap connected to a
resonant circuit and a very long antenna often carried high on a balloon
or kite. When a spark is discharged between the electrodes, an intense
RF pulse is generated with a short time duration of a few milliseconds.
It takes 30,000 V to produce a spark between electrodes separated by
1 cm, and the current can be large. A single spark followed by a pause
was a dot. A longer spark followed by a pause was a dash. Together,
© National Instruments Corporation
9-5
Introduction to NI ELVIS
Lab 9
RF Wireless Communications
these were all the ingredients needed for Morse code transmission. The
letter S is just three dots in rapid succession. The letter O is just three
dashes in rapid succession. The distress call, S-O-S (save our souls), is:
dot-dot-dot dash-dash-dash dot-dot-dot
For the first transatlantic message, Marconi chose the simpler signal
dot-dot-dot.
End of Exercise 9-3
Introduction to NI ELVIS
9-6
ni.com
Lab 9
Exercise 9-4
RF Wireless Communications
Building a Unique Test Signal with an Arbitrary
Waveform Analyzer
A dot is a signal, usually an oscillation, followed by silence (no signal).
Each part lasts for about 0.1 second. A dash is just a signal lasting for the
duration of three dots, or 0.3 second, followed by a pause. The encoding
scheme is a simple tone burst with different duration times. The letter S is
encoded as dot-dot-dot or, in binary, 101010, where 1 is the dot and 0 is the
pause. A longer message consisting of multiple letters like SSS has a longer
pause (0.4 second) placed between each letter. This message in binary is
101010 0000 101010 0000 101010 0000.
If you can generate this waveform on the NI ELVIS II digital-to-analog
converter, or DAC (AO), then you can use the DAC output to gate the
function generator on and off. The resulting tone burst signal from the
FGEN can radiate the message to the world.
Complete the following steps to build a program to produce a Morse code
transmission:
1. From the NI ELVISmx Instrument Launcher, select Arbitrary Waveform
Generator (ARB).
With the arbitrary waveform generator, you can create unique
waveforms, such as Marconi’s first message. You can use a special
program called the Waveform Editor to create all kinds of unique
diagnostic and control waveforms.
2. Click the Waveform Editor button to view this feature.
The SFP ARB provides waveform control over the AO 0 and AO 1
outputs.
3. Click on the browser icon next to the DAC0 Waveform Name box.
4. From the NI ELVIS II library folder, select the 1VSine1000.wdt file.
Enable AO output by clicking on AO 0:[box]. When you click on the
Run button, a 1.0 V amplitude sine wave at 1000 Hz is applied to the
AO 0 pin socket.
© National Instruments Corporation
9-7
Introduction to NI ELVIS
Lab 9
RF Wireless Communications
Figure 9-4. ARB created 1 V Sine Waveform
5. Connect the oscilloscope CH 0 BNC input to the AO 0 pin socket. Click
the Run button and observe a 1 kHz sine wave signal on the oscilloscope
window.
Note
For a steady signal trace, trigger on Channel 0.
6. Return to the AO 0 browser icon, navigate to the Hands-On NI ELVIS II
library folder, and select the file Morse.wdt. This file provides the
waveform for the letter S in Morse code. Change the AO 0 gain to 2.5.
7. Click Run and observe this signal on the oscilloscope.
Introduction to NI ELVIS
9-8
ni.com
Lab 9
RF Wireless Communications
Figure 9-5. ARB Created Morse Code Letter S
For the real transmission, change the Update Rate box to 10000.0 S/s.
End of Exercise 9-4
© National Instruments Corporation
9-9
Introduction to NI ELVIS
Lab 9
RF Wireless Communications
Exercise 9-5
A Demonstration of Marconi’s RF Transmission
Signal
Complete the following steps to finish the transmitter station:
1. Install a 7408 (quad 2-input AND) digital IC in the protoboard. Power
(+5 V) is applied to pin 14 and Ground is pin 7.
2. Connect the AO 0 output pin socket on the NI ELVIS II protoboard to
pin 1 of the 7408 IC.
3. Connect the FGEN output to pin 2 of the 7408 IC. The transmitter signal
now on pin 3 of the 7408 IC is connected to the paper clip transmitter
antenna.
Figure 9-6. RF Transmitter and Receiver Circuits
4. Now configure the SFP function generator for TTL output levels.
Amplitude
Æ
2.2 V
Offset
Æ
2.5 V
Waveform
Æ
Square
Frequency
Æ
1 kHz
5. Observe the transmitted and received signals on the oscilloscope:
Channel 0 goes to pin 3 of the 7408 chip (the transmitter signal) and
Channel 1 goes to pin 6 of the op amp (the receiver signal).
6. Trigger on Channel 0.
You should be able to see the transmitted message S on Channel 0 and
the received signal on Channel 1.
End of Exercise 9-5
Introduction to NI ELVIS
9-10
ni.com
Lab 9
RF Wireless Communications
Circuit Challenge: Hearing Is Believing
With a little more gain on the receiver side and a conversion of the signal
into a current, you can drive a small loudspeaker to hear
beep-beep-beep-pause-beep-beep-beep-pause
faintly but clearly.
Enjoy the challenge.
© National Instruments Corporation
9-11
Introduction to NI ELVIS
10
Mechanical Motion
Figure 10-1. Tachometer Apparatus to Measure Motor Speed
The ability to translate electrical signals into motion in the real world
combined with the ability to measure position can help you exploit the
power of the computer to generate computer automation the source of much
of the modern world’s conveniences.
Goal
In this experiment, use the power capacity of the NI ELVIS II variable power
supply to run and control the speed of a small DC motor. Using a modified
free space IR link, build a tachometer to measure the speed of the motor. By
combining the motor and tachometer with a LabVIEW program, you can
incorporate computer automation in the system.
Required Soft Front Panels (SFPs)
•
Variable power supply (VPS)
•
Oscilloscope (Scope)
•
LabVIEW
© National Instruments Corporation
10-1
Introduction to NI ELVIS
Lab 10
Mechanical Motion
Required Components
Introduction to NI ELVIS
•
1 kΩ resistor (brown, black, red)
•
10 kΩ resistor (brown, black, orange)
•
IR LED/phototransistor module
•
DC motor
•
Small punch or drill
•
Glue
•
Several combs with varying numbers of teeth per inch
10-2
ni.com
Lab 10
Mechanical Motion
Exercise 10-1 Start Your Engine
You can purchase a small, inexpensive DC motor at Radio Shack or many
hobby stores. These motors require a voltage source from 0 to 12 V,
producing a maximum RPM of about 15,000 at 12 V. With no load, the
current requirement is about 300 mA. The NI ELVIS II VPS can supply up
to 500 mA at 12 V. Also, by changing the polarity of the applied voltage, you
can change the direction of rotation.
Complete the following steps to install and run a motor on an NI ELVIS II
protoboard.
1. Connect a DC motor to the VPS output terminals, (SUPPLY+ and
GROUND).
2. Launch the NI ELVISmx Instrument Launcher and select Variable
Power Supply (VPS).
3. From either the workstation’s manual VPS controls or the SFP controls,
test the motor.
In the following example, manual control has been selected by clicking
on the Manual box []. Read the VPS voltage by clicking on the Measure
Supply Outputs box [], applying power to the protoboard, and clicking
Run.
Figure 10-2. VPS Supply + Configured to Manually Drive a DC Motor
End of Exercise 10-1
© National Instruments Corporation
10-3
Introduction to NI ELVIS
Lab 10
Mechanical Motion
Exercise 10-2 The Tachometer
Using an IR LED and phototransistor or an integrated LED/phototransistor
module, you can build a simple motion sensor.
Complete the following steps to build a simple motion sensor.
1. On the protoboard, insert the components shown in the Figure 10-3
circuit diagram.
Emitter
Detector
+5V
1kΩ
Gnd
10 k Ω
+
To ACH4
-
Figure 10-3. Circuit for Operation of an Integrated LED/Phototransistor Module
In the case of an LED/phototransistor module, an internal LED is used
for the optical source. Power it from the +5 V power supply through a
1 kΩ current limiting resistor Then connect a 10 kΩ resistor from the
phototransistor emitter to ground and connect the same +5 V power
supply to the phototransistor collector. The voltage developed across the
10 kΩ resistor is the phototransistor or tachometer signal.
2. Connect leads from the 10 kΩ resistor to the [AI 0+] and [AI 0–] pin
sockets.
Introduction to NI ELVIS
10-4
ni.com
Lab 10
Mechanical Motion
3. Select Scope from the NI ELVISmx Instrument Launcher and select the
settings, as shown in Figure 10-4.
Figure 10-4. Tachometer Signal Viewed on the Oscilloscope
4. Power on the protoboard and run the oscilloscope SFP.
5. Pass a piece of paper through the IR motion sensor. You should see the
oscilloscope trace change (HI-LO-HI). With a narrow piece of paper,
you might catch the pulse generated as you drag it through the sensor.
6. Place a comb with many teeth in the sensor IR beam. Dragging it
through the sensor generates a train of pulses. You can even run it back
and forth like a saw to generate a continuous stream of pulses as shown
in Figure 10-4.
It is interesting to try combs with different sizes and numbers of teeth. Each
comb generates its own signature waveform.
End of Exercise 10-2
© National Instruments Corporation
10-5
Introduction to NI ELVIS
Lab 10
Mechanical Motion
Exercise 10-3 Building a Rotary Motion System
The rotary motion demonstration system consists of the DC motor
controlled by the variable power supply and the IR motion sensor
configured as a tachometer. To complete the tachometer, you must attach a
disk with a 2 in. diameter, to the shaft of the motor by completing the
following steps.
1. Cut a 2 in. diameter disk from a piece of thin but sturdy cardboard or
plastic.
2. Cut a slot about 0.25 in. wide and 0.25 in. deep near the circumference
of the disk.
3. Punch or drill a small hole at the center point.
4. Glue the disk to the end of the motor shaft.
5. Mount the motor so that the slot lines up with the IR transmitter/receiver
beam. In operation, each revolution generates one pulse.
Emitter
VPS+
Detector
+5V
1kΩ
Gnd
10 k Ω
+
To ACH 4
-
Gnd
12 V DC Motor
Figure 10-5. Motion Sensor Circuit and Motor Parts
You can also use the CD and motor of Lab 6. Instead of a small magnet triggering
the sensor, you can drill a hole about the size of the transmitter/receiver beam (3 mm)
near the edge of the CD. Align the IR sensor so that the beam passes through the hole.
Note
Introduction to NI ELVIS
10-6
ni.com
Lab 10
Mechanical Motion
Figure 10-6. Apparatus to Measure the Speed of a Spinning CD
End of Exercise 10-3
© National Instruments Corporation
10-7
Introduction to NI ELVIS
Lab 10
Mechanical Motion
Exercise 10-4 Testing the Rotary Motion System
Complete the following steps to test the rotary motion system.
1. Power on the protoboard and run the motor using the NI ELVIS II VPS
SFP to control the motor speed.
2. Adjust the motor position so that the disk does not touch the sensor slot.
3. Observe on the oscilloscope the pulses generated by the rotating motor,
as shown in Figure 10-7.
Figure 10-7. Typical Tachometer Waveform
4. Read the pulse frequency (Freq:) from the measurement row CHO
Meas: at the bottom of the oscilloscope screen. Take frequency
measurements for a variety of power supply levels. A plot of frequency
versus VPS voltage level demonstrates the linearity of your rotary
motion system.
5. Close NI ELVIS and all SFPs.
End of Exercise 10-4
Introduction to NI ELVIS
10-8
ni.com
Lab 10
Mechanical Motion
Exercise 10-5 A LabVIEW Measurement of RPM
LabVIEW has several VIs located at Functions»Programming»Analog
Waveform»Waveform Measurements that are convenient for measuring
the timing periods of a continuous waveform. You can use the Pulse
Measurements.vi to measure the period, pulse duration, or duty cycle from
a waveform array.
Figure 10-8. Period Measurement Converted to kRPM
You can convert the period measurement to revolutions per minute by
inverting the period to get frequency and multiplying by 60 to get rpm. For
scaling, divide by 1000 to get krpm.
You can also use the Express template for Timing and Transitions Measurements
and get the frequency directly. Then convert the frequency to rpm as discussed above.
Note
Figure 10-9. kRPM Measurements using an Express VI
© National Instruments Corporation
10-9
Introduction to NI ELVIS
Lab 10
Mechanical Motion
Using LabVIEW, complete the following steps to measure the
period/frequency on a continuous waveform.
1. Launch LabVIEW and open RPM.vi from the Hands-On-NI ELVIS II
library folder.
2. Open the diagram window and study the program.
Figure 10-10. Block Diagram of program RPM.vi
Use the DAQ Assistant to collect 1000 voltage samples for the tachometer
graph and provide an input signal array for the Pulse Measurements.vi. The
rpm signal is sent to a front panel meter and displayed in krpm. The rpm
signal also goes to a shift register with five elements. This provides an
averaged rpm signal for the front panel. You manually control the motor
speed with the front panel knob labeled Setpoint. Also available on the front
panel is a graph of the tachometer signal as a function of time.
Introduction to NI ELVIS
10-10
ni.com
Lab 10
Mechanical Motion
Run this VI and take your motor for a spin. See and hear how responsive the
motor is to a rapid change in the rpm setpoint.
Figure 10-11. LabVIEW Tachometer and Motor Control Circuit Front Panel
End of Exercise 10-5
© National Instruments Corporation
10-11
Introduction to NI ELVIS
Lab 10
Mechanical Motion
LabVIEW Challenge: Computer Automation of the Rotary Motion
System
National Instruments offers the LabVIEW PID Control Toolkit, which
features additional LabVIEW VIs you can use to add computer automation
to your rotary system. PID stands for “proportional integral derivative.”
These control algorithms move a system from one setpoint (initial rpm) to
another setpoint (final rpm) in an optimized manner. The addition of a single
VI (PID.vi) provides optimal control to your program. The algorithm
compares the target rpm (final rpm) with the current rpm (averaged rpm
signal) to generate a DC error signal, which drives the VPS. Integration and
differentiation parameters adjust the VPS voltage smoothly from one
measurement to the next.
Figure 10-12. PID subVI for Control Applications
If you are more familiar with control, you can use another VI (PID
Autotuning.vi) to set the initial PID parameters automatically. Then you can
fine-tune the parameters to your specific system. Search for additional
LabVIEW PID resources at ni.com.
Introduction to NI ELVIS
10-12
ni.com
Lab 10
Mechanical Motion
Figure 10-13. Setpoint (yellow) and RPM (red) Traces show Optimal Control PID
in Action
In Figure 10-13, the setpoint (yellow trace) is changed suddenly from 3300
to 4500 krpm. The system rpm (red trace) responds by moving the motor
speed smoothly and optimally from the current setpoint to the target
setpoint.
© National Instruments Corporation
10-13
Introduction to NI ELVIS
11
Digital Dice
Figure 11-1. Digital Dice Circuit on NI ELVIS II Workstation
From the beginning of time, dice have been used for games of chance. Cubic
dice similar to modern dice date back to before 5000 BC. The Greeks and
Romans used dice made of stone or ivory with spots on the side inlayed with
dark ink or bits of lead. In this lab, light emitting diodes (LEDs) in a dice
pattern are used to display the lucky number.
Goal
In this lab, explore using Multisim to design an electronic version of digital
dice with standard TTL ICs. From the virtual Multisim design, build a
prototype circuit using real TTL ICs on the NI ELVIS II protoboard. Also
use NI ELVIS II SFPs to test your design within a Multisim environment
and, with a click of the mouse, use the same test instruments to test the real
circuit.
© National Instruments Corporation
11-1
Introduction to NI ELVIS
Lab 11
Digital Dice
Soft Front Panels (SFPs)
•
DMM[V, Ω,
•
Oscilloscope (Scope)
•
Function generator (FGEN)
]
Required Components
Introduction to NI ELVIS
•
Two 100 kΩ resistor (brown, black, yellow)
•
Five 220 Ω resistors (red, red, black)
•
Four 1 kΩ pull-up resistors (brown, black, red) [optional]
•
Eight red LEDs
•
Two 0.01 μF capacitors
•
0.1 μF capacitor
•
Two 1 μF capacitors
•
555 timer IC
•
Two 7474 Dual D flip-flops
•
One 7404 hex inverter
•
Single-pole single-throw (SPST) switch or push button (normally open)
11-2
ni.com
Lab 11
Digital Dice
Some Background
Consider the case of a single die. On each of its six sides, one of the
following patterns appears, representing the numbers one through six.
These patterns are traditional. You can think of them as seven lights
arranged in an “H” pattern.
By turning on the appropriate lights, you can create any one of the six
patterns on the face of a die.
On closer inspection, there are only four unique patterns from which the
pattern for any face can be formed. Call these base patterns A, B, C, and D:
A
B
C
D
The base state A has only one light and it occupies the snake-eye position in
the dice’s center position. The three remaining states all use two lights
occupying one of the two diagonal positions or the horizontal position.
If you write down a truth table for the presence or absence of these base
patterns as a function of the die face number, the meaning of the base states
becomes clearer.
© National Instruments Corporation
11-3
Introduction to NI ELVIS
Lab 11
Digital Dice
Table 11-1. How Base States form Dice Patterns
Die face
A
1
✓
B
C
D
✓
2
✓
3
✓
4
✓
5
6
✓
✓
✓
✓
✓
✓
✓
The base pattern A is used by all of the odd numbers (1, 3, and 5). Pattern B
is found in all numbers except 1. Base pattern C is found in the numbers 4,
5, and 6. Pattern D is used only when representing the number 6.
You can build a single dice display using seven LEDs and four current
limiting resistors.
+5 V
B
A
330 Ω
D
C
Figure 11-2. Dice Display Circuit
In the Figure 11-2 schematic diagram, shorting an input pad A, B, C, or D
to ground turns on that base state. In the combinations of A, B, C, or D
shown in Table 11-1, you can generate any of the standard dice displays.
Introduction to NI ELVIS
11-4
ni.com
Lab 11
Digital Dice
Exercise 11-1 Multisim Dice Display Using Seven LEDs
Launch Multisim and open the program Display1.ms10. It has seven virtual
LEDs and four current limiting resistors together with four switches. Run
this program and operate the switches in the combinations shown Table 11-1
to verify that the truth table generates the dice displays.
Replace the switches with the NI ELVISmx Digital Writer SFP.
For reference, look at Display2.ms10.
By doing this, you can exercise the dice display using the NI ELVISmx
Digital Writer. Use the mapping
Line 0 Æ A
Line 1 Æ B
Line 2 Æ C
Line 3 Æ D
Set all the lines 0..1 to LO initially. All the LEDs should be lit. This is the
lamp test state.
These LEDs are active low, that is, setting the lines (A..D) LO turns on the selected
base set of LEDs.
Note
Verify your circuit design follows the truth table in Table 11-1.
End of Exercise 11-1
© National Instruments Corporation
11-5
Introduction to NI ELVIS
Lab 11
Digital Dice
Exercise 11-2 Converting a Multisim Design into a Real Circuit
Complete the following steps to build and test a real dice display.
1. On the NI ELVIS II protoboard, build a real digital dice display using
seven LEDs and four resistors. Use the schematic diagram in
Exercise 11-1 or the program Display2.ms10 as a wiring guide.
Figure 11-3. Digital Dice Module on NI ELVIS II Protoboard
2. Use the NI ELVISmx Digital Writer as a diagnostic test instrument to
test your circuit. Recall that the LEDs are active LO.
3. Use the values A, B, C, and D in Table 11-1 to verify the operation of
your design.
You can have both Multisim and the NI ELVIS protoboard active at the same time.
In this exercise, the instrument control device [box] determines which application NI
ELVISmx Digital Writer controls.
Note
[Multisim] selects the active Multisim panel
[Dev 1 (NI ELVIS)] selects the NI ELVIS II protoboard
By switching back and forth, you can easily compare your Multisim design
with the real circuit on the NI ELVIS II protoboard.
End of Exercise 11-2
Introduction to NI ELVIS
11-6
ni.com
Lab 11
Digital Dice
Exercise 11-3 A Modulo 6 Counter
A modulo 6 counter is any counter with six unique states that repeat the
sequence every six counts. It could be a binary counter with decimal
equivalents of (1, 2, 3, 4, 5, 6, 1..), or as in a LabVIEW or C+ program,
counting from zero (0, 1, 2, 3, 4, 5, 0..). It could be a pseudorandom number
generator that randomly generates a six-number sequence like (5, 1, 6, 4, 3,
2, 5..).
In this lab, build a simpler modulo 6 counter using a three-element shift
register configured as a switched tail ring counter Figure 11-4.
Q2
Q1
D
Q
D
Q
Q
Q
Q3
D
Q
Q
clock
Figure 11-4. Schematic Diagram of a Modulo 6 Switch-tail Ring Counter
It uses three D-type flip-flop elements configured as a shift register. Note the
switched tail; the inverted output of the last element is connected back to the
input of the first element. On command from a rising edge of the clock
pulse, all the D inputs shift to their respective outputs. Each clock pulse
generates a new sequence of outputs on Q1, Q2, and Q3, which repeats after
six pulses.
© National Instruments Corporation
11-7
Introduction to NI ELVIS
Lab 11
Digital Dice
The truth table is shown in Table 11-2.
Table 11-2. Modulo 6 Truth Table
Cycle
Q1
Q2
Q3
1
0
0
0
2
1
0
0
3
1
1
0
4
1
1
1
5
0
1
1
6
0
0
1
7
0
0
0
same as cycle 1
With Multisim, design a modulo 6 counter using two 7474 Dual D
edge-triggered flip-flop ICs. Each IC contains two D flip-flop elements
labeled in Multisim as 1 and 2. The input is labeled as D for data source and
the outputs are labeled as Q and Q where Q is the complement of Q. Each
element has a Clear (CLR) and a Preset (PR) input, which is pulled HI for
clocking operations. You form a shift register when you connect all the
clock inputs (CLK) together and to the circuit clock.
Introduction to NI ELVIS
11-8
ni.com
Lab 11
Digital Dice
Figure 11-5. Multisim Version of a Switch Tail Ring Counter with LED Displays
To visualize the outputs Q1, Q2, and Q3, an LED is connected to each output
(Q) and the power supply. Note when a Q bit is HI, current is sunk through
Q to ground, which turns on the respective LED. The illuminated state
signifies that Q is HI.
Use the NI ELVISmx Function Generator as the circuit clock. Set the output
for TTL levels, set the amplitude equal to 5 Vpk–pk, and set an offset of 2.5
V. Set the function to Square Wave and frequency near 60 Hz.
Verify your design by comparing it with the example Mod 6.ms10 in the
NI ELVIS program library.
End of Exercise 11-3
© National Instruments Corporation
11-9
Introduction to NI ELVIS
Lab 11
Digital Dice
Exercise 11-4 Convert the Mod 6 Multisim Design into a
Real Circuit
Complete the following steps to convert your Multisim design to a real
circuit on an NI ELVIS II protoboard:
1. Transfer your working design into real circuit components. You need
two 7474 ICs, three visible LEDs, and three current limiting resistors.
2. One can also use three of the LED indicators on the NI ELVIS II
protoboard labeled LED 0, 1, and 2.
Map Q1 to LED0, Q2 to LED0, and Q3 to LED0.
Note
These LEDs are active HI, that is, a HI state turns the LED on.
Figure 11-6. Real Component Modulo 6 Counter connected to NI ELVIS II LEDs
The Multisim program Mod 62.ms10 demonstrates this option.
3. Use the same NI ELVISmx Function Generator as you did in
Exercise 11-3.
4. Switch back and forth between Multisim and the NI ELVIS II
protoboard to verify the operation of your modulo 6 counter.
End of Exercise 11-4
Introduction to NI ELVIS
11-10
ni.com
Lab 11
Digital Dice
Exercise 11-5 Building the System Clock
To roll the dice, you can use a high clock speed. A clock frequency of several
kilohertz is fast enough so that the eye cannot tell which numbers are
appearing on the LED dice display. It looks just like the dice are rolling.
Complete the following steps to build the system clock.
1. Review the digital clock circuit from Lab 5, Exercise 5-2.
2. Design a Multisim circuit for a TTL clock using a 555 timer IC
configured as a stable oscillator.
Figure 11-7. Multisim 555 Clock Circuit
3. Use the following components
RA = 100 kΩ
RB = 100 kΩ
C = 0.01 μf
to complete the clock circuit and define the frequency of operation.
4. Use the NI ELVIS II SFP (Scope) to verify the circuit operation and
measure the clock frequency.
© National Instruments Corporation
11-11
Introduction to NI ELVIS
Lab 11
Digital Dice
5. To stop the dice rolling, you need only to stop the clock. You can
simulate this feature, “One-armed bandit,” using a simple switch
connected between Ground and pin 2 of the 555 timer IC.
6. Modify your clock design with this addition and verify the circuit
operation. You should see the oscillator stop when the switch is closed.
Figure 11-8. Added components to convert 555 Clock to Gated Oscillator
7. When the circuit is operating correctly, replace the component list above
with a second set of components to slow the clock down to a speed
where your eye can follow the action.
RA = 100 kΩ
RB = 100 kΩ
C = 2 μf
8. Modify your circuit a second time by adding a single LED between the
+5 V supply and by connecting a current limiting resistor to the 555
output (pin 5).
9. Power up the protoboard and click on Run to verify the slow speed clock
operation.
10. Use the Multisim program Clock.ms10 in the NI ELVIS II library folder
to check on your program.
End of Exercise 11-5
Introduction to NI ELVIS
11-12
ni.com
Lab 11
Digital Dice
Exercise 11-6 Building a Real Clock Circuit on an NI ELVIS II
Protoboard
Complete the following steps to build a real clock design with modifications
on an NI ELVIS II protoboard.
1. Transfer your second clock design to the NI ELVIS II protoboard. You
need a 555 timer IC, resistors RA and RB, capacitor C, a 330 Ω resistor,
a visible LED, and a switch.
Figure 11-9. Gated System Clock Circuit on NI ELVIS Protoboard
2. When the circuit is completed, power up the protoboard. You should see
the LED flashing.
3. Power off the protoboard.
4. Remove the NI ELVIS SFP connection from your modulo 6 counter and
replace it with a connection between the 555 output (pin 3) and the clock
input of the modulo 6 counter.
5. Power up the protoboard. You should see the clock output LED flashing
and the three output lines Q1, Q2, and Q3 on the modulo 6 counter
displaying the count on the protoboard LEDs 0, 1, and 2.
6. Power off the protoboard.
7. Replace the second (RA, RB, C) set with the first (RA, RB, C) set. When
you apply power to the protoboard, you should not be able to see any
counting – just a blur on the LEDs.
8. Push the switch and see the current count on the modulo 6 output lines.
End of Exercise 11-6
© National Instruments Corporation
11-13
Introduction to NI ELVIS
Lab 11
Digital Dice
Exercise 11-7 Building the Three- to Four-Line Encoder
The encoder takes the three counter outputs, Q1, Q2, and Q3, and sets the
base states, A, B, C, and D, to represent the dice numbers 1 through 6. There
is no a priori reason to decide which counter output corresponds to which
count. However, a little foresight makes the choices easier.
Table 11-3. All possible states of a Modulo 6 Switch Tail Ring Counter
#
Q1
Q2
Q3
Q1’
Q 2’
Q3’
6
0
0
0
1
1
1
4
1
0
0
0
1
1
2
1
1
0
0
0
1
1
1
1
1
0
0
0
3
0
1
1
1
0
0
5
0
0
1
1
1
0
For example, each output has three (1) states and three (0) states. You could
use one of these outputs, say Q3, to signify odd states 1, 3, and 5. You could
then use another output state, say Q2, to code the family 4, 5, and 6. These
two lines then decode two of the base patterns for “free.”
To decode the two remaining base patterns with a particular pattern of the
three counter lines, you can use a three-input AND gate. Decode “Not 1”
with the combination Q1, Q2, and Q3 and decode the final base state “6”
with Q1, Q2, and Q3.
Build the encoder using two three-input AND gates with four inverter gates.
The schematic diagram in Figure 11-10 shows the encoder circuit.
Introduction to NI ELVIS
11-14
ni.com
Lab 11
Digital Dice
Figure 11-10. LabVIEW coded version of a 3-to-4 line Encoder
Recall that the dice display in Exercise 11-2 requires that the dice display
inputs be active LO to turn on the LEDs. This implies that the outputs of the
encoder in Figure 11-10 must be inverted. You can do this by replacing the
AND gates with NAND gates and rearranging to connections to A, B, C, and
D. Study the Figure 11-10 design and make the necessary corrections.
Sketch the new encoder circuit on paper.
Complete the following steps to build the new encoder design.
1. Design a Multisim circuit for the new encoder. Use a 7410 (triple
three-input NAND gate) IC and a 7404 (hex inverter) IC.
2. Set the encoder input lines Q1, Q2, and Q3 with three output lines,
DIO 0, 1, and 2, of the NI ELVISmx Digital Writer.
3. View the output states A, B, C, and D with four lines, DIO 8, 9, 10,
and 11, of the NI ELVISmx Digital Reader.
4. For assistance, take a peek at Encoder.ms10 in the Hands-On
NI ELVIS II library folder.
5. Run the simulation and verify the truth table for the three- to four-line
encoder.
End of Exercise 11-7
© National Instruments Corporation
11-15
Introduction to NI ELVIS
Lab 11
Digital Dice
Exercise 11-8 Building and Testing the Digital Dice Encoder
Complete the following steps to build and test the encoder.
1. Transfer your Multisim encoder design to a real circuit on an
NI ELVIS II protoboard. You need a 7410 (triple three-input
NAND gate) IC and a 7404 (hex inverter) IC.
Figure 11-11. Multisim circuit for 3-to-4 line Encoder with Dice Display
2. Use the NI ELVISmx Digital Writer to set the inputs Q1, Q2, and Q3.
3. Use the NI ELVISmx Digital Reader to view the encoder output states
A, B, C, and D.
4. When you are satisfied with the circuit operation, replace the lines to the
NI ELVISmx Digital Reader with the input lines for the real digital dice
display.
5. Make one final check on the encoder/LED display circuit.
6. Power up your circuits. Verify the encoder/LED display generates the
dice patterns (1..6).
7. If all works as expected, connect the four digital dice components:
clock, counter, encoder, and display.
End of Exercise 11-8
Introduction to NI ELVIS
11-16
ni.com
Lab 11
Digital Dice
Exercise 11-9 Electronic Dice
To roll a die, turn on the protoboard and set the switch to open. All the
numbers appear on the LED display but at a speed too fast for the eye to
follow the patterns.
By flipping the switch to close, you can stop the counter. This state is
converted into one of the six possible display patterns, maybe your favorite
number.
© National Instruments Corporation
11-17
Introduction to NI ELVIS
Additional Information and Resources
A
This appendix contains additional information about National Instruments
technical support options and NI ELVIS resources.
National Instruments Technical Support Options
Visit the following sections of the award-winning National Instruments
Web site at ni.com for technical support and professional services:
•
Support—Technical support at ni.com/support includes the
following resources:
–
Self-Help Technical Resources—For answers and solutions,
visit ni.com/support for software drivers and updates,
a searchable KnowledgeBase, product manuals, step-by-step
troubleshooting wizards, thousands of example programs, tutorials,
application notes, instrument drivers, and so on. Registered
users also receive access to the NI Discussion Forums at
ni.com/forums. NI Applications Engineers make sure every
question submitted online receives an answer.
–
Standard Service Program Membership—This program entitles
members to direct access to NI Applications Engineers via phone
and email for one-to-one technical support as well as exclusive
access to on demand training modules via the Services Resource
Center. NI offers complementary membership for a full year after
purchase, after which you may renew to continue your benefits.
For information about other technical support options in your
area, visit ni.com/services or contact your local office at
ni.com/contact.
•
© National Instruments Corporation
System Integration—If you have time constraints, limited in-house
technical resources, or other project challenges, National Instruments
Alliance Partner members can help. The NI Alliance Partners joins
system integrators, consultants, and hardware vendors to provide
comprehensive service and expertise to customers. The program ensures
qualified, specialized assistance for application and system
development. To learn more, call your local NI office or visit
ni.com/alliance.
A-1
Introduction to NI ELVIS
Appendix A
Additional Information and Resources
If you searched ni.com and could not find the answers you need, contact
your local office or NI corporate headquarters. Phone numbers for our
worldwide offices are listed at the front of this manual. You also can visit the
Worldwide Offices section of ni.com/niglobal to access the branch
office Web sites, which provide up-to-date contact information, support
phone numbers, email addresses, and current events.
Other National Instruments Training Courses
National Instruments offers several training courses for NI ELVIS users.
These courses continue the training you received here and expand it to other
areas. Visit ni.com/training to purchase course materials or sign up for
instructor-led, hands-on courses at locations around the world.
National Instruments Certification
Earning an NI certification acknowledges your expertise in working with
NI products and technologies. The measurement and automation industry,
your employer, clients, and peers recognize your NI certification credential
as a symbol of the skills and knowledge you have gained through
experience. Visit ni.com/training for more information about the
NI certification program.
NI ELVIS Resources
You can find additional information about NI ELVIS at ni.com/nielvis.
Introduction to NI ELVIS
A-2
ni.com