Wednesday, March 30, 2016

Week 11

Blog sheet Week 11: Strain Gauges

Part A: Strain Gauges:
Strain gauges are used to measure the strain or stress levels on the materials. Alternatively, pressure on the strain gauge causes a generated voltage and it can be used as an energy harvester. You will be given either the flapping or tapping type gauge. When you test the circle buzzer type gauge, you will lay it flat on the table and tap on it. If it is the long rectangle one, you will flap the piece to generate voltage.

1.       Connect the oscilloscope probes to the strain gauge. Record the peak voltage values (positive and negative) by flipping/tapping the gauge with low and high pressure. Make sure to set the oscilloscope horizontal and vertical scales appropriately so you can read the values. DO NOT USE the measure tool of the oscilloscope. Adjust your oscilloscope so you can read the values from the screen. Fill out Table 1 and provide photos of the oscilloscope.

Table 1: Strain gauge characteristics
Flipping strength
Minimum Voltage
Maximum Voltage
Low
-3 V
3 V
High
-10 V
10 V



2.       Press the “Single” button below the Autoscale button on the oscilloscope. This mode will allow you to capture a single change at the output. Adjust your time and amplitude scales so you have the best resolution for your signal when you flip/tap your strain gauge. Provide a photo of the oscilloscope graph.




Image 1: Single change output





Part B: Half-Wave Rectifiers

1.       Construct the following half-wave rectifier. Measure the input and the output using the oscilloscope and provide a snapshot of the outputs.



The input is 10Vpp at 1kHz
Output is 4.56Vpp
Image 2: Half wave rectifier output

2.       Calculate the effective voltage of the input and output and compare the values with the measured ones by completing the following table. 


                       Table 2: Effective (rms) of input and output voltage                         
Effective (rms) values
Calculated
Measured
Input
3.53 V
3.54 V
Output
1.61 V
1.58 V

Equation used for calculated values: Vrms = (Vpp/2) (.707)



3.       Construct the following circuit and record the output voltage using both DMM and the oscilloscope.


Table 3:  Output voltage readings with 1 µF

Oscilloscope
DMM
Output Voltage (p-p)
2.32 V
Not possible
Output Voltage (mean)
2.89 V (not possible..?)
Not possible

The mean shouldn’t be higher than the peak to peak value. It should be somewhere between the peak to peak voltage. It's also impossible to measure the peak to peak value and mean value on the DMM.



4.       Replace the 1 µF capacitor with 100 µF and repeat the previous step. What has changed?


Table 4: Output voltage readings with 100 µF

Oscilloscope
DMM
Output Voltage (p-p)
160 mV
Not possible
Output Voltage (mean)
3.28 V 
Not possible

What changed after replacing the capacitors is that the output voltage peak to peak was smaller than the mean output voltage.


Part C: Energy Harvesters

1.       Construct the half-wave rectifier circuit without the resistor but with the 1 µF capacitor. Instead of the function generator, use the strain gauge. Discharge the capacitor every time you start a new measurement. Flip/tap your strain gauge and observe the output voltage. Fill out the table below:


Table 5: Output voltages at different tap frequencies
Tap frequency
Duration
Output voltage
1 flip/second
10 seconds
1.15 V
1 flip/second
20 seconds
1.16 V
1 flip /second
30 seconds
1.27 V
4 flips/second
10 seconds
2.14 V
4 flips/second
20 seconds
2.2 V
4 flips/second
30 seconds
2.3 V


2.       Briefly explain your results.
According to our chart,the more taps you do, the higher the output voltage. When you do a steady tap, the voltage generally stays the same. When you do multiple taps per second, it slowly increases.



3.       If we do not use the diode in the circuit (i.e. using only strain gauge to charge the capacitor), what would you observe at the output? Why?

When we didn’t use the diode, the output wasn't consistent. When you use a diode, it only allows positive current to flow; without it the capacitor wouldn't really charge. 

Friday, March 25, 2016

Week 10

Blogsheet week 10

In this week’s lab, you will collect more data on low pass and high pass filters and “process” them using MATLAB.
PART A: MATLAB practice.
1.       Open MATLAB. Open the editor and copy & paste the following code. Name your code as FirstCode.m
Save the resulting plot as a JPEG image and put it here.


clear all;
close all;
x = [1 2 3 4 5];
y = 2.^x;
plot(x, y, 'LineWidth', 6)
xlabel('Numbers', 'FontSize', 12)
ylabel('Results', 'FontSize', 12)





Image 1: MATLAB result




2.       What does clear all do?
Clear all clears out all variables that were previously defined

3.       What does close all do?
Close all deletes all figures in handles that aren’t hidden

4.       In the command line, type x and press enter. This is a matrix. How many rows and columns are there in the matrix?
There are 5 columns and 1 row. 

x = [ 1 2 3 4 5]



5.       Why is there a semicolon at the end of the line of x and y?
There’s a semicolon at the end of the line of x and y because it ends each line, that way they're separate from each other.



6.       Remove the dot on the y = 2.^x; line and execute the code again. What does the error message mean?

 The message means that the line can't perform the code because the code is an element by element, and with that you need to have a period between, in this case, the 2 and the power of x. If x was only equaled to one number, then the code may have executed. The code may also be executed if the matrix was squared. 

7.       How does the LineWidth affect the plot? Explain.
LineWidth affects the plot by making the plotted line either thinner or thicker



8.       Type help plot on the command line and study the options for plot command. Provide how you would change the line for plot command to obtain the following figure (Hint: Like ‘LineWidth’, there is another property called ‘MarkerSize’)


This is our code: 

 clear all; 
 close all;
 x = [ 1 2 3 4 5 ];
 y = 2.^x;
plot(x, y, 'ro-', 'LineWidth', 5, ...
'MarkerSize',15)
xlabel ('Numbers', 'FontSize', 12)
ylabel('Results', 'FontSize', 12)


 We added 'ro-' to get the red solid line and circle markers, and then added 'MarkerSize' to size the circles.We made the  MarkerSize bigger than the LineWidth in order to have the open circles; otherwise, the circles looked filled.





9.       What happens if you change the line for x to x = [1; 2; 3; 4; 5]; ? Explain.
If you change the line in the code, you'll get nothing. The semicolons defines the numbers in the brackets to x.

 However, if you were to change the line alone (without the rest of the code), you would get a new row. So in this case, the output would look like


x =

     1
     2
     3
     4
     5


instead of


x =

     1     2     3     4     5








10.   Degree vs. radian in MATLAB:
a.       Calculate sine of 30 degrees using a calculator or internet.

Degree Mode: sin(30) = 1/2 = 0.5

Radian Mode: sin(30) = pi/6


b.      Type sin(30) in the command line of the MATLAB. Why is this number different? (Hint: MATLAB treats angles as radians).

In MATLAB, we got -0.9880. This is different because MATLAB is treating 30 as radians instead of degrees.


c.       How can you modify sin(30) so we get the correct number?

You can modify sin(30) by changing 30 to pi/6. We when did this, we got 0.5.








11.   Plot y = 10 sin (100 t) using Matlab with two different resolutions on the same plot: 10 points per period and 1000 points per period. The plot needs to show only two periods. Commands you might need to use are linspace, plot, hold on, legend, xlabel, and ylabel. Provide your code and resulting figure. The output figure should look like the following:



t1 = linspace(0, (4*pi)/100, 10);
t2 = linspace(0, (4*pi)/100, 1000);
y1 = 10*sin(100*t1);
y2 = 10*sin(100*t2);
plot(t1, y1, 'ro-', t2, y2)
xlabel('Time (s)')
ylabel('y function')
legend('coarse', 'fine')





Image 2: MATLAB result




12.   Explain what is changed in the following plot comparing to the previous one.





What changes in this plot is the fine line. It flattens out at y(x) = 5. 






13.   The command find was used to create this code. Study the use of find (help find) and try to replicate the plot above. Provide your code.

 clear all;
close all;
t1 = linspace(0, (4*pi)/100, 10);
t2 = linspace(0, (4*pi)/100, 1000);
y1 = 10*sin(100*t1);
y2 = 10*sin(100*t2);
x = find (y2>5);
y2(x) = 5;
plot(t1, y1, 'ro-', t2, y2)
xlabel('Time (s)')
ylabel('y function')
legend('coarse', 'fine')



Image 3: MATLAB result








PART B: Filters and MATLAB
14.       Build a low pass filter using a resistor and capacitor in which the cut off frequency is 1 kHz. Observe the output signal using the oscilloscope. Collect several data points particularly around the cut off frequency. Provide your data in a table.

Table 1: Frequency data points and the output voltage of a low pass filter
Data Points
Output (low pass)
100 Hz
6.09 V
200 Hz
6.02 V
300 Hz
5.91 V
500 Hz
5.60 V
700 Hz
5.21 V
750 Hz
5.12 V
800 Hz
5.03 V
850 Hz
4.92 V
900 Hz
4.81 V
950 Hz
4.71 V
1 kHz
4.61 V
1.1 kHz
4.4 V
1.2 kHz
4.23 V
1.3 kHz
4.05 V
1.4 kHz
3.88 V
1.5 kHz
3.71 V
1.6 kHz
3.43 V
1.7 kHz
3.28 V
1.8 kHz
3.13 V
1.9 kHz
2.99 V
2.0 kHz
2.87 V
2.1 kHz
2.74 V
2.2 kHz
2.63 V
2.3 kHz
2.4 V

According to our table, the higher the frequency, the lower the voltage output.





15.       Plot your data using MATLAB. Make sure to use proper labels for the plot and make your plot line and fonts readable. Provide your code and the plot.

%Low Pass Filter
clear all;
close all;

x = [100, 200, 300, 500, 700, 750, 800, 850, 900, 950, 1000, 1100, 1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300];
y= [6.09, 6.02, 5.91, 5.60, 5.21, 5.12, 5.03, 4.92, 4.81, 4.71, 4.61, 4.4, 4.23, 4.05, 3.88, 3.71, 3.43, 3.28, 3.13, 2.99, 2.87, 2.74, 2.63, 2.4];

z = max(y)*0.707;
%display(z);

a = find(y<z);
%display(a);

b= min(a);
%display(b);
%display(y(b));

q = ((y(b)+y(b+1))/2);
%display(q);

F_cut =((x(b)+x(b+1))/2);
%display(F_cut);

plot(x,y);
hold on;

plot([0 2300], [q q], 'b:', 'LineWidth', 1);
hold on;

xlabel('Frequency(Hz)');
ylabel('Output Voltage');

legend('Response Curve', 'Cutoff Frequency', 'location', 'Northeast');



Image 4: MATLAB result of Low Pass Filter 







16.       Calculate the cut off frequency using MATLAB. find command will be used. Provide your code.

*Please refer to the code above in #15, because we went ahead on accident.

According to our plot and code, the cutoff frequency is 1250 Hz



17.       Repeat 1-3 by modifying the circuit to a high pass filter.

Table 2: Frequency data points and output voltage of high pass filter
Data Points
Output (high pass)
100 Hz
0.526 V
200 Hz
1.03 V
300 Hz
1.52 V
500 Hz
2.39 V
700 Hz
3.1 V
750 Hz
3.25 V
800 Hz
3.4 V
850 Hz
3.56 V
900 Hz
3.65 V
950 Hz
3.77 V
1 kHz
3.87 V
1.1 kHz
4.14 V
1.2 kHz
4.32 V
1.3 kHz
4.48 V
1.4 kHz
4.62 V
1.5 kHz
4.74 V
1.6 kHz
4.85 V
1.7 kHz
4.95 V
1.8 kHz
5.03 V
1.9 kHz
5.11 V
2.0 kHz
5.18 V
2.1 kHz
5.23 V
2.2 kHz
5.29 V
2.3 kHz
5.33 V

According to our table, the higher the frequency, the higher the voltage output.


18.       Plot your data using MATLAB. Make sure to use proper labels for the plot and make your plot line and fonts readable. Provide your code and the plot.

%High Pass Filter
clear all;
close all;

x = [100, 200, 300, 500, 700, 750, 800, 850, 900, 950, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300];  
y = [0.526, 1.03, 1.52, 2.39, 3.1, 3.25, 3.4, 3.56, 3.65, 3.77, 3.87, 4.14, 4.32, 4.48, 4.62, 4.74, 4.85, 4.95, 5.03, 5.11, 5.18, 5.23, 5.29, 5.33];

z = max(y)*0.707;
%display(z);

a = find(y<z);
%display(a);

b= max(a);
%display(b);

q = ((y(b)+y(b+1))/2);
%display(q);

F_cut =((x(b)+x(b+1))/2);
%display(F_cut);

plot(x,y);
hold on;

plot([0 2300], [q q], 'b:', 'LineWidth', 1);
hold on;



Image 5: MATLAB result of High Pass Filter


.       19. Calculate the cut off frequency using MATLAB. find command will be used. Provide your code.

*Again, our code is found above, in #18.
The cut off frequency is at 925 Hz