P. 1


|Views: 89|Likes:
Published by Vikram Simha Reddy
introduction to labview
introduction to labview

More info:

Published by: Vikram Simha Reddy on Feb 06, 2013
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





University of California at Berkeley Physics 111 Laboratory Basic Semiconductor Circuits (BSC) Lab 9

©2010 by the Regents of the University of California. All rights reserved.

LabView Programming

View sections 1-5 LabView 7.1 Basic interactive training CD, or the 6 hour tutorial online available; also Review the LabView Power Point Lecture; http://socrates.berkeley.edu/~phylabs/bsc/LV_Programs/Lecture-LV_9 then click on “Modern Experimental - - -“ Entire Book on LabView Programming. Chapter 7.11 and Chapter 15.

Wells & Wells Horowitz & Hill

In this lab you will learn how to acquire data using LabVIEW, and use your knowledge to investigate Johnson Noise.

Before coming to class complete this list of tasks:
• • • • • Completely read this Lab Write-up Answer the pre-lab questions utilizing the references and this write-up Perform any circuit calculations or anything that can be done outside of lab. Begin and if possible complete programming tasks in this lab write-up Plan out how to perform Lab exercises in this write-up.

Pre-lab questions:
1. What are the properties of a good data acquisition environment? 2. At room temperature, what would be the RMS noise across a 100k resistor sampled between 1kHz and 10kHz? 3. What is the predicted gain of the circuit in used in Exercise 9.4? NOTE: Use LabView only on PC’s running Windows 2000/NT/XP Several LabView programs are used in this lab. Some of these programs do not use data acquisition hardware and can be run on your own computer. Download and install the LabVIEW Development it is password prosystem 7.1 from http://socrates.berkeley.edu/~phylabs/bsc/LabView tected,.available from the GSI’s in the 111-LAB. If you run the original program you will have full privileges; you will be able to examine and edit the LabVIEW code. If you run the executable, you will not be able to examine or edit the code. All LabView programs discussed that do not use the data acquisition hardware, and can be downloaded from http://socrates.berkeley.edu/~phylabs/bsc/LV_Programs The following files are in Programs.ZIP • Noisy Signal Generator.vi • Visual Noise.vi LabVIEW Training CD (LV_Tutorial.ZIP) The majority of the exercises do not require the data acquisition hardware, and can be done on your own computer.The exercises requiring the DAQ are 2-2, 3-4, 4-5, 6-4 and all of section 7. The tutorial is located in the 111 Lab Share on the 111-Lab Network.
Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. All rights reserved. Page 1 of 32

they were too slow. • It is much less tedious. and analyzed the information on the photos with calipers. Computers have become astonishingly powerful. the GPIB interface is slow. Data Acquisition Devices Modern instruments like oscilloscopes. Powerful signal processing techniques. like the Johnson Noise discussed later in these Background notes. but inevitably we would like to “see into the noise”…to recover a valid signal from a noisy signal. Data acquisition by computer has many advantages over hand collection: • It is generally more precise and accurate. and some typical examples include: • A spectral line converted to an electrical signal by a photomultiplier tube. Nowadays. or display the signal on an oscilloscope.Physics 111 BSC Laboratory Background Data Sources Lab 9 LabVIEW Programming Originally. computerized data acquisition is the only way to acquire enough data. Page 2 of 13 . Computerized Data Acquisition For many decades. for instance: • Measurements of the charge collected on a plate from a cosmic ray. Most of these techniques require extensive data sets. But as the experiments became more sophisticated. • The separation between two masses in a gravity wave experiment measured by light interferometry and converted to an electrical signal with a photocell. Now even astronomical “photos” are taken electronically with CCD cameras. counted events by penciling in tick marks. • The pressure in vacuum chamber measured with an ion gauge. Some are intrinsic. • Measurements of the potential across a nerve cell. it’s a rare experiment that produces noise-free data. too inaccurate. fast and accurate. All rights reserved. and too imprecise. exLast Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. I took about ten thousand photographs of oscilloscope screens. and particle tracks in bubble chambers. Devices which convert a non-electrical measurements to an electrical signal are called transducers. like filtering. • Measurements of the radio signal from a pulsar. Perhaps the last important non-electrical observations were photographs of astronomical images. the measurements are intrinsically electrical. it was sufficient to read the signal on a meter. and Data Acquisition Unfortunately. Noise comes from many sources. • The temperature of a liquid helium bath converted to an electrical signal by measuring the resistance of a semiconductor. The most common hardware interface protocol is called the GPIB bus. most data is collected by computer. for my Ph. and data acquisition hardware has become cheap.D. It is always best to minimize noise before collecting data. • The much larger data sets that can be collected by computers are far more amenable to sophisticated analysis techniques. Signal Processing. Experiments began making measurements electronically. In some experiments. • When properly programmed. hand and eye techniques failed. averaging and Fourier Transforms. Noise. sometimes known as the HP-IB or IEEE bus. like the 60Hz harmonics picked up from the power lines. there are no recording errors. Powerful in its time. signal sources. and timed events with stopwatches. have been developed to do this. thesis. but are best measured by converting the data to an electrical signals. while others are extrinsic. and bubble chambers have been replaced by silicon detectors. Frequently. • The passage of an energetic particle converted to an electrical signal in a spark chamber. we measured lengths with rulers. Sometimes hybrid methods were used. Other experiments produced data that is not intrinsically electrical. physicists made measurements by hand. • Measurements of the resistance of a semiconductor. and digital multimeters can often send their measurements to computers.

You develop a user interface. difficult to use. is utterly undocumentable. It is easy to learn and use. It should be fun and useful to you outside this course. • Powerful. It resembles no other significant computer language. some instruments have been designed to communicate over Ethernet or USB. efficient. avoiding side effects like global variables. Data Acquisition Environments Standalone instruments can be used independently via their front panel interfaces. and using efficient data structures are always worthwhile. have pathetic. For instance. execrable graphs. LabVIEW is not a panacea. but data acquisition cards must be used in a data acquisition environment. C and C++ are efficient and powerful data acquisition environments. 1970’s style user interfaces. for simple tasks it is unsurpassed.) Some familiar programs provide data acquisition environments. • Easy to learn. Excel can be used to collect data. have adopted LabVIEW as their programming standard. powerful and flexible. and is inefficient. Standalone instruments are often the best choice for very high end applications. testing subroutines individually. Page 3 of 13 . Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. Whatever the bus. Recently. and LabVIEW is widely used in industry. But their data acquisition functionality is limited. have neither built-in graphing capability or analysis routines. each instrument has its own set of programming commands. programming complicated applications is difficult. in the press of time. and both produce beautiful graphs. and can be much easier to use than standalone devices. in particular. and many throughout the world. Most cards come with a debugging interface that may be used in as a simple data logger.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming pensive. almost all the physics labs in Berkeley. has developed a quirky graphical programming language called LabVIEW specifically designed for data acquisition. Properly programmed. All rights reserved. has powerful data analysis capability. and Mathematica is inefficient. both are obscure and difficult to learn. and recovering data from the instrument is generally painful. While LabVIEW does not resemble other languages. but is insufficient for more sophisticated applications. many of the programming guidelines you may have learned previously still apply: breaking functionality down into subroutines. rarely are. Ideally. Matlab. but many applications are well served by data acquisition cards placed inside standard computers. and are difficult to learn and debug. But they are very primitive.) • Efficient (uses computer resources wisely. or Front Panel You will learn to write LabVIEW programs in this lab. and debug. Add-ins are available for both Mathematica and Matlab. and archaic. but. the data acquisition environment should be: • Flexible. and self-documenting. like any programming language. • Self-documenting. • Robust and stable (doesn’t crash. Both can be documented. with add-ins. use. The data acquisition card in the 111 lab computers. These cards are quite cheap and powerful. Most data acquisition cards also come with windows dlls that can be called by C and C++ . paying attention to memory management. analysis and control. but it has very limited functionality. National Instruments. but.

The bandwidth B is the band over which one measures the voltage. (Enter values into the Noise Level control by left clicking inside the box and typing a number. with exponentially decreasing weighting. We will perform this measurement in this lab. The discovery and explanation of Johnson Noise. or by left clicking on the box and usbutton and stop it by left ing the up and down arrows. Further increase the noise to around forty. it is often the dominate source of noise in an experimental measurement. sometimes called Thermal Noise or Nyquist Noise. 1 An exponentially weighted ∞ average of a sample set. fluctuates in proportion to the square root of the temperature and resistance. instead. T is the temperature. The first four cycles of the wave are displayed in the top graph. by left clicking on the arrow indicator clicking on the stop sign on the left side of the box. and the signal will become identifiable again.edu/~phylabs/bsc/LV_Programs directory. In the lab (A) Discerning signals in the presence of noise. the bandwidth is B = f L − f H .1 Load the program Noisy Signal Generator. Page 4 of 13 . Now increase the Noise Level. It is well worth reading Johnson’s and Nyquist’s original papers. Set the Noise Level to 0. yn . Johnson discovered that the RMS voltage across an isolated resistor is not zero. click the Averaging On button.B.vi. and its spectrum in the bottom graph. and follows: VRMS = 4k B RTB . 1V RMS sine wave. Later that year. you would not be able to identify it. but. All rights reserved. but measuring the noise in a resistor is probably the easiest way to determine k B . Nyquist showed that the voltage is due to the thermal fluctuations in the resistors.) This program generates several hundred cycles of a 100Hz. H. 9. Notice how the wave is impossible to discern directly when the noise is greater than ten. if the signal from the resistor is sent through a bandpass filter which passes frequencies between f L and f H . Now click the Continuously Regenerate Noise button. J. Your brain will average the instances. 1 over the number of spectrums specified by the Averaging Depth control. The spectral signal will have faded into the noise. This adds Gaussian noise with the specified standard deviation to the sine wave. and k B is Boltzmann’s constant. Run the program by left clicking the run or by left clicking on the Stop button. Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. was one of the grand triumphs of thermodynamics. where R is the resistance. and run the program. which will display the signal with a new noise set every 50ms.Physics 111 BSC Laboratory Johnson Noise Lab 9 LabVIEW Programming In 1928. This will be average the spectrum. If you didn’t already know where to find the signal. This procedure yields a running averaging in which the ⎣ ⎦ most recent points are the most heavily weighted. Johnson Noise is of great practical importance. Finally. Normally noise is detrimental and an annoyance. which are downloadable from http://socrates. is found by computing y N = ⎡1 − exp (1 N av ) ⎤ ∑ n = 0 y N − n exp ( − n N av ) . but is nonetheless easy to discern in the spectrum.berkeley. In other words.

The magnitude of the effect is substantially independent of the intensity of the causative agent.2 Properly programmed computers are generally better than humans at discerning signals in the presence of noise. but what could be described as our fantastic ability to fool ourselves. You should find that you can discern remarkably noisy images. Take advantage of this of this fact when appropriate. lower the noise in decrements of ten (200. Load the program Visual Noise. Do not continuously regenerate the noise. sit close to the computer. but continuously regenerate the noise with the eponymous control. 3. this is equivalent to low pass filtering the signal. particularly when we have a well-informed notion of what the signal should look like. His original talk is worth reading: http://www. It makes claims of great accuracy. Typically. the spectral analysis in 9. the noise will be set to 200.vi.princeton.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming Play with different Averaging Depths and Noise Levels. c) For images 5 and 6. 4. continuously regenerate the noise. at each noise level. many measurements are necessary because of the very low statistical significance of the results.cs. For each of the images. Page 5 of 13 . All rights reserved. however. this is equivalent to averaging the signal. for example. The ratio of supporters to critics rises up to somewhere near 50 percent and then falls gradually to oblivion. and look at the screen from far away. 9. This program displays eight iconic portraits corrupted by noise. b) For images 3 and 4. Images can be changed with the Picture # control.1. 190. Criticisms are met by ad hoc excuses.1 was much more informative than the display of the unprocessed waveform. you will need to lower the noise to below 150. When the picture is first displayed. Summarize your observations in your lab book. Nobelist Irving Langmuir gave a famous talk on what he called Pathological Science. always being aware that it is very easy to fool yourself. Langmuir laid out several rules for detecting pathological science: 1. Because the pixels blur when observed at a distance. 2 In 1953. 6. It puts forth fantastic theories contrary to experience. or. 180. 2. humans are better than computers. The effect is of a magnitude that remains close to the limits of detectability.htm Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. As described in 9. a) For images 1 and 2. and see how small a signal you can see. Bandwidth reduction is one of the most important signal processing techniques. d) For images 7 and 8. sit close to the computer.edu/~ken/Langmuir/langmuir. Occasionally. etc. and the image will be unrecognizable.) until you recognize the image. look at the screen from at least two meters away. Summarize your observations in your lab book. 2 Humans are particularly good at is facial recognition in the presence of noise. and the noise level changed with the Noise Level control. 5.

Johnson noise is not large: for a resistance of 1Mohm. Also available is the LV_Tutorial. For additional information on case structures perform the exercise: Simple State Machine found in the appendix I at the back of this Write-up. we need to build an amplifier to observe the noise. This one is NOT interactive. and discuss any confusing parts of the the tutorial.Physics 111 BSC Laboratory (A) LabVIEW programming Lab 9 LabVIEW Programming 9. You can choose to download LV_1Basic.Zip file. While you may work with your partner. All rights reserved. Then go to “LabView Training” folder. The following exercises find Boltzmann’s constant via the measurement of Johnson Noise. 9. Consequently.1V signal connected to the voltage divider.edu/~phylabs/bsc/LabView (password protected) if off campus or you can use the files from the U: drive located on the My Computer folder. Verify the component values and build a very neat circuit The ratios of R1/R2 and R3/R4 are very important Debug the circuit with a 1kHz.zip to your directory instead.3 Learn to program in LabVIEW 7. Page 6 of 13 .html to run the exercises. Demonstrate the programs created in the Exercise in appendix I to the TA’s. click on index. the room temperature noise level is about 40μV.1 by doing the exercises in sections 1-7 in National Instrument’s Basic 1 Interactive Training. 0. on any of the 111-Lab computers located inside the BSC Share folder. You must download it to your directory and then use it.4 Build the circuit shown in the schematic below.berkeley. If you are having noise issues try moving the circuit to another location on your breadboards Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. both of you will be expected to learn to program in LabVIEW separately. and a bandwidth of 100kHz. The Files can be downloaded from http://socrates.

and connect a 100k test resistor. and what is the gain in the flat region? Now remove the voltage divider from your circuit.6 Write a LabVIEW program to measure the resistor’s noise level.vi. a topic that will be discussed at length in the next lab. Note that response of the circuit is deliberately rolled off (by capacitors C3 and C4) to avoid aliasing. (Use 1% metal film resistors for all of the test resistors. we need to know the transfer function (frequency response) of the circuit. Over what frequency range is your amplifier flat. you will not be able to open the block diagram for this program.5 Since we measure Johnson noise over some bandwidth.) 9. All rights reserved. Find the transfer function of your circuit between 10Hz and 240kHz. you may use the program To just find the Boltzman Constant use Find Boltzmann’s Constant. A typical run is shown below: Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. Page 7 of 13 . Load the Amplifier Transfer Function. As an example.vi and connect the signals as described on the front panel.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming 9. however.

Use your program itself to determine Vintr . The minimum functionality you are required to duplicate includes: 1. the two forms of noise add in quadrature. Nonetheless. Use the DAC Assistant express vi to read channel A0 7. All rights reserved. Converting the signal from the amplifier to a digital waveform. to calculate Boltzmann’s constant. T is the resistor temperature. as indicated by the yellow cursor line. This range should be slightly greater than the size of the signal. Configure the DAC Assistant to read N Samples at 500kHz.vi uses some advanced features of LabVIEW to implement features which you are not required to duplicate. The many peaks come from single frequency noise sources picked up by the amplifier. Your measurement needs to be scaled by the sampling parameters: use the formula: Ns kB = V 2 −Vintr 2 ) 2 ( meas 4TRFs G where N s is the number of samples (32768 in Find Boltzmann’s Constant. Page 8 of 13 .) The program Find Boltzmann’s Constant. typically there is a flat region. R is the resistance of the resistor under test. but be Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. the rise at low frequency is 1/F noise (the low frequency peaks are power line harmonics) and the rise and fall at high frequencies is due to variations in the gain near the rolloff of the amplifier.vi) G is the amplifier gain in the flat region. Set the Voltage Range to be between about -200m and 200m. Vmeas 2 − Vintr 2 gives the square of the noise from the resistor alone. (Since the intrinsic noise is independent of the Johnson Noise. The Samples To Read should be between 1000 to 100. Fs is the sampling frequency (500kHz in Find Boltzmann’s Constant.vi).000. Use the amplitude of the flat section. Vmeas . the FFT routines used later prefer that the number of samples be a power of 2. Note that the spectrum is far from flat. Thus.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming NOTICE: The box calculator on the Left above is NOT part of the exercise. and Vintr is the intrinsic noise level of the amplifier with R = 0 .

and 1000k resistors.7 Calculate Boltzmann’s constant for 10k. Setting up a cursor on the Spectrum to display the spectral amplitude. Equal to Zero?. Correcting the labeling on all the graphs. 9. The card will automatically coerce the specified range to the smallest available range that contains the specified range. Waveform Graph. 4. 7. it just works when put inside of the “While Loop”. 100k. Property Node. Averaging to on. Use a Wait For Front Panel Activity node to avoid saturating your computer with null cycles. 9. Stacked Sequence Structure. Hint: 1st AddGraph. Using the Spectral Measurements express vi to Fourier transform the incoming signal. 3. Hints: The Professor’s program uses these LabVIEW components. Using an overall While Loop to retake the data on command. Using A Stacked Sequence Structure with 3 pages enclose all the programming inside the Structure which is inside a While Loop. Spectral Measurements. then GoTo Visible Items then to cusor Optional Advanced features that you might choose to program include: 8. This will allow you more control over timing. Using a property node associated with the cursor to automatically read the spectral amplitude and using the resulting value to calculate Boltzmann’s constant. Use a Formula Node for the algebra. While Loop. 5. The Trigger Types should be set to None. Page 9 of 13 . Incorporating all your code into a For Loop set for 100 iterations. Case structure. Displaying the spectrum on a waveform graph. For Loop. See the program example For loop. Formula Node.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming 2. Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. and Produce Spectrum to Every iteration. Note that this is not wired into the circuit. Leaving only the Stop Button outside the structure but inside the while loop. warned that only certain ranges are available. Wait For Front Panel Activity: among others. Print a copy of the front panel (with data) for your lab report.vi in Lab Stations directory on WEB Site. Have your working program signed off by the TA’s. Set the Spectral Measurement to Magnitude RMS. 6. Displaying the signal on a waveform graph. then Right Click on graph. Weighting to Linear. the Mode to RMS. 10. the Window to None. Number of Averages to 100. All rights reserved.

Physics 111 BSC Laboratory Lab 9 LabVIEW Programming Physics 111 ~ BSC Student Evaluation of Lab Write-Up Now that you have completed this lab. All rights reserved. include corrections when possible. Please be specific. Since you have just finished the lab it is your critique that will be the most helpful. Your thoughts and suggestions will help to change the lab and improve the experiments. use references. and turn this in with your lab report. using both sides of the paper as needed. Thank you! Lab Number: Lab Title: Date: Which text(s) did you use? How was the write-up for this lab? How could it be improved? How easily did you get started with the lab? What sources of information were most/least helpful in getting started? Did the pre-lab questions help? Did you need to go outside the course materials for assistance? What additional materials could you have used? What did you like and/or dislike about this lab? What advice would you give to a friend just starting this lab? The course materials are available over the Internet. and feel free to add any other comments. Do you (a) have access to them and (b) prefer to use them this way? What additional materials would you like to see on the web? Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. Page 10 of 13 . we would appreciate your comments. Please take a few moments to answer the questions below.

On the front panel of the StateMachinesStates. and choose Standard State Machine. Examine the template. The VI will have an initial state.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming Appendix I: LabVIEW Tutorial (Courtesy of National Instruments) Exercise . Call them “State 1” and “State 2” Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. Front Panel Rather than start from scratch. Page 11 of 13 . 2. right click on the States enum control and choose Edit Items. 1. All rights reserved. which is located under the VI from Template » Frameworks » Design Patterns heading. Add two more states. Right click on the enum constant labeled Next State and select Open Type Def.ctl Type Def VI. we will use a VI template to create our state machine.Simple State Machine Create a VI using state machine architecture that simulates a simple test sequence. Then it will proceed to the next case and then to the final state where it will ask the user whether to start over or end the test. 4. where it will display a pop-up message indicating that it is starting the test. From the initial LabVIEW screen click on New…. 5. Block Diagram 3. and then save it in another directory before you begin working on it.

Close the State Machines. 11. Place a Select function and connect two enum constants (Tip: Copy the enum constants from one of the previous cases) b. Change to the next state in the case structure (“State 1”) and change the enum constant labled Next State to “State 2”. Change it’s name to “Current State”. Do this one additional time so that there are four cases: Initialize. State 2. 13. All rights reserved. State 1. 7. Right click on the shift register on the left side of the while loop and create an indicator. Change the value connected to the Wait function to 2000. Page 12 of 13 . Change the enum constant labled Next State to “State 1”. Default case place a One Button Dialog function and wire a string constant into the Message input. a. 8. Change to the next state (“State2”) and add the following code. and Stop. 12. Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. 10. In the “Initialize”.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming 6. 9. Type “Now beginning test…” into the string constant. Right click on the Case Selector Label of the case structure and choose Duplicate case. Place a Two Button Dialog and wire create the constants as illustrated below.ctl Type Def Front panel and save the control with the default name when prompted.

End of Exercise Last Revision: November 2010 ©2010 Copyrighted by the Regents of the University of California. All rights reserved. Save and close the VI. Page 13 of 13 .Physics 111 BSC Laboratory Lab 9 LabVIEW Programming 14. Run the VI. 15.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->