Professional Documents
Culture Documents
Introduction to NI ELVIS
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
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
Lesson 1
NI ELVIS II Workspace Environment
Exercise 1-1 Measuring Component Values .........................................................1-3
Exercise 1-2 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 Measurement of the Circuit Component Values ..............................3-3
Exercise 3-2 Measurement of Component and Circuit Impedance Z ...................3-4
Exercise 3-3 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
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 Testing Diodes and Determining Their Polarity ..............................7-3
Exercise 7-2 Characteristic Curve of a Diode .......................................................7-5
Exercise 7-3 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 The Transmitter ................................................................................9-3
Exercise 9-2 The Receiver.....................................................................................9-4
Exercise 9-3 Testing the RF Transmitter and Receiver.........................................9-5
Exercise 9-4 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
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 Multisim Dice Display Using Seven LEDs......................................11-5
Exercise 11-2 Converting a Multisim Design into a Real Circuit...........................11-6
Exercise 11-3 A Modulo 6 Counter.........................................................................11-7
Exercise 11-4 Convert the Mod 6 Multisim Design into a Real Circuit .................11-10
Exercise 11-5 Building the System Clock...............................................................11-11
Exercise 11-6 Building a Real Clock Circuit on an NI ELVIS II Protoboard.........11-13
Exercise 11-7 Building the Three- to Four-Line Encoder.......................................11-14
Exercise 11-8 Building and Testing the Digital Dice Encoder ...............................11-16
Exercise 11-9 Electronic Dice .................................................................................11-17
Appendix A
Additional Information and Resources
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.
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.
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.
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.
Required Components
• 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
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:
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.
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?
I (calculated) ________________
I (measured) ________________
4. How well does the measured value match your calculated 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.
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!
Note 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.
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.
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.
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.
R1 R2 R3 R4 Voltage
0 0 0 0 0.00
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
1 1 1 1 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.
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.
You can now repeat your measurements of the predicted voltage readings
when a window or a door is opened or closed.
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.
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.
Launch LabVIEW and open the program House.vi for a unique view of the
burglar alarm system.
Figure 1-15. The LabVIEW Block Diagram for the Program House.vi
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.
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.
Required Components
• 10 kΩ resistor, R1, (red, black, orange)
• 10 kΩ thermistor, RT
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.
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.
Note 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].
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.
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.
To VPS[+]
10 k Ω
To DMM
Thermistor
To Ground To Gnd
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.
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.
All of these actions occur within the while loop until you click the [Stop]
button on the front panel.
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).
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!
Load the LabVIEW program Linear Fit.vi. Fill in all the blank data
locations in the input array and click on RUN.
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.
T = (R – b)/m
Figure 2-14. Front Panel for calibration VI for Linear RTD Type TD5A
Goal
This lab introduces the NI ELVIS II tools for AC circuits: a digital
multimeter, function generator, oscilloscope, impedance analyzer, and Bode
analyzer.
Required Components
• 1 kΩ resistor, R, (brown, black, red)
• 1 μF capacitor, C
XC = 1/jωC
Z = R + XC = R + 1/jωC Ω
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.
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.
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.
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.
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.
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.
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.
View an example data set like the one below when you click the Log button
after a frequency scan.
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.
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.
Required Components
• 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
C1 ___________ μF (1 μf nominal)
Figure 4-2. Schematic Diagram of a 741 Inverting Op Amp Circuit with a Gain of 10
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.”
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.
Note The output signal is inverted as expected with respect to the input signal.
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:
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.
2πfL = 1/(RC)
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)
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)
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.
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)?
Vout = –(Zf/Z1)Vin
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.
Note 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.
–R3 ⁄ ( R1 + R2 )
G = ------------------------------------
2
1 + (f ⁄ fc)
2. Pick resistors and capacitors to satisfy the special case requirement that
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.
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 Components
• 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
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.
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.
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.
Note 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.
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.
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.
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.
F = 1/T (Hz)
The 555 timer oscillator circuit has a Duty Cycle (On time/period) of
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)
DC = __________________
F = __________________ (Hz)
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.
A binary counter has a unique timing diagram where the falling edge of the
previous bit causes the next bit to toggle.
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.
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.
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.
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.
X
B in
I I
X
–––––––––––––
F
X
X
– –q
X
X
Vd
+++++++++++++
X
X
I
X
X
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.
Required Components
• Small magnet
• Linear magnetic field sensor: Allegro A3240UA or equivalent
• Hall effect switch: Allegro A3212UA or equivalent
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.
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.
h = Bmax – Bmin
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
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.
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.
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.
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.
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.
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.
Required Components
• Silicon diode
• Six LEDs (2 red, 2 yellow, and 2 green)
• Six 220 Ω resistors
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).
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).
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.
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.
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 The resistor is used to limit the current through the LED.
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
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.
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.
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.
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.
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.
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.
Required Components
• 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
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.
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.
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
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.
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.
To demonstrate the modulation scheme, use a 1.0 kHz tone burst so it is easy
to see on the oscilloscope.
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.
Figure 8-9. Tone Burst Oscillator Controlled from a Digital Line (red lead)
How can you improve the bit rate performance? Change the components in
the design to generate a high-speed digital optical link.
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.
Required Components
• 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
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.
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.
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:
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.
beep-beep-beep-pause-beep-beep-beep-pause
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 Components
• 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
Emitter Detector
+5V
+
1kΩ 10 k Ω To ACH4
-
Gnd
3. Select Scope from the NI ELVISmx Instrument Launcher and select the
settings, 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.
VPS+
Emitter Detector
+5V
Gnd
+
12 V DC Motor
1kΩ 10 k Ω To ACH 4
-
Gnd
Note 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.
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.
Note 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.
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.
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
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.
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.
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.
Required Components
• 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)
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.
Die face A B C D
1 ✓
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
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.
Note These LEDs are active low, that is, setting the lines (A..D) LO turns on the selected
base set of LEDs.
Verify your circuit design follows the truth table in Table 11-1.
Note 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.
By switching back and forth, you can easily compare your Multisim design
with the real circuit on the NI ELVIS II protoboard.
Q1 Q2 Q3
D Q D Q D Q
Q Q Q
clock
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.
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
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.
Note These LEDs are active HI, that is, a HI state turns the LED on.
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.
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.
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.
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.
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.
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.
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.
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.
NI ELVIS Resources
You can find additional information about NI ELVIS at ni.com/nielvis.