The purpose of this lab was to acquire data and save it.
The theory behind this lab is based on high pass filters in RC circuits. Since the output will be taken across the resistor in this lab, the capacitor will act as a high pass filter. This means that it will only permit entry to frequencies above the cuttoff frequency; only high frequencies are allowed. If the output were taken across the capacitor, we would have the total opposite case and end up with a low pass filter; only low frequencies allowed.
The objective was to obtain data and graph it to demonstrate the cuttoff frequency in a plot of peak to peak voltage vs. the frequency.
This was done by marrying different aspects of past labs that we learned from LabVIEW like data acquisition and file saving. So, we altered the frequency, it went through the circuit, acquired by the MCC DAQ card (I was calling it USB board in lab IV), passed through the VI and saved a screenshot of the front panel where the peak to peak voltage was displayed.
I started out by forking the project. Then I armed the circuit, created the VI, ran the VI and acquired peak to peak voltage data for different frequencies.
Unfortunately, I have forgotten almost everything I know about circuits so building a simple one was a challenge.
I used these sites to refresh a little bit:
Overview of RC circuits: http://en.wikipedia.org/wiki/RC_circuit
A tutorial on high pass filters: http://www.electronics-tutorials.ws/filter/filter_3.html
Anthony’s sketchnotes from the lecture on monday: http://2012juniorlab.iheartanthony.com/?p=70
The circuit mas armed using a protoboard, a 100 kOhm resistor, a 0.01microFarad capacitor, MCC DAQ card and an oscilloscope for debugging. I brought out the multimeter thinking that’s how I was going to measure the voltage across the resistor but it turns out you can use the oscilloscope to measure the voltage. I changed the frequency using the function generator.
Anthony offered to use his phone to take a picture of my circuit since I didn’t have any way of taking a picture of it… however I forgot to take a picture of it before leaving!
So here’s the structure of it:
Image 1. RC Circuit
Constructing the VI
I opened PhD. Koch’s example of the VI and it looked almost the same as the buffered one from last week except it had another monstrous part right next to it. Creating it took quite a while just because I had to find a variety of little functions and deal with quite a few errors.
Image 2. Block Diagram of VI
Alright, here’s a brief explanation of this VI. The left hand side is the one which is almost identical from lab IV except that it was enclosed by a while loop, contained a shift register and an extra indicator. The shift register saves your previous run of the code and adds the current run. This is visible via two graphs in the front panel (image 3). The data that was recorded was the difference between the peak of the wave minus the trough of the wave (peak to peak voltage).
Now for the new addition on the right hand side. This was enclosed by a case structure and basically served the purpose of saving a screen shot of the front panel with a date and time as its file name. It contains a collection of concatenate strings, indicators and other functions such as the Write PNG file, write to spreadsheet, invoke control, etc. to fulfill the purpose previously mentioned.
Once everything was wired properly in the VI and the circuit (see problem 4), I obtained a graph. Now I was able to collect data.
Image 3. Graph to the right plots old frequency at 10Hz, graph to the left plots new frequency at 100Hz. Notice the “x-y” titled rectangular box; this is the peak to peak difference.
I calculated my time constant to be
and my cutoff frequency to be
I only took eight data points. This reflects terrible data taking on my part since I failed to take data points for the most crucial area: the cuttoff frequency. This would not have happened had I calculated my cutoff frequency before I acquired data. Instead I took two data points at 10Hz and at 100Hz, which is a huge and not very helpful range.
Here is the link to the Peak-Peak Voltage vs. Frequency I uploaded on figshare: http://figshare.com/articles/Power_vs_frequency.xls/91217
Problems and Solutions
1. Connecting compatible datatypes. Make sure that you connect compatible datatypes on LabVIEW! When putting the code together I was trying to connect 1D to 2D because the inputs were so tightly packed in the spreadsheet that I couldn’t tell the difference. However, if you scan you curser over the inputs or press ctrl h it’ll help distinguish between them.
2. Concatenate string . It turns out there was a string and an indicator that weren’t supposed to be in the VI. While I getting through this problem I asked about the difference between and indicator and a control. It turns out you want an indicator when you want something to show something and you want a control when you want something to control something. So it’s all in the name.
Image 4. String Error
3. Wiring. This was by far the biggest problem in my VI and my circuit. I got through them by asking questions as well as looking at the errors. The nice thing about LabVIEW is that it’ll tell you your error and take you to it on the block diagram.
4. Obtaining Data. There were a number of errors with the wiring of the circuit. After some time and help from PhD. Koch and Anthony, it turns out that one of the parts of the oscilloscope wasn’t connected. After connecting this I obtained beautiful graphs on the front panel of my VI and was finally able to record data.
1. Finding specific functions for the part of the code enclosed by the case structure. Right Click on the block diagram, then:
-Programming>File I/O > write to spreadsheet
-Programming> graphics and sound> Graphics formats> Write PNG file
-Programming> Application Control> Invoke control
2. Shift register : This function is built into the while loop and it stores the previous run. So when you run it the first time you get one graph. When you run it a second time you get two the previous one and the new one, etc. Koch said that since LabVIEW doesn’t save variables like other programming languages do, this is the way it sort of does it.
3. Invoke Node: Neat because you can give it different commands and it will perform them. Right now it’s connected so that it saves screenshot of the front panel to a file.
Image 5. Invoke Node Function
PhD. Koch and Anthony both helped me find solutions to all the problems mentioned above.