Download Studying Characteristic Curves with LabVIEW

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Analog-to-digital converter wikipedia , lookup

Galvanometer wikipedia , lookup

Test probe wikipedia , lookup

Nanofluidic circuitry wikipedia , lookup

Integrating ADC wikipedia , lookup

Valve RF amplifier wikipedia , lookup

Josephson voltage standard wikipedia , lookup

CMOS wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Power electronics wikipedia , lookup

Multimeter wikipedia , lookup

TRIAC wikipedia , lookup

Wilson current mirror wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

Schmitt trigger wikipedia , lookup

Operational amplifier wikipedia , lookup

Electrical ballast wikipedia , lookup

Voltage regulator wikipedia , lookup

Surge protector wikipedia , lookup

Power MOSFET wikipedia , lookup

Ohm's law wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Current source wikipedia , lookup

Network analysis (electrical circuits) wikipedia , lookup

Rectiverter wikipedia , lookup

Opto-isolator wikipedia , lookup

Current mirror wikipedia , lookup

Transcript
NAME ______________________________
EET 2259 Lab 11
Studying Characteristic Curves with LabVIEW
OBJECTIVES
-Use LabVIEW to measure DC current.
-Write LabVIEW programs to display the characteristic curves of resistors, diodes, and
transistors studied in previous electronics courses.
Part 1. Using LabVIEW to Measure Current
Up to now, you’ve used LabVIEW to measure voltage, but not current. In fact, the myDAQ
cannot directly measure current. But we’ll use a standard trick to make indirect current
measurements. The trick is to insert a small resistor of known value into our circuit, then
measure the voltage across the resistor, and then use Ohm’s law (I = V  R) to compute the
current. This new resistor is often called a sensing resistor.
First, use your knowledge of DC circuits to
answer this question: In the circuit shown here,
suppose the voltage source is 10 V, and
R1 = 10 kΩ, R2 = 20 kΩ, and R3 = 20 kΩ.
How much current will pass through R3?
R1
R2
R3
R2
R3
________________
Now let’s think about how to use the myDAQ
to measure the current through resistor R3.
Using the trick mentioned above, we’ll insert a
sensing resistor in series with R3, then measure
this new resistor’s voltage drop, and then use
Ohm’s law to find the current through the new
resistor. Since the new resistor is in series with
R3, this computed current must be equal to
R3’s current.
R1
Rsense
Notice several important points:
 By inserting a new resistor, we’re changing the circuit, and therefore changing the current
that we’re trying to measure. But if we choose Rsense to be much smaller than the other
resistors, then the change that we introduce will be very small.

We must be sure to place the sensing resistor in series with the component whose current
we’re trying to measure. In the circuit above, if we inserted the sensing resistor between
the voltage source and R1, then we’d be measuring R1’s current, not R3’s current.

You might wonder why we should insert a new resistor at all. For example, if we want to
know R3’s current, then why not just measure R3’s voltage and divide by R3’s resistance
to find the current? That’s a smart idea, and in some cases it will give us an acceptable
answer. But here are two possible drawbacks to doing it this way:
EET 2259 Lab 11 – Page 1
Revised 12/23/2016
a. Sometimes the component whose current we’re trying to find is not a resistor. It
might be a diode or a transistor. Ohm’s law does not apply to such components,
but we can still use our trick by inserting a small sensing resistor in series with
the component.
b. Most resistors in most circuits are not precision resistors, so we probably only
know their resistance value to within 5%. And this resistance value can vary
with time, temperature, and applied voltage. By using a precision sensing
resistor whose resistance is constant to within 1% (or even better), we can get
more accurate results.
Let’s put our trick to work in the circuit above.
Hardware Setup:
1. Build the circuit (including the sensing resistor, whose value is 10 Ω) on a breadboard.
For the DC voltage source, do not use a power supply; rather, use the myDAQ’s analog
output AO0. In other words, use the myDAQ’s AO0 terminal for the voltage source’s +
terminal in the diagram above, and use the myDAQ’s AGND terminal for the  terminal.
2. Run wires from the two ends of the sensing resistor to the myDAQ’s AI0+ and AI0−
analog inputs. Observe the correct polarity; in other words, connect the more positive
end of the resistor to AI0+ and the more negative end to AI0−. Do not connect jumper
wires between the myDAQ’s AGND terminal and any of its other terminals.
LabVIEW Program:
3. Create a new VI whose front panel contains a numeric indicator labeled I3. Configure it
to display values in engineering notation, rounded to 3 significant digits.
4. On the block diagram place a DAQ Assistant inside a loop with a 10-millisecond delay.
This DAQ Assistant’s job is to generate the source voltage, so configure it to perform an
analog output of 10 V.
5. Inside the loop place another DAQ Assistant, whose job will be to measure the current.
In this DAQ Assistant’s dialog box, choose Acquire Signals > Analog Input > Current.
Then select input channel ai0 and click Finish.
a. The dialog box for configuring the DAQ Assistant should look familiar, but
notice that it has two boxes you haven’t seen before: one labeled Shunt Resistor
and one labeled Resistor Value (ohms). The term shunt resistor is another name
for a sensing resistor. LabVIEW knows that to measure current, we’ll be playing
our little trick of inserting a sensing resistor. When we run this VI, LabVIEW
will take the measured voltage across this sensing resistor and divide by its
resistance, to compute the current. In other words, it will automatically do the
Ohm’s law calculation (I = V  R) for us and then report the answer.
b. Make sure that Shunt Resistor is set to External, and set Resistor Value (ohms)
to 10.
c. As usual, change Acquisition Mode to 1 Sample (On Demand).
d. Click the OK button.
6. Wire the DAQ Assistant’s data terminal through a From DDT to your numeric indicator.
EET 2259 Lab 11 – Page 2
Revised 12/23/2016
7. Run the VI. The displayed value should be very close to the current that you predicted
above. Save this VI as Lab11MeasureDCCurrent.vi and show me your working
program.
________
Part 2. Characteristic Curves of Passive Linear Components
An electronic component’s I-V curve or characteristic curve is a graph plotting the
component’s current (on the vertical axis) versus the component’s voltage (on the horizontal
axis). For example, the following figure, taken from your DC Circuits textbook, shows that a
resistor’s I-V curve is a slant line.
On the other hand, a transistor is a more complicated device. A family of characteristic curves
for a transistor shows how its collector current (IC) varies with its collector-emitter voltage (VCE).
The following figure from your Electronics textbook is typical.
In your previous courses you have performed labs in which, by taking many measurements by
hand, you were able to plot a component’s I-V curve. But we can use LabVIEW to automate this
process and quickly plot the curve.
Here’s an outline of the general procedure we’ll use to plot a component’s characteristic
curve.
EET 2259 Lab 11 – Page 3
Revised 12/23/2016
A. Connect a sensing resistor in series with the component.
B. Using an analog-out DAQ Assistant, generate a voltage across the series combination
(resistor-plus-component).
C. Using an analog-in DAQ Assistant, measure the voltage across the component and
the current through the sensing resistor (which equals the current through the
component). This pair of measurements provides one data point on the characteristic
curve.
D. Collect additional data points by repeating steps B and C several times, changing the
output voltage from the analog-out DAQ Assistant each time.
E. Create a table that lists the data values. Also plot the data points on an XY graph
(with voltage on the horizontal axis and current on the vertical).
Let’s start by plotting the characteristic curve of a 4.7-kΩ resistor.
Hardware Setup:
1. On a breadboard, place a 4.7-kΩ resistor in series with a 10-Ω sensing resistor. For the
DC voltage source across this series combination, use the myDAQ’s analog output AO0
rather than a power supply.
2. Observing the correct polarity, run wires from the ends of the sensing resistor to the
myDAQ’s AI0+ and AI0− analog inputs.
3. Observing the correct polarity, run wires from the ends of the 4.7-kΩ resistor to the
myDAQ’s AI1+ and AI1− analog inputs. Do not connect jumper wires between the
myDAQ’s AGND terminal and any of its other terminals.
LabVIEW program:
4. Create a new VI whose front panel contains a 2-D array of numeric indicators and an
Express XY Graph. Resize the array and make its vertical scrollbar visible, as shown
below. Also change the labels on the array and graph to match the ones shown below.
Also, configure your numeric indicators to display their contents in engineering notation
with 3 significant digits.
EET 2259 Lab 11 – Page 4
Revised 12/23/2016
5. Wire the VI’s block diagram to look like the one shown below. Most of this should be
familiar to you from previous programs, but read on for discussion of a few unfamiliar
points.
6. Note that the first DAQ Assistant’s error out output is wired to the second DAQ
Assistant’s error in input. This technique is commonly used in LabVIEW to ensure that
two pieces of code execute in a particular order. In this program, we want to make sure
that each time through the loop we first set the source voltage (with DAQ Assistant #1),
and then make our measurements (with DAQ Assistant #2). A sequence structure is
another way to force code to execute in a particular order, but using error wires is
considered better programming practice.
7. There’s nothing new or unusual about the way DAQ Assistant #1 is configured; it’s just
set up to perform analog voltage output on channel AO0.
8. DAQ Assistant #2 is configured to perform both a voltage measurement and a current
measurement. Here’s how to set up this DAQ Assistant:
a. Place a DAQ Assistant on the block diagram. When its dialog box comes up,
select Acquire Signals > Analog Input > Voltage. Then select channel ai1, and
then press the Finish button.
b. On the next screen, set Acquisition Mode to 1 Sample (On Demand). But don’t
press the OK button yet.
c. Near the top of this screen, press the blue plus sign labeled Add Channels.
d. From the drop-down menu that appears, select Current. Then select channel
ai0, and press the OK button.
e. In the resulting screen (shown below) notice that the Channel Settings box
(halfway down on the left side) lists two measurements: Voltage and Current.
In the picture below, Current is highlighted; therefore, the settings visible to the
right are for this current measurement. If you wanted to change the settings for
the other measurement, you would click the word Voltage. Try switching back
and forth between Voltage and Current, and notice how the settings to the right
change when you do this.
EET 2259 Lab 11 – Page 5
Revised 12/23/2016
f.
For the current measurement, make sure that Shunt Resistor is set to External.
Change Resistor Value (ohms) to 10. Then press the OK button to close the
DAQ Assistant’s configuration screen.
9. Returning to the block diagram shown on the previous page, there’s one more new
feature. Notice that, although DAQ Assistant #2 is configured to perform two
measurements, there’s only one data output coming out of the DAQ Assistant. The data
for our two measurements are packed together onto a single wire. How do we separate
them from each other? We do this by choosing the correct settings in the From DDTs
that we connect to the DAQ Assistant. This is why I’ve wired a 0 into the Channel input
on the first From DDT, but I’ve wired a 1 into the Channel input on the second From
DDT. (You could do the same thing by changing the value in the Channel box on the
From DDT’s dialog box, as shown below.)
By the way, do not confuse these channel numbers (0 and 1) with the physical
channels of the measurements (ai0 and ai1). The From DDT doesn’t know or care
about physical channels on the myDAQ. It only knows that the output from the DAQ
EET 2259 Lab 11 – Page 6
Revised 12/23/2016
Assistant carries data for two measurements. It calls one of these Channel 0 and the
other one Channel 1.
10. You should now be able to finish wiring the block diagram shown a couple of pages ago.
11. Run the program, and you should find that the graph of the data points is a line rising to
the right, as in the characteristic curve for a resistor on page 3 of this lab. You should
also find that the 2-D array on the VI’s front panel contains 101 pairs of voltage and
current values. On most rows in the array (particularly after the array’s first 20 or so
rows), dividing the voltage by the current should give a result close to your resistor value.
(Remember that, for a resistor, V  I = R.) Get a printout of the front panel, and turn it
in with this lab.
12. Save this VI as Lab11ResistorCharacteristicCurve.vi and show me your working
program.
________
Part 3. Characteristic Curves of Diodes
As you know from previous courses, a diode is a non-linear device, so its characteristic curve
is not a slant line like the one you just obtained for a resistor. But the LabVIEW program that
you just wrote for resistors can also be used to plot a diode’s characteristic curve. In fact,
with a minor modification that we’ll make below, this program can be used to plot the
characteristic curve of any two-terminal device.
Hardware Setup:
1. On a breadboard, build the circuit shown below, using a general-purpose rectifier diode
such as a 1N4003. Note that this circuit contains two resistors. One of these is our 10ohm sensing resistor, which serves the same purpose here as in previous circuits. The
other, larger resistor’s purpose is to limit the circuit’s current so that we don’t burn out
the diode (and also so that we don’t exceed the myDAQ’s current-producing abilities).
As in previous circuits, use the myDAQ’s analog output AO0, instead of a power supply,
for the DC voltage source.
2. Observing the correct polarity, connect wires from the ends of the sensing resistor to the
myDAQ’s AI0+ and AI0− analog inputs.
3. Observing the correct polarity, connect wires from the ends of the diode to the myDAQ’s
AI1+ and AI1− analog inputs. You do not need to connect jumper wires between the
myDAQ’s AGND terminal and any of its other terminals.
EET 2259 Lab 11 – Page 7
Revised 12/23/2016
LabVIEW program:
4. As mentioned above, the same program that we used for our resistor’s characteristic
curve will also work for the diode. So run the program now. The resulting curve on the
graph should look familiar from your study of diodes.
5. Show me your working program._____________
6. Notice that our program starts with a source voltage of 0 V and then gradually increases it
to +10 V. It might be interesting to include some negative voltages as well as positive
voltages. Before modifying the program to do this, let’s think about how this will change
the appearance of our plotted curve. Based on your knowledge of diodes, approximately
how much current flows through a standard diode when it is reverse-biased (in other
words, when its anode is more negative than its cathode)?
_______________________________
7. Based on the answer you just gave, you should be able to picture what the diode curve
will look like if we extend it to the left, into negative-voltage territory. Sketch your
predicted curve below, including horizontal and vertical axes with labels.
8. Save a copy of your program, naming it Lab11TwoTerminalCharacteristicCurve.vi .
Then modify the program so that instead of varying the source voltage from 0 V to 10 V
in 0.1 V steps, it varies the source voltage from -10 V to 10 V in 0.1 V steps.
9. Run the program, and see whether it matches your predicted curve. Get a printout of the
front panel, and turn it in with this lab.
10. Save this VI as Lab11TwoTerminalCharacteristicCurve.vi and show me your
working program.
________
11. Now replace the 1N4001 general-purpose diode with a 1N4735 zener diode, which has a
breakdown voltage of about −6.2 V. Based on your understanding of zener diodes, you
should be able to picture what this diode’s curve will look like.
12. Run the program. Get a printout of the front panel, and turn it in with this lab. Show me
your working program.
________
EET 2259 Lab 11 – Page 8
Revised 12/23/2016
Part 4. Characteristic Curves of Transistors
Before we modify our program to draw transistor characteristic curves like the one on page 3
of this lab, let’s think about how such a program will have to differ from the one we’ve got
right now. The main difference is that in our existing program, there’s only one voltage that
we need to vary: namely, the voltage across the entire series circuit. So we needed one DAQ
Assistant to produce this varying voltage, and another DAQ Assistant to measure the current
and voltage values that we plotted as the characteristic curve.
To plot a transistor’s characteristic curves, we need to vary two voltages independently of
each other: the transistor’s base supply voltage VBB and its collector supply voltage VCC. This
is clear from the figure below from your Electronics textbook, which shows that VBB and VCC
are both variable voltage sources.
From your previous courses you should recall that by leaving VBB set to a particular value and
varying VCC from 0 to some maximum value, we get the data points that make up a single
collector curve. Then by setting VBB to another fixed value and again varying VCC from 0 to
some maximum value, we get the data points that make up a second collector curve. And so
on. For example, the figure below shows seven collector curves, each of which was obtained
by varying VCC while VBB was set to a fixed value.
Here’s an outline of the general procedure we’ll use to plot a family of transistor
characteristic curve. (Compare this to our earlier, simpler outline on page 4.)
EET 2259 Lab 11 – Page 9
Revised 12/23/2016
A. Build the circuit shown in figure (a) above, inserting a sensing resistor in series with
the collector resistor.
B. Using an analog-out DAQ Assistant, generate a value for VBB. (This voltage will
remain constant through steps C, D, E, and F below.)
C. Using another analog-out DAQ Assistant, generate a value for VCC.
D. Using an analog-in DAQ Assistant, measure the collector-emitter voltage VCE and the
collector current IC. This pair of measurements provides one data point on one
collector curve.
E. Collect additional data points for this collector curve by repeating steps C and D
several times, using the second analog-out DAQ Assistant to vary VCC each time.
F. Plot the data points on an XY graph (with VCE on the horizontal axis and IC on the
vertical). This completes one collector curve.
G. Create and plot additional collector curves by repeating steps B through F several
times, using the first analog-out DAQ Assistant to vary VBB each time.
If you followed that verbal statement of our task, it should be clear that we’ll need a For Loop
within a For Loop: steps C through E form an inner loop in which we’re varying the value of
VCC each time through the loop. Steps B through G form an outer loop in which we’re
varying the value of VBB each time through the loop.
Your existing program called Lab11ResistorCharacteristicCurve.vi already provides the
inner loop (steps C through E) and step F. To see that the existing program will plot a single
characteristic curve, follow these steps.
Hardware Setup:
1. On a breadboard, build the circuit shown on the previous page, using the following
values:
 RB = 470 kΩ
 RC = 220 Ω, and also insert your 10 Ω sensing resistor in series with RC
 VBB = 5 V from the myDAQ’s +5V terminal
 VCC = the myDAQ’s analog output AO0
 transistor = 2N3904
2. Make sure that you haven’t shorted either supply voltage to ground. Ask me to check
your circuit before proceeding.
3. Observing the correct polarity, connect wires from the ends of the sensing resistor to the
myDAQ’s AI0+ and AI0− analog inputs.
4. Observing the correct polarity, connect wires so that the myDAQ’s AI1 measures the
transistor’s VCE. (Connect the collector to AI1+ and connect the emitter to AI1−.) Do
not connect jumper wires between the myDAQ’s AGND terminal and any of its other
terminals.
LabVIEW program:
5. Save a copy of Lab11ResistorCharacteristicCurve.vi, naming this new copy
Lab11TransistorCollectorCurves.vi.
6. Run the program, and you should see a single collector curve plotted on the XY graph.
EET 2259 Lab 11 – Page 10
Revised 12/23/2016
7. Show me your working program._____________
Now we need to add a big outer loop to implement steps B and G of the algorithm on the previous
page. First, we need to change the hardware so that LabVIEW can vary the base supply voltage
VBB, instead of using a fixed 5 V as we did above.
Hardware Setup:
1. Remove the wire connecting the transistor’s base resistor to the myDAQ’s +5V terminal.
2. In place of this wire, connect the transistor’s base resistor to the myDAQ’s analog output
AO1.
3. Make sure that you haven’t shorted either supply voltage to ground. Ask me to check
your circuit before proceeding.
LabVIEW program:
4. We no longer need to see a list of values on the front panel, so delete the 2-D array of
numeric indicators on the front panel, and delete any associated code on the block
diagram.
5. On your block diagram, add a For Loop that completely surrounds the existing For Loop
(but doesn’t surround the XY graph and the To DDTs connected to it).
6. The previous step will break the wires going into the To DDTs. To fix this, edit the To
DDTs and change their Input data type to 2D array of scalars – rows are channels. By
making this change, you’re telling the To DDTs that they are being passed a 2D array of
numbers, and that each row of this 2D array should be plotted as a separate plot.
7. In the outer loop, place a DAQ Assistant and configure it to produce an analog output
voltage on channel ao1. (Recall that this is the output channel connected to the
transistor’s base resistor.)
8. To ensure that the new DAQ Assistant runs before the inner loop, wire the new DAQ
Assistant’s error out output to the error in input of the first DAQ Assistant inside the
inner loop.
9. Add code that will cause the outer loop to run five times, increasing the new DAQ
Assistant’s voltage from 1 V to 5 V in 1 V steps.
10. Run the program, and you should get a family of collector curves similar to the ones
shown earlier. Get a printout of the front panel, and turn it in with this lab.
11. Save this VI as Lab11TransistorCollectorCurves.vi and show me your working
program.
________
*** This lab had 4 named programs for me to check. If you didn’t finish all of these during
class, finish them after class. Then upload all 4 programs, along with any related subVIs,
to the website by the due date. Also turn in your lab sheets at the beginning of class.****
EET 2259 Lab 11 – Page 11
Revised 12/23/2016