Monday, March 27, 2017

Week 11

Part A: Strain Gauges:

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. 

Flip Strength Data Table

Press Strength Data Table

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.

strain gauge oscilloscope graph

Graph for button

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.

picture of circuit



output and input signals for half-wave rectifier

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

calculated and measured values of half wave rectifier for input and output.


3. Explain how you calculated the rms values. Do calculated and measured values match? 

  • For Input the rms values were calculated by dividing the peak to peak value on the function generator by the square root of 2. For output we divide the peak to peak in half then the resultant value by the square root of 2.

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

picture of circuit construction

output voltage at capacitor

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

output voltage with different capacitor.


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:

Output voltages for strain gauge, half wave rectifier.

2. Briefly explain your results.

  • The data we acquired from this test was not as accurate as it could've been. We expected the voltage to increase with the amount of time and flips, but due to inconsistency in the flipping we ended up with values that don't exactly follow a constant pace.

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?

  • The output would be doubled because the diode only allows half the signal to be transmitted. 

4. Write a MATLAB code to plot the date in table of Part C1.

Matlab graph for outputs.

Monday, March 20, 2017

Week 10

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.

Figure 1: Graph of code given

2. What does clear all do?

The clear all command clears the command terminal.

3. What does close all do?

The close all command clears the workspace of all figures and the command terminal for a brand new workspace.


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

1 row, 5 columns.


5. Why is there a semicolon at the end of the line of x and y?

The semicolon is used to end a command.

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

The error code means that in order to use the power (^) function, the object being taken to a power must be of a scalar value. The dot is used to signify a number as a scalar.

7. How does the LineWidth affect the plot? Explain.

Line width affects the plot

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’)

Example graph to replicate.

Our graph
plot(x, y, '-ro', 'LineWidth', 6, 'MarkerSize', 20);


10. Provide the code for the following figure. You need to figure out the function for y. Notice there are grids on the plot.

>> clear all;

close all;

x = [1 2 3 4 5];

y = 2.^x;

plot(x, y,':ks', 'LineWidth', 6, 'MarkerSize', 18);
grid
xlabel('Numbers', 'FontSize', 12)

ylabel('Results', 'FontSize', 12)

Picture of graph represented by code above

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

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

Sin(30) = -0.9880 This is the value when calculations are being done in radians rather than degrees.
c. How can you modify sin(30) so we get the correct number?

by typing sind(30), this makes the function calculate in degrees rather than radians.


12. 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:

>> clear all;

close all;

t = linspace(0,0.126,10);

y = 10*(sin(100*t));
x = linspace(0,0.126,1000);
z = 10*(sin(100*x));
plot(t, y, '-ro',x, z, 'k' )
axis([0 .14 -10 10]);

xlabel('Time(S)')

ylabel('y function');

legend('Coarse', 'Fine');

Example

Our version


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

Every value of Z that was found to be greater than 5 was changed to 5.

14. 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;

t = linspace(0,0.126,10);

y = 10*(sin(100*t));
x = linspace(0,0.126,1000);
z = 10*(sin(100*x));
f = find(z>5);
z(f) = 5;
plot(t, y, '-ro',x, z, 'k' )
axis([0 .14 -10 10]);

xlabel('Time(S)')

ylabel('y function');

legend('Coarse', 'Fine');

Our graph using find function

PART B: Filters and MATLAB

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

Low pass filter table


2. 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 graph

>> clear all;

close all;

x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4];

y = [3.7 3.68 3.6 3.5 3.38 3.26 3.12 2.98 2.85 2.85 2.72 2.6 2.47 2.37 2.26];

plot(x, y)

xlabel('Frequency(KHz)', 'FontSize', 12)

ylabel('Vout(rms)', 'FontSize', 12)
>> 

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

Cutoff frequency between 1.1 and 1.4 Khz

clear all;

close all;

x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4];

y = [0 3.7 3.68 3.6 3.5 3.38 3.26 3.12 2.98 2.85 2.72 2.6 2.47 2.37 2.26];

z = [0 1.05 1.04 1.02 .99 .96 .92 .88 .84 .81 .77 .74 .69 .67 .64];

plot(x, z, )

s = find(z == 0.70)

x(s)

4. Put a horizontal dashed line on the previous plot that passes through the cutoff frequency.

Low pass filter graph with cut off frequency shown

clear all;

close all;

x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4];

y = [3.7 3.68 3.6 3.5 3.38 3.26 3.12 2.98 2.85 2.85 2.72 2.6 2.47 2.37 2.26];

z = [0 1.05 1.04 1.02 .99 .96 .92 .88 .84 .81 .77 .74 .69 .67 .64];

plot(x, z)

xlabel('Frequency(KHz)', 'FontSize', 12)

ylabel('Vout(rms)', 'FontSize', 12)
hold on;

x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4];

z = .707

plot(x,z,'k+', 'LineWidth', 6)
xlabel('Frequency (kHz)', 'Fontsize', 12)
ylabel('Vout/Vin (V)', 'FontSize', 12)
hold off;

High Pass Filter (1-4)

1. 
High pass filter table

clear all;

close all;

x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4];

y = [0 .5 .7 1.05 1.35 1.63 1.86 1.97 2.03 2.11 2.14 2.16 2.17 2.17 2.18];

z = [0 .14 .19 .29 .37 .46 .52 .55 .57 .59 .6 .61 .61 .61 .62];

plot(x, z)

xlabel('Frequency(KHz)', 'FontSize', 12)

ylabel('Vout(rms)', 'FontSize', 12)
hold on;

x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4];

z = .4

plot(x,z,'k+', 'LineWidth', 6)
xlabel('Frequency (kHz)', 'Fontsize', 12)
ylabel('Vout/Vin (V)', 'FontSize', 12)
hold off;

High pass filter graph with cutoff frequency shown



Monday, March 13, 2017

week 9

1. Measure the resistance of the speaker. Compare this value with the value you would find online.

  • The speaker has a resistance of 9ohm
2. Build the following circuit using a function generator setting the amplitude to 5V (0V offset). What happens when you change the frequency? (video)
Figure 1: Video showing speaker function.
Figure 2:Table displaying speaker functions at different frequencies.


3. Add one resistor to the circuit in series with the speaker (first 47 Ω, then 820 Ω). Measure the voltage across the speaker. Briefly explain your observations.

Fill the following table. Discuss your results.

Figure 3: Table showing differences with different resistors.

4. Build the following circuit. Add a resistor in series to the speaker to have an equivalent resistance of 100 Ω. Note that this circuit is a high pass filter. Set the amplitude of the input signal to 8 V. Change the frequency from low to high to observe the speaker sound. You should
not hear anything at the beginning and start hearing the sound after a certain frequency. Use 22 nF for the capacitor.

a. Explain the operation. (video)

Figure 4: Video showing high pass filter.


b. Fill out the following table by adding enough (10-15 data points) frequency measurements. Vout is measured with the DMM, thus it will be rms value.

Figure 5: Table displaying values for high pass filter.

c. Draw Vout/Vin with respect to frequency using Excel.

Figure 6: Graph of high pass filter Vout/Vin vs. Frequency


d. What is the cut off frequency by looking at the plot in b?

  • The cutoff frequency occurs when the Vout/Vin ratio is 1/2 of the max Vout. In our case this occurred between 8 and 10 KHz. 

e. Draw Vout/Vin with respect to frequency using MATLAB. Your code would look like this;

Figure 7: Vout/Vin vs Frequency graph using MATLAB

f. Calculate the cut off frequency theoretically and compare with one that was found in c.

  • The max theoretical cutoff frequency gives us a value of 9KHz. We got this value by taking half the max of Vout and finding when Vout/Vin is equal to it. The one we found in part c was between 8 and 10KHz, which is close to the theoretical value. 

g. Explain how the circuit works as a high pass filter.

  • Its a high pass filter because it allows high frequency signals and cuts off low frequency signals. This happens as a result of the capacitor's inductance being dependent on frequencies and its relationship when in series. The capacitor has high resistance to low frequencies and low resistance to high frequencies.

5. Design the circuit in 4 to act as a low pass filter and show its operation. Where would you put the speaker? Repeat 4a-g using the new designed circuit.

  • The speaker is in parallel to the capacitor rather than in series.

a. Explain the operation. (video)

Figure 8: Video explaining low pass filter.


b. Fill out the following table by adding enough (10-15 data points) frequency measurements. Vout is measured with the DMM, thus it will be rms value.

Figure 9: Table displaying low pass filter values.


c. Draw Vout/Vin with respect to frequency using Excel.

Figure 10: Graph of low pass filter Vout/Vin vs Frequency.


d. What is the cut off frequency by looking at the plot in b?

  • The cutoff frequency is 8KHz.

6. Construct the following circuit and test the speaker with headsets. Connect the amplifier output directly to the headphone jack (without the potentiometer). Load is the headphone jack in the schematic. “Speculate” the operation of the circuit with a video.


The video above explains the operation.

Sunday, March 12, 2017

Draw and explain a Rube Goldberg design that will include the following components:


* Digital
* Motor
* Relay
* Opamp
* Temperature sensor
* LED

  • The circuit we prepared contains three different steps in order to make it work effectively. We used a temperature sensor in order to send an output. We realized the output sent by the temperature sensor was not high enough to activate the relay, so in order to make it work the temperature sensor was connected to a non-inverting opamp. This gave us a gain of 6 which is high enough for the relay to be activated. This same output was sent to our LED and Digital in order to let us know when the relay was activated.  Once we successfully triggered the relay a voltage of 6 volts was sent straight to our DC motor. 

  • Our Rube Goldberg consisted of a DC motor attached to a device similar to a crane. The DC motor is attached to a cup with a marble inside by a string which is consistently pulled up until it reaches a desired angle. Once it reaches that angle the ball falls through an opening in the cup making it go down the ramp and achieving the desired purpose.

Video of our Rube Goldberg with explanation:

Figure 1: video displaying how the rube goldberg circuit works.
Figure 2: Picture of the circuit before the relay switches.

Figure 3: Picture of the circuit after the relay is switched.

Figure 4: Drawing of circuit.




  • We had issues with time constraints which prevented us from having our digital display showing something other than the number 7, which is our group number. We had issues with time because our original circuit had a broken relay and 555 timer that took up a majority of the time on our first day, we then had to start over on wednesday which set us back. The only problem we faced after starting over again was the temperature sensor wasn't giving an output until we replaced it and the op-amp wasn't the correct one corresponding to the relay.