Monday, March 20, 2017

Week Ten

Not Shocking People Whilst Using MATLAB

Week Ten

%1 
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)

clear all; %2 clear all removes prior variable and function definitions

close all; %3 closes any prior command based windows (i.e. plot, ext.)

x = [1 2 3 4 5]; 

y = 2.^x;

plot(x, y, 'LineWidth', 6)

xlabel('Numbers', 'FontSize', 12)

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

%4 when typing x and pressing enter, the prior logged values for x appear
%the matrix has one row and five colomns.

%5 the semicolon is used when defining the function, which without it, would
%the values would not be stored and the plot function nor defined

%6 If a . is not used before the power, the x values will be read as a whole
%matrix instead of being recognized individually.

%7 It affects the thickness of the line that is plotted

%8
clear all; 
close all; 
x = [1 2 3 4 5];

y = 2.^x;

plot(x, y, '-rO','LineWidth', 5,'markersize',18)

xlabel('Numbers', 'FontSize', 12)

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



%9
clear all; 
close all; 
x = [1; 2; 3; 4; 5;];

y = 2.^x;

plot(x, y, '-rO','LineWidth', 5, 'markersize',18)

xlabel('Numbers', 'FontSize', 12)

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



%The plot stays the same, as these colons are already expressed when the .
%is placed before the ^

%10
clear all; 
close all; 
x = [1 2 3 4 5];

y = 2.^x;

plot(x, y, ':ks','LineWidth', 6, 'markersize',14)
grid on
xlabel('Numbers', 'FontSize', 12)

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



%11
%a : on google calculator
%sin(30)=0.5

%b
%sin(30) = -0.9880
%They are differenct because google automatically calculates sin using
%degree values inside the parenthesis, whereas when in MATLAB, sin(x) is a
%radian command, while sind(x) is using degrees

%c
%sind(30) = 0.5000

%12
clear all;
close all;
t = linspace(0,0.12,10);
y = 10*sin(100*t);
u = linspace(0,0.12,1000);
z = 10*sin(100*u);

plot(t,y,'-ro')
hold on
plot(u,z,'-k')

xlabel('Time(s)')
ylabel('y function')
legend('Course','Fine')



%13 
%Differences: Two plots were formatted atop one another using the hold on
%command, the variables were defined using intervals of range of values,
%there was a legend added.

%14
clear all;
close all;
t = linspace(0,0.12,10);
y = 10*sin(100*t);
u = linspace(0,0.12,1000);
z = 10*sin(100*u);
f=find(z>5)
z(f)=5
plot(t,y,'-ro')
hold on
plot(u,z,'-k')

xlabel('Time(s)')
ylabel('y function')
legend('Course','Fine')


PART B
1.

2.
%PART B
%2

clear all;
close all;
f=[.1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2]
v=[3.25 3.82 3.66 3.58 3.5 3.4 3.3 3.2 3.07 2.96 2.85 2.75 2.63 2.53 2.45 2.35 2.28 2.2 2.12 2.05]

plot(f,v,'-ro')

xlabel('frequency(KHz)')
ylabel('V out(V)')
grid on


3.
fc= 1/(2*3.141593*7500*0.000000022)
fc =

  964.5753

%The voltage at 965 is 3

clear all;
close all;
f=[.1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2];
v=[3.25 3.82 3.66 3.58 3.5 3.4 3.3 3.2 3.07 2.96 2.85 2.75 2.63 2.53 2.45 2.35 2.28 2.2 2.12 2.05];
c=find(v>3)
v(c)=3
plot(f,v,'-ro')

xlabel('frequency(KHz)')
ylabel('V out(V)')
grid on


%4
clear all;
close all;
f=[.1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2];
v=[3.25 3.82 3.66 3.58 3.5 3.4 3.3 3.2 3.07 2.96 2.85 2.75 2.63 2.53 2.45 2.35 2.28 2.2 2.12 2.05];
c=find(v>3)
v(c)=3
plot(f,v,'-ro')
hold on
y=[.1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2];
u=[3.25 3.82 3.66 3.58 3.5 3.4 3.3 3.2 3.07 2.96 2.85 2.75 2.63 2.53 2.45 2.35 2.28 2.2 2.12 2.05];
plot(y,u,'--k')
legend('output with cutoff','output')

xlabel('frequency(KHz)')
ylabel('V out(V)')
grid on

Monday, March 13, 2017

Week Nine

Not Shocking People After Spring Break

Week Nine

1. Measure the resistance of the speaker.

We measured 8.6 Ohms, while online is says this model of speaker offers 32 Ohms.

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: Frequency of AC Voltage applied to a speaker.

Figure 2: Circuit Layout

Figure 3: Frequencies compared speaker output.

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.



Figure 4: Observations while placing resistors in parallel with speaker. The higher the resistor, the lower the amplitude. Therefore, the lower the volume.

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 shouldnot hear anything at the beginning and start hearing the sound after a certain frequency. Use 22 nF for the capacitor.

a.
Figure 5: Video explaining the operation of the high pass  filter connected to the speaker.

b. & c.
Figure 6: V_out measured and V_out/V_in Calculated with respect to frequency increasing.

d. It looks like the cutoff frequency is 5000 with the voltage V_out capping off at 0.014V.
e. 
Figure 7: Plot of Frequency v. Output. The climax of the curve shows the critical frequency of the circuit.

f. The Cutoff Frequency according to our plot and theoretical calculations is 5000 Hz.
g. As the frequency increases, to a high 2000 Hz, the voltage amplitude takes on a significant enough value to be audible to human ears. However, when the frequency reaches 5000 Hz, the voltage reaches its cutoff point and begins to decrease. 

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.

We would place the speaker in parallel with a capacitor, the pair of which would be in series with a resistor. 

a.
Figure 8: Video explaining the operation of the low pass filter.

b. & c.
Figure 9:V_out measured and V_out/V_in Calculated with respect to frequency increasing in a low pass circuit.

d. The cutoff frequency is at 1000, capping off at .596 V.
e.
Figure 10: Plot of Frequency v. Output of a low pass circuit. The climax of the curve shows the critical frequency of the circuit.

f. According to the plot, our cutoff frequency is at 1000.
g. The low pass filter works in a way where the capacitor works as an extremely high resistance to low frequency signals, making them pass to the speaker, whereas high frequency will pass through the capacitor, and not to the speaker, as can be seen above. 

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.


Figure 11: Video with speculation of the operation of the circuit.


Friday, March 3, 2017

Week Eight

Week Eight

NOT SHOCKING PEOPLE

Steps of Rube Goldberg Circuit

Figure 1: Video of Rube Goldberg Function

Circuit Explanation

Figure 2: Step 1: The Pressure sensor is pressed by a weighted object.
Figure 3: Step 2: The light of the LED connected to the OR gate turns on, informing the user that we must begin applying heat to the temperature sensor. 
Figure 4: The gate mentioned in step 2
Figure 5: Image of AND gate on bottom and driver on top. The and gate inputs are connected to the relay input is parallel and the pressure sensor. When both of these are active the counter will begin to function.
Figure 6: Step 3: The heat provided to the temperature sensor allows for a voltage and  current to flow into the ompamp, amplifying the current, allowing the relay to switch on. 
Figure 7: Step 4: Once the and gate is satisfied with two active inputs, then the driver begins to send signals to the counter, which then sends signal to the digital display, starting the count up from 0 to 9 and then repeating.
Figure 8: Step 5: Once the relay is active, current is applied to a motor which spins this mechanical apparatus, knocking over something important and making something happen for somebody else.


Struggles


One struggle we faced was getting the relay to switch while connected to the temperature sensor. We noticed that there was not enough voltage going between the temperature sensor output to the relay (only 1V). We first tried to fix this with a 741 amplifier being placed between the two, but that did not amplify the current enough to switch on the relay. Instead, we used an opamp to amplify, which introduced our next problem.

Another struggle we faced was applying the proper gain to the opamp to switch the relay on, even though we knew it could work, we were concerned why it wasn't. What we had found was that we were applying too small of a voltage to the voltage input to power the opamp. After increasing the opamp voltage to 20 V, the amplified voltage and current was able to reach the appropriate amplitude to switch the relay on. 

Monday, February 20, 2017

Week Seven

Week 7

Not Shocking People


1. Force sensing resistor gives a resistance value with respect to the force that is applied on it. Try different loads (Pinching, squeezing with objects, etc.) and write down the resistance values.

Figure 1: Resistance values with different forms of applied pressures.
From our data, when there is no applied force, it is read as if there is no connected circuit or resistor at all with the reading of 0L, when a little force was applied a resistor measurement could be read. However, as we increased the amount of force on the FSR, the resistance decreased. 

2. 7 Segment display:

a. Check the manual of 7 segment display. Pdf document’s page 5 (or in the document page 4) circuit B is the one we have. Connect pin 3 or pin 14 to 5 V. Connect a 330 Ω resistor to pin 1. Other end of the resistor goes to ground. Which line lit up? Using package dimensions and function for B (page 4 in pdf), explain the operation of the 7 segment display by lighting up different segments. (EXPLAIN with VIDEO).

Figure 2: Video explaining the 7 segment display circuit and its operations, with demonstration.


b. Using resistors for each segment, make the display show 0 and 5. (EXPLAIN with PHOTOs)

Figure 3: Placing the resistors in series with the negative ends of the correct diodes that light the display, the number 0 is able to be represented in the display.

Figure 4: Representation of 5 with the display.


3. Display driver (7447). This integrated circuit (IC) is designed to drive 7 segment display through resistors. Check the data sheet. A, B, C, and D are binary inputs. Pins 9 through 15 are outputs that go to the display. Pin 8 is ground and pin 16 is 5 V.


a. By connecting inputs either 0 V or 5 V, check the output voltages of the driver. Explain how the inputs and outputs are related. Provide two different input combinations. (EXPLAIN with PHOTOs and TRUTH TABLE)

Figure 5: Showing when the d output pin in the display driver gave a 1 output (5V), and the light off due to such.

Figure 6: When d output pin gives a 0 output(0V), and the light turns on.

Figure 7: When the binary representations of decimal numbers are represented in the driver inputs of A,B,C, and D, the outputs of a,b,c,d,e,f, and g will change.


b. Connect the display driver to the 7 segment display. 330 Ω resistors need to be used between the display driver outputs and the display (a total of 7 resistors). Verify your question 3a outputs with those input combinations. (EXPLAIN with VIDEO)




Figure 8: Video Explaining the relationships between the inputs and outputs of the driver with demonstration.


4. 555 Timer:


a. Construct the circuit in Fig. 14 of the 555 timer data sheet. VCC = 5V. No RL (no connection to pin 3). RA = 150 kΩ, RB = 300 kΩ, and C = 1 µF (smaller sized capacitor). 0.01 µF capacitor is somewhat larger in size. Observe your output voltage at pin 3 by oscilloscope. (Breadboard and Oscilloscope PHOTOs)


Figure 9: Overhead shot of circuit setup
Figure 10: Close-up shot of Timer circuit setup
Figure 11: Observed oscilloscope readings



b. Does your frequency and duty cycle match with the theoretical value? Explain your work.

Theoretical Value:
Frequency = 1.44/[(150k + 2 * 300k)*.000001] =  1.92 Hz;  
Duty Cycle = 300k/(150k+2*300k) = 0.4

Measured Value: 
Frequency = 0.5 Hz
Duty Cycle = 0.4


c. Connect the force sensing resistor in series with RA. How can you make the circuit give an output? Can the frequency of the output be modified with the force sensing resistor? (Explain with VIDEO)

Figure 12: Video explanation of Pressure Resistor


5. Binary coded decimal (BCD) counter (74192). This circuit generates a 4-bit counter. With every clock change, output increases; 0000, 0001, 0010, …, 0111, 1000, 1001. But after 1001 (which is decimal 9), it goes back to 0000. That way, in decimal, it counts from 0 to 9. Outputs of 74192 are labelled as QA (Least significant bit), QB, QC, and QD (Most significant bit) in the data sheet (decimal counter, 74192). Use the following connections:


5 V: pins 4, 11, 16.
0 V (ground): pins 8, 14.
10 µF capacitor between 5 V and ground.


a. Connect your 555 timer output to pin 5 of 74192. Observe the input and each output on the oscilloscope. (EXPLAIN with VIDEO and TRUTH TABLE)

Figure 13: Observed output of the 74192 when connected to the timer
Figure 14: Truth table for example


6. 7486 (XOR gate). Pin diagram of the circuit is given in the logic gates pin diagram pdf file. Ground pin is 7. Pin 14 will be connected to 5 V. There are 4 XOR gates. Pins are numbered. Connect a 330 Ω resistor at the output of one of the XOR gates.


a. Put an LED in series to the resistor. Negative end of the LED (shorter wire) should be connected to the ground. By choosing different input combinations (DC 0V and DC 5 V), prove XOR operation through LED. (EXPLAIN with VIDEO)

Figure 15: Proof for XOR operation with LED and Circuit


b. Connect XOR’s inputs to the BCD counters C and D outputs. Explain your observation. (EXPLAIN with VIDEO)

Figure 16: Observations of LED connected to BCD's C and D outputs


c. For 6b, draw the following signals together: 555 timer (clock), A, B, C, and D outputs of 74192, and the XOR output. (EXPLAIN with VIDEO)

Figure 17: Explanation of BCD + Timer outputs and relations


7. Connect the entire circuit: Force sensing resistor triggers the 555 timer. 555 timer’s output is used as clock for the counter. Counter is then connected to the driver (Counter’s A, B, C, D to driver’s A, B, C, D). Driver is connected to the display through resistors. XOR gate is connected to the counter’s C and D inputs as well and an LED with a resistor is connected to the XOR output. Draw the circuit schematic. (VIDEO and PHOTO)

Figure 18: Full circuit and explanation of its operations
Figure 19: Full circuit diagram


8. Using other logic gates provided (AND and OR), come up with a different LED lighting scheme. (EXPLAIN with VIDEO)

Figure 20: Fun with logic gates (Alternate Operations/LED sequence)

Sunday, February 19, 2017

Week Six

Week six

Not Shocking People


1. You will use the OPAMP in “open-loop” configuration in this part, where input signals will be applied directly to the pins 2 and a. Apply 0 V to the inverting input. Sweep the non-inverting input (Vin) from -5 V to 5 V with 1 V steps. Take more steps around 0 V (both positive and negative). Create a table for Vin and Vout. Plot the data (Vout vs Vin). Discuss your results. What would be the ideal plot?







Figures 1 & 2: Values and graph for the voltage output of the non-inverting OPOMP. Values stay consistently at -3.72 while the voltage is below zero, and then stay at 4.46 V once the sign is switched after zero. With this open loop configuration, there are no resistors to limit the amplifier, so the gain is very large, therefor making the maximum values be reached very quickly. We only applied +/- 5 V, so the V_out cannot exceed +/- 5V.  We seemed to have generated the ideal graph, with there being a sudden but recognizable slope in between the values of which the sign changes, representing the fact that the voltage cannot be changed instantaneously.



b. Apply 0 V to the non-inverting input. Sweep the inverting input (Vin) from -5 V to 5 V with 1 V steps. Take more steps around 0 V (both positive and negative). Create a table for Vin and Vout. Plot the data (Vout vs Vin). Discuss your results. What would be the ideal plot?




Figure 3 & 4: Values and graph for the voltage output of the inverting OPAMP. We found identical values, but on opposite signs of the V_in. This is due to the fact that the inverting OPAMP, as it is named, inverts the sign of the output. This is also an example of an ideal graph for the same reason as figure 4.

2. Create a non-inverting amplifier. (R2 = 2 kΩ, R1 = 1 kΩ). Sweep Vin from -5 V to 5 V with 1 V steps. Create a table for Vin and Vout. Plot the measured and calculated data together.



Figure 5 & 6: Measured and calculated data of the Non-Inverting Amplifier

3. Create an inverting amplifier. (Rf = 2 kΩ, Rin = 1 kΩ). Sweep Vin from -5 V to 5 V with 1 V steps. Create a table for Vin and Vout. Plot the measured and calculated data together.

Figure 7 & 8: Measured and calculated data of the Inverting Amplifier


4. Explain how an OPAMP works. How come is the gain of the OPAMP in the open loop configuration too high but inverting/non-inverting amplifier configurations provide such a small gain?


The OPAMP amplifies an input voltage to become a larger one. When using a non-inverting OPAMP, the amplified output voltage will have the same sign as the input voltage. When using an inverting OPAMP, the amplified output voltage will have the opposite sign of the input voltage.
With an inverting/non-inverting amplifiers, the gain is determined by the ratio of the resistors and multiplied by the input voltage to generate the output. However, with the open loop configuration, there are no resistors to limit the effect of the amplifier so the highest and lowest possible voltages can be reached very quickly. 


Relay 

1. Connect your DC power supply to pin 2 and ground pin 5. Set your power supply to 0V. Switch your multimeter to measure the resistance mode; use your multimeter to measure the resistance between pin 4 and pin 1. Do the same measurement between pin 3 and pin

1. Explain your findings (EXPLAIN).


When we measured between pins 1 and 4, we found the resistance to be .5 Ohms. When we measured between pins 1 and 3 we read the resistance to be 0L, meaning that it could not be read. This is because the switch inside the relay between 3 and 4 must have been connected to 4, therefor allowing a resistance to be read. Pin 3 was not connected to 1, therefor not allowing a proper resistance to be measured.

2. Now sweep your DC power supply from 0V to 8V and back to 0V. What do you observe at the multimeter (resistance measurements similar to #1)? Did you hear a clicking sound? How many times? What is the “threshold voltage values” that cause the “switching?” 

Figure 9: Observations of the relay video with explanations.



3. How does the relay work? Apply a separate DC voltage of 5 V to pin 1. Check the voltage value of pin 3 and pin 4 (each with respect to ground) while switching the relay (EXPLAIN with a VIDEO).


Figure 10: Explanations and found values of the relay circuit video.

LED + Relay

1. Connect positive end of the LED diode to the pin 3 of the relay and negative end to a 100 ohm resistor. Ground the other end of the resistor. Negative end of the diode will be the shorter wire.

2. Apply 3 V to pin 1

3. Turn LED on/off by switching the relay. Explain your results in the video. Draw the circuit schematic

Figure 11: Video explaining results and operation of the relay/LED circuit.
Figure 12: Circuit Schematic



Operational Amplifier (data sheet under Bb/week 6)
1. Connect the power supplies to the op-amp (+10V and 0V). Show the operation of LM 124 operational amplifier in DC mode with a non-inverting amplifier configuration. Choose any opamp in the IC. Method: Use several R1 and R2 configurations and change your input voltage (voltages between 0 and 10V) and record your output voltage. (EXPLAIN with a TABLE)

Figure 13: Table of Measured V_out. The gain is dependent on the ratio of R2/R1. As you can see with the measurements of R2=2K, the gain is high enough for the V_out to reach maximum voltage near immediately, whereas the other has a bit of an incline before it reaches max.

Post Blog Note:

All questions near end of blog sheet were not able to be complete, as there was not a temperature sensor available to this group. (Questions 2,3, 4: Operational Amplifier)

Monday, February 6, 2017

Week Five

Week Five

Not Shocking People

1. Functional check: Oscilloscope manual page 5. Perform the functional check (photo).

 

Figure 1&2: Images of out functionality test

2. Perform manual probe compensation (Oscilloscope manual page 8) (Photo of overcompensation and proper compensation).

Figures 3 & 4: Image on the right of slight over compensation, image on the left of proper compensation.

3. What does probe attenuation (1x vs 10x) do (Oscilloscope manual page 9)?

1 X: Whatever your probe is reading, that is what the measurement truly is. 
10 X: Whatever your probe is reading, your probe will multiply the display times 10.


4. How do vertical and horizontal controls work? Why would you need it (Oscilloscope manual pages 34-35)?

There are two knobs allowing you to change the horizontal and vertical position of the wave function. The horizontal position control allows you to establish the time between the screen center and the trigger, and can help you establish the period of the wave function. The vertical controls can allow you to establish the peak and peak to peak voltage of the voltage. 


5. Generate a 1 kHz, 0.5 Vpp around a DC 1 V from the function generator (use the output connector). DO NOT USE oscilloscope probes for the function generator. There is a separate BNC cable for the function generator.

a. Connect this to the oscilloscope and verify the input signal using the horizontal and vertical readings (photo).

Figure 5: Image of our function as specified in the question

b. Figure out how to measure the signal properties using menu buttons on the scope.

Select the measure button. From there you can select the different forms of measurement that automatically read the data from the wave function.


6. Connect function generator and oscilloscope probes switched (red to black, black to red). What happens? Why?

The signal held static. The warning saying "Unknown signal" appeared. It was not able to be read. This is because the common ground of the oscilloscope is applying zero volts to the function generator, making it short. 


7. After calibrating the second probe, implement the voltage divider circuit below (UPDATE! V2 should be 1.0Vac and 2Vdc). Measure the following voltages using the Oscilloscope and comment on your results:

*Changed to be able to match function generators limitations
a. Va and Vb at the same time (Photo)

Figure 6 & 7: Photo on the left is of  the measurements placed side by side. The second channel measured a small indeterminate value whilst the first channel measured 750 mV(pp)

b. The voltage across R4.

DMM Measurement: DC=1.34 V    AC = 0.354 V

8. For the same circuit above, measure Va and Vb using the handheld DMM both in AC and DC mode. What are your findings? Explain.

Va: DC=1.348V   AC=0.353V

Vb: DC=2.698V   AC=0.710V


9. For the circuit below
a. Calculate R so given voltage values are satisfied. Explain your work (video)

Figure 8: Video showing how R value is found.


b. Construct the circuit and measure the values with the DMM and oscilloscope (video). Hint: 1kΩ cannot be probed directly by the scope. But R6 and R7 are in series and it does not matter which one is connected to the function generator.



Figure 9 & 10: Videos, measuring resistance


10. Operational amplifier basics: Construct the following circuits using the pin diagram of the opamp. The half circle on top of the pin diagram corresponds to the notch on the integrated circuit (IC). Explanations of the pin numbers are below:
1: DO NOT USE 8: DO NOT USE
2: Negative input 7: +10V
3: Positive input 6: output
4: -10 V 5: DO NOT USE
a. Inverting amplifier: Rin = 1kΩ, Rf = 5kΩ (do not forget -10 V and +10 V). Apply 1 Vpp @ 1kHz. Observe input and output at the same time. What happens if you slowly increase the input voltage up to 5 V? Explain your findings. (Video)

Figure 11: Inverted Amplifier


b. Non-inverting amplifier: R1 = 1kΩ, R2 = 5kΩ (do not forget -10 V and +10 V). Apply 1 Vpp @ 1kHz. Observe input and output at the same time. What happens if you slowly increase the input voltage up to 5 V? Explain your findings. (Video)

Figure 12: Non-inverted amplifier