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

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

LabView Programming

References:
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: August 2008 ©2008 Copyrighted by the Regents of the University of California. All rights reserved. Page 1 of 32

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

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

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

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

both of you will be expected to learn to program in LabVIEW separately. Find the transfer function of your circuit between 10Hz and 240kHz. we need to build an amplifier to observe the noise. 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.edu/~phylabs/bsc/LabView (password protected) For additional information on case structures perform the exercise: Simple State Machine found in the appendix I at the back of this Write-up. 0.3 Learn to program in LabVIEW 7.berkeley. Demonstrate the programs created in the Exercise in appendix I to the TA’s. Note that response of the circuit is deliberately rolled off (by capacitors C3 and C4) to avoid aliasing. Last Revision: August 2008 ©2008 Copyrighted by the Regents of the University of California. Page 6 of 13 . While you may work with your partner. 9. Consequently.1 by doing the exercises in sections 1-5 in National Instrument’s Basic 1 Interactive Training. All rights reserved.4 Build the circuit shown in the schematic below. the room temperature noise level is about 40μV. The following exercises find Boltzmann’s constant via the measurement of Johnson Noise. we need to know the transfer function (frequency response) of the circuit. Load the Amplifier Transfer Function. and discuss any confusing parts of the the tutorial. Johnson noise is not large: for a resistance of 1Mohm.1V signal connected to the voltage divider. If you are having noise issues try moving the circuit to another location on your breadboards 9. and a bandwidth of 100kHz. The Files can be downloaded from http://socrates.vi and connect the signals as described on the front panel.Physics 111 BSC Laboratory (A) LabVIEW programming Lab 9 LabVIEW Programming 9.5 Since we measure Johnson noise over some bandwidth.

(Use 1% metal film resistors for all of the test resistors.) 9.Physics 111 BSC Laboratory Lab 9 LabVIEW Programming a topic that will be discussed at length in the next lab. you may use the program To just find the Boltzman Constant use Find Boltzmann’s Constant. and connect a 100k test resistor. All rights reserved.vi. Over what frequency range is your amplifier flat. As an example. Page 7 of 13 . A typical run is shown below: Last Revision: August 2008 ©2008 Copyrighted by the Regents of the University of California. and what is the gain in the flat region? Now remove the voltage divider from your circuit. you will not be able to open the block diagram for this program. however.6 Write a LabVIEW program to measure the resistor’s noise level.

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

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

All rights reserved. Please take a few moments to answer the questions below. 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. using both sides of the paper as needed. Page 10 of 13 .Physics 111 BSC Laboratory Lab 9 LabVIEW Programming Physics 111 ~ BSC Student Evaluation of Lab Write-Up Now that you have completed this lab. and feel free to add any other comments. 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. use references. Please be specific. include corrections when possible. we would appreciate your 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: August 2008 ©2008 Copyrighted by the Regents of the University of California. and turn this in with your lab report.

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

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

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

Sign up to vote on this title
UsefulNot useful