MyDAQ Assignment - Department of Electrical, Computer, and

Transcription

MyDAQ Assignment - Department of Electrical, Computer, and
ECEN 2250
1
Spring 2015
MyDAQ Assignment
Introduction
MyDAQ is a device made by National Instruments (DAQ stands for Data AcQuisition) that can be
attached to a computer and used to make electrical measurements. The purpose of this MyDAQ
assignment is twofold: to familiarize yourself with the MyDAQ and several of its functionalities,
as well as to gain experience in writing a technical report. Engineering is a collective endeavor:
you may collaborate with others in discussing the assignment and carrying out the measurement.
However, the typed assignment that you turn in must be the product of your own writing. If
measurements were made as a group, include an acknowledgment of the other participants.
Everything you need for this assignment should be contained in the MyDAQ kit available at
the EStores (ask for a little wire there if you need it). This kit must be returned at the end of the
semester. If you do need to buy or borrow a few items for this experiment, feel free to share the
very small expense that might be involved.
In this homework you will design a low pass filter using a series RC voltage divider circuit.
This circuit could be used as a way to attenuate the high frequencies in an audio signal, and drive
a woofer (a speaker with a low-frequency response). You will test the response of your circuit using
a frequency generator, and an mp3 player or other audio source.
2
The Project Report
2.1
How long will it take?
The meaningful work for this assignment should take between three to six hours to complete.
Because a formal written report is required, you should make sure that the experimental part is
working properly. Please do not procrastinate: experiments always take more time than expected.
2.2
Format Requirements for the Report
Your report should be typed (not handwritten) in MS Word, or in LATEX. It should be organized
as follows:
1. Introduction (why was the work done?)
2. What was done
3. The measured results (present the data only, not interpretation)
4. Discussion of the results (what do they mean?)
5. Conclusion (global summary of what was done and its significance, maybe also what further
work might be done)
1
All the questions that are asked in the assignment must be answered somewhere in the report.
All measured data must be included (many of these will be screen captures and embedded in your
report). Circuit diagrams should be made with a drawing program such as Inkscape (freeware) or
those included in MS Office, OpenOffice and so on. The assignment report should be turned in as
paper printout, not electronically.
3
3.1
myDAQ How-to Guide
Getting Familiar with the MyDAQ
Leland Au, UC Berkeley
Components
Kit Materials (from the box):
The plug board is in the kit obtained from EStores. You will● need
a 2.2 kΩ resistor and a 220nF
1 myDAQ
capacitor, which should be included in the kit. In fact, you may use any combination of resistor
● 1 male-to-male audio cable
and capacitor such that 1/RC is between 1000 and 3000 sec−1 . You will also need at least 4 pieces
● is 2sufficient.
banana cables with probes
of solid core insulated wire, 6-10 inches in length; 16-20 gauge
● 1 USB A/B cable
● 1 screw-terminal connector
3.2 The function generator and the oscilloscope
● 1 CD
Before attaching the MyDAQ to a computer, you need to install the software supplied on the DVD
● a1Mac
Certificate
of Ownership
(this contai
contained in the kit. This software runs in Windows; if you have
or use Linux,
you will have
driver
serial
to run the software in a virtual machine using something like VMWare
or license
Virtualbox.
Younumbers)
can run
the software in demonstration mode for 30 days without the ●
need 1toscrewdriver
register it. Once the software
has been installed, attach your MyDAQ to a computer using●the supplied
Run the NI
1 QuickUSB
Startcable.
Guide
Intro
ELVISmx Instrument Launcher application.
NI ELVISmx Instrument Launcher
The NI ELVISmx Instrument Launcher provides access to the
:
NI ELVISmx SFP instruments, additional featured instruments,
documentation and online resource links, and personal file access. When
Type B USB port
you install the NI myDAQ device, the NI ELVISmx Instrument Launcher
Blue LED Indicator
automatically opens. To manually open the Instrument Launcher, navigate
Basic Usage
io:
to Start»All Programs»National Instruments»NI ELVISmx for
(boldedLauncher.
numbersThis
refer to the myD
NI ELVIS & NI myDAQ»NI ELVISmx Instrument
Audio In
Figure 1: Side view of the MyDAQ.
opens the suite of LabVIEW SFP instruments.
Audio Out
To enable the myDAQ:
wer Supply:
1. Plug in one end of the USB cable to the
+15V: +15V Power Supply
other end to the top of the myDAQ (1
-15V: -15V Power Supply
2. A blue LED indicator on top of the myD
AGND: Power Supply Ground
log Input:
Using the screw terminals (5-17):
AO0: Analog Output 0
Figure 11. NI ELVISmx
● Instrument
AttachLauncher
the screw-terminal connector
Figure
2:
ELVISmx
Instrument
launcher
application.
AO1: Analog Output 1
● Insert/remove wires when the approp
To launch an instrument, click the button corresponding to the desired
AGND: Analog Input/Output Ground
● Turn the appropriate screw counterclo
instrument. Select the NI
2 myDAQ device from the Device control.
log Output:
screwdriver) to loosen.
Some instruments perform similar operations using the same resources of
● Turn the appropriate screw clockwise
AI0+: Analog Input 0, Positive Terminal
Function Generator (FGEN)
NOTE: Do
The NI ELVISmx Function Generator (FGEN) generates standard
waveforms with options for the type of output waveform (sine, square, or
triangle), amplitude selection, and frequency settings. In addition, the
offset setting,
frequency
sweep
and
NOTinstrument
connectoffers
any DC
external
source
of power
tocapabilities,
the MyDAQ.
amplitude and frequency modulation. The FGEN uses AO 0 or AO 1 on the
screw terminal connector.
Launch the Function Generator, FGEN. Note the controls and the fact that the output channel
is AO 0. Look on theThis
side
of yourhas
MyDAQ
andmeasurement
notice thatparameters:
there are a set of connectors names AO.
instrument
the following
Under AO is 1, 0, and• AGND.
The function
sends its signal to terminals AO 0 and AGND.
Output channel:
AO 0 or generator
AO 1
•
Frequency range: 0.2 Hz to 20 kHz
Figure 14. NI ELVISmx Function Generator SFP
Figure 3: Function generator.
Now launch the oscilloscope, Scope. Note that this is a two-channel scope and the default
inputs (Source) are AI 0. Notice on the side of your MyDAQ that there is a section of connectors
labeled AI. Under this are 1+, 1-, 0+, 0-, and AGND.
NI myDAQ User Guide and Specifications
22
ni.com
3
•
Trigger settings: Immediate and Edge Trigger Types are supported.
When using Edge Trigger Type, you can specify a Horizontal Position
of 0%–100%.
Figure 13. NI ELVISmx Oscilloscope SFP
Figure 4: Oscilloscope.
Connect a wire from AO 0 to 21
AI 0, making sure NI
that
you have stripped the insulation from
myDAQ User Guide and Specifications
each end. Now connect another wire from AI 0- to AGND. Press run on FGEN and then press
run on the Scope (you may need to press the autoscale button on the scope in order to show the
complete waveform at a reasonable size). Note that the scope will show a sinusoid and beneath
the trace it will indicate the frequency and peak-to-peak voltage. These should match what you
set on the function generator. Change the following settings on the scope: Scale (volts/div) and
Timebase (Time/Div). Note what happens. Take screen shots of the various settings and the
corresponding scope displays.
tional Instruments Corporation
Now, change the settings on the function generator and note the changes on the scope. First,
change the frequency on the function generator and then the amplitude. Take screenshots of
everything.
Finally, change the function generator so that it generates triangular waves and then square
waves. Note the behavior on the scope, taking screenshots as necessary.
If the signal on the scope is not steady, try changing the triggering on the scope to Edge and
use Chan 0 source.
4
•
Voltage Range:
–
For AI channels: ±10 V, ±2 V
–
For AudioInput channels: ±2 V
Figure 16. NI ELVISmx Dynamic Signal Analyzer SFP
Figure 5: The dynamic signal analyzer.
3.3
The dynamic signal analyzer
Now that you have seen how the scope and the function generator work, shut down the scope and
open the DSA (Dynamic Signal Analyzer). This instrument attempts to measure the frequency
content of the signal on its source channel. In this case the signal is AI 0.
NI myDAQ
User function
Guide and Specifications
Set the
generator
24 wave and change its frequency to ni.com
back to a sine
5000. Set the
Frequency Display units on the DSA to linear and the mode to peak and then press run on the
DSA. You will see a single spike at 5000 Hz with a y-axis reading of amplitude squared. Compare
this to the FGEN, taking screen shots as needed.
Now change the FGEN to 10 kHz, amplitude to 6 Vp-p and observe the DSA. Next, change the
frequency display units to dB. Notice the extra spikes that are appearing at multiples of 10kHz.
These are harmonics of the input signal. Still using the FGEN and the DSA, change the FGEN to
a triangular wave, set the DSA back to a Linear display. Notice the slight spike at 30kHz.
Now change the FGEN to a square wave and note where the spikes appear. Remember to take
screenshots.
The DSA is displaying the frequency content of the signals from the FGEN. This is computing
and displaying the Fourier components of the signal (you will study this in Circuits 2). Close down
the FGEN and stop the DSA.
5
Open the Scope. Use the cable with 1/8th inch stereo (TRS) plugs in your MyDAQ kit to
connect an audio source such as the output of your mp3 player, your computer, Smartphone,
etc., to the Scope. Take the output of the music player and connect it to the audio input of the
MyDAQ. Start your music, set the scope input for Channel 0 to be the Audio Input Left and run
the scope. You may need to autoscale the scope to get started. You should adjust the Scale V/Div
and the Timebase over a range of values. Make sure your selection of timebase settings goes from
100 ms to 50 µs. Take screen shots and comment on the differences and what you are actually seeing.
Stop the scope, set the input source for the DSA to Audio Input Left and run the DSA. Using
screen shots compare the display using units of dB and linear units. Also, find several selections of
music that are very different—high and low frequency, large range in volume (dynamic range), low
male singer, high female singer, glockenspiel, and so on. Using screen shots capture the differences
between the different pieces and comment on them. Stop the DSA.
4
4.1
The Experiment
Low-Pass Filter Circuit
In this section we see how a series R-C circuit can act as a low-pass filter. As we have seen in class,
if we have a voltage source, vs , in series with a resistor, R, that is in series with a capacitor, C,
and we observe the magnitude of the phasor output voltage across the capacitor, we should have
|Vc | = p
|Vs |
1 + (RCω)2
When the angular frequency ω = 1/RC, then
|Vc | = p
|Vs |
|Vs |
= √
2
1 + (1)2
We call this frequency, the “cutoff” (or sometimes, “corner”) frequency.
A reminder about frequencies is in order here: the frequencies that you manipulate here are
3
given in Hz,
√ and are equal to f = ω/2π . For instance, if 1/RC = 10 , the frequency at which
|Vc | = |Vs |/ 2 is given by
1000
f =
= 159 Hz.
2π
Make sure you compute this frequency for the particular RC combination you are using.
Build the series RC circuit on your plug board. The input signal for the circuit is AO 0, and
AGND. You will measure the output voltage using AI 0+ and AI 0-.
When the circuit has been built, launch the FGEN and the Scope. Set the FGEN to the
frequency corresponding to 1/RC (remember to convert to Hz). Set the Vp-p to 2V, i.e. a 1V
sinusoid. Set the scope to read from AO 0 by connecting wires from it to the scope input terminals.
Run the FGEN and then the Scope.
6
What value does the scope measure for voltage (remember to convert from peak-to-peak to
amplitude)? How does this compare to the theoretically expected value?
Change to a frequency on FGEN to one that is a factor of 10 lower, and note the voltage on
the scope. Do the same thing for a frequency that is a factor of 10 higher than 1/RC, again noting
the voltage on the scope. Stop the Scope and FGEN.
Compare your measurements to what you should get using the output voltage formula given
above.
4.2
How does it sound?
The last step is to take music from your music player and have this be the source voltage for your
RC circuit. The easiest way to do this is to get a stereo 1/8 inch extension cable from a store in
town and cut it in half. You may share the expense with someone in class. Do NOT cut the audio
cable supplied with the MyDAQ kit.
A challenge in trying to do this is that the wire in these cables is braided and not solid. This
makes plugging into the plug board a major difficulty. However, since you will not need the two wires
from the AO 0 and AGND you can wrap these with the braided wire and plug it into the plug board.
Alternatively, you can get a 1/8 inch plug (find one that does not require soldering) and attach
your spare wires to this. The plugs have three wires—for the ring, tip, and sleeve of the plug. The
sleeve is ground and the ring and tip represent the left and right channels. You only need to use
the ground and one of the channels.
However you have managed the audio connection, you will now send a music signal into the
RC circuit and measure the output with the DSA.
First, take a snapshot of the music signal itself. This is done by taking the wire going into AI
0+ (your measurement wire) and connecting it to the input resistor of the circuit; this puts it in
parallel with the music.
After taking a snapshot of the input signal on the DSA, move the AI 0+ wire to the capacitor.
Take another snapshot with the DSA. What is different between the two cases?
Can you explain this with our formula? Hint: this explanation requires that fact that the
music signal is composed of the sum of many different frequencies and we can treat this sum as
a superposition of signals into our circuit. You may need to take several snapshots, or explore
a variety of music before you get a significant impact on the DSA - this depends on your 1/RC
values. Also, you may want to explore the dB scale vs. the linear scale on the DSA.
7