signal acquisition

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,

Upload: srinath-vaddepally

Post on 08-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 1/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 programcan 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 otherend of the BNC cable to the light probe.

Step 1: Ignore all Windows security screens when loading LabVIEW. OpenLabVIEW 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,

Page 2: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 2/9

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 theBlock 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.

Page 3: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 3/9

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 theconfiguration tab match the above picture.

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

Figure 3: NI-Scope Express VI Trigger Menu

Page 4: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 4/9

 

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

Page 5: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 5/9

 

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 tooverwrite this path.

Step 4: Connect the Signal output from the NI-SCOPE Express VI to the SignalsInputs 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 inputsand 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.

Page 6: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 6/9

 

Step 6: Right click on the wire connecting all the Signal inputs and outputstogether, 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. Afterthis 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

Page 7: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 7/9

Page 8: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 8/9

  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 theabsolute 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 differentcolors 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

Page 9: Signal Acquisition

8/7/2019 Signal Acquisition

http://slidepdf.com/reader/full/signal-acquisition 9/9

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 useAlt+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 youobtained. After ensuring that your names are on it, give the stapled sheetsfrom Parts 1 and 2 to your TA.