Você está na página 1de 9

ENG H192 HANDS-ON LAB 1

Part 2: Acquisition of a Signal with LabVIEW

Purpose: In this part of the lab you will be using LabVIEW and a data acquisition
computer card to sense the pulse width of the shutter of a disposable
camera and record the data to the computer’s hard disk. After the program
can correctly save the data to the hard drive, you will add some analysis to
the LabVIEW program

Set-up: If your station is not already set up, connect the BNC cable to Channel 0
of the DAQ card, found at the back of the computer. Connect the other
end of the BNC cable to the light probe.

Step 1: Ignore all Windows security screens when loading LabVIEW. Open
LabVIEW 7.1 and click on the “New” button. From the menu that opens
select “Blank VI” and click “OK”. Two different windows will appear the
“Front Panel” and the “Block Diagram”. The Front Panel is where you
will interact with the LabVIEW data acquisition systems, while the Block
Diagram is where you will connect in software the various pieces of your
system. There are two palettes available for building a VI. The functions
palette is only available when accessing the Block diagram, and the
Controls palette is only available when accessing the Front panel. For
most of the lab we will be using the block diagram. In order to put parts
of our system together we use the “Functions Palette” which is shown
below in figure 1.

Figure 1: Functions Palette

If the palette is not visible when you start LabVIEW you can right click at
any time in a blank space on the block diagram to make it appear. Bring
up the Functions Palette at this time.

Step 2: View the Block Diagram window. On the Functions Palette, click the
Input Icon. A new set of options should appear. From the Input menu,
click on the “NI-SCOPE” Icon. This is what is called an “Express Virtual
Instrument” or “Express VI.” Place the NI-Scope Express VI on the
Block Diagram. After a few moments the following screen should come
up.

Figure 2: NI-Scope Express VI Configuration Menu

This is where you will configure the hardware that will capture the data.
On the right hand side of the menu, change the Sample Rate to 5M. This
will cause the computer to sample data 5 million times a second.
Additionally, underneath Sample rate, chance the Record length to 150k.
This means that the system will record 150,000 data points before
stopping. Change the Range to 5 (V). Make sure all other options on the
configuration tab match the above picture.

Click on the Trigger tab just below the graph. You should see the
following menu on your screen:

Figure 3: NI-Scope Express VI Trigger Menu


Change the “Type” Option to Edge and the “Ref position” to 30. This
refers to where on the output graph the data will appear. Change the Level
to 1.2 (V). This is the level that the voltage must reach to register as a
trigger. Make sure all other options match the above picture.

Click OK.

Step 3: From the Functions Palette, add the Express VIs of “Statistics”
(Analysis>>Statistics) and “Write LabVIEW measurement file” or “Write
LVM” (Output>>Write LVM). These should be configured as in the
following screenshots, with the addition of Maximum as an option.
Make sure you check the box next to maximum.

Figure 4: Statistics Express VI Configuration Menu


Figure 5: Write LabVIEW Measurement file Express VI Configuration Menu

Note that the file name might be the same as you see in Figure 5. This is
just the default path. In the next steps we will create the option to
overwrite this path.

Step 4: Connect the Signal output from the NI-SCOPE Express VI to the Signals
Inputs of the Statistics and Write LabVIEW Measurement File express
VIs.

Step 5: Right click on the “File Name” input to the Write LabVIEW Measurement
File Express VI. You can find this by scrolling the mouse over the input
arrows. You can also pull down the bottom of the VI and a list of inputs
and outputs will appear. Ask your TA if you cannot get this to work. The
name of the input, or output, will pop up. Select Create>>Control from
the menu. Notice how a control is placed on both the Block Diagram and
the Front Panel.
Step 6: Right click on the wire connecting all the Signal inputs and outputs
together, created in step 4. From the menu select Create>>Graph
Indicator. Notice that a waveform indictor has been placed on the Block
Diagram and its corresponding graph on the Front Panel.

Step 7: Repeat step 6 on the three outputs of the Statistics Express VI but instead
of making them Graph Indicators, make them Numeric Indicators. After
this step your Block Diagram and Front Panel should look like the
following screenshots, with an additional numeric indicator for the
voltage maximum.

Figure 6: Block Diagram of the finished LabVIEW program


Figure 7: Front Panel of the finished LabVIEW program

Step 8: You are now ready to acquire a signal. Use the following instructions to
capture the shutter speed of the camera.

 First, wind the camera shutter mechanism, using the blue wheel. (If you need
help ask your TA)
 Turn on the flashlight and point it directly into the camera lens.
 Hold the light probe inside the camera carefully lining it up with the lens.
 While holding the light probe button down, press Run in the upper left-hand
side of the block diagram or front panel. Then press and release the shutter
button
 Release the light probe button and remove the light probe from the camera
 You may need to do this a few times to get good results, as shown in Figure 8.

Figure 8: Front Panel with Shutter Pulse

Step 9: Now that you have the data you can draw some conclusions from it. The
total pulse width should be the absolute value of the first time minus the
absolute value of the last time. This may not always work, though,
because of noise in the system. We will also add cursors to the plot to
verify the shutter time.

Step 10: Right click on the graph and choose “Properties.” Under the Cursor tab,
add two new cursors. Name them appropriately, and choose two different
colors to make manipulation easier. Also, under the “Formats and
Precision” tab, choose “Relative Time” with format HH:MM:SS (3 or 4
digits of precision). Click “OK.”

Step 11: You should now see the cursor information on the Front Panel. If you
don’t, write click on the graph and choose Visible Items >> Cursor
Legend. Additionally, on the graph you will see colored lines, usually in
the lower left hand corner. These lines identify where the cursors are.
Carefully select one cursor and drag it to the first or last edge of pulse
(depending on which one you chose). Drag the other cursor to the other
edge. Note the location of the cursors, as shown in the cursor bar.
Determine the shutter speed. Print this screen shot. You can use
Alt+Print Screen, then paste it to a Word document.

Figure 9: Front Panel with cursors. X-axis may be have the same format.

Step 12: Print the front panel and by hand add the value of the pulse width that you
obtained. After ensuring that your names are on it, give the stapled sheets
from Parts 1 and 2 to your TA.

Você também pode gostar