Friday, February 20, 2015

Feb 19: Diodes

Diode
-"one-way streets" of electronic circuits; allow current to flow through them in one direction only (in direction of the arrow)
-Ideal diode (I-V curve):

Note the instantaneous increase in current towards infinity as soon as the voltage changes sign. In reality, the sharp increase isn't as instantaneous. There is a bit of a gradual rise (in the beginning) and a nonzero change in voltage.


-Effective resistance = V/I
so for a forward-biased diode, R about 0 (current flows without opposition)
and for a reversed-biased diode, R approaches infinity (current will not flow)

-The forward-biased diode we used that carried an appreciable current has a fixed voltage drop across the diode of about 0.6 V (our "regular" silicon diode).


Measuring the Resistance of a Diode:
-Changed settings on the meter
  • At the 20 MOhm scale, we read resistance of 4.84 MOhms.
  • At the 2000 MOhm scale, we read resistance of 11 MOhms. 

The 20 MOhm (smaller resistance) scale produced larger current (the beginning of the steeply rising portion of the I-V plot). 

To summarize, the magnitude of the current depends on the scale selected. Smaller resistance scale users larger currents.

For a forward-biased diode, the resistance that the meter measures will be smaller as scale becomes more sensitive (smaller scale). 


Half Wave Rectifier
-Rectifier = converts AC signal into DC signal (unchanging polarity or sign)
-Use: to provide a constant, stable voltage supply... but readily available power supply usually wall socket which provides AC voltage

Explanation: Until the voltage hits 0.6 V, the diode doesn't conduct (by the nature of diodes described previously). And when the sign of voltage is negative, there is no flow (there would be a negative flow but the diode prevents that. So in these regions, V = 0). So, at every positive V point, we expect to see it be 0.6 V smaller than what we saw in the input.

Half Wave Rectifier, Experimentally (Lab 3-2)

circuit used

We observed what we expected (only positive voltages. Negative voltages gone because no current flow in that (opposite) direction).
We then compared the input (blue) and output (yellow) voltages and saw that the amplitudes of the bumps of the output voltage has also decreased by 0.6 V, which was what we expected.

Closer Look:
We measured the voltage difference between Vin and Vout at the time when the input and output voltages peak, which was 0.640 V (relatively close to 0.6 V). When we repeated for one other part of the waveform when Vout > 0, we measured 0.480 V, so the voltage difference at other points of the wave seemed to be smaller than that at the peak. Also, Vpeak > 6.3 V because the 6.3 V on the transformer referred to its rms, which is different from the amplitude of the wave. The amplitude is greater than the rms by a factor of sqrt(2). We measured the rms value of the transformer (using the voltmeter), which was 7.5 V, and the input voltage difference of the circuit was 10.8 V. By looking at this ratio, amplitude of input voltage/rms, we got 10.8 V/7.5 V = 1.22 = sqrt(2), which matched the theory. Thus, Vpeak > 6.3 V as amplitude (or Vpeak)  > rms by a factor of sqrt(2). 


Ripple
-Now adding a capacitor in parallel with the load resistor...

-What does this do? AND SIGNIFICANCE?
This adds a RC time lag so that the output voltage will be effectively "bridged" between the peaks we observed above. In other words, before the output voltage just falls as the falling portion of the sine wave, the addition of the capacitor causes the charged capacitor to discharge/drain more slowly (so output voltage doesn't go down to 0 like last time). And in addition, if R-load and C of the circuit are large enough such that R-load*C >> 1/60 (time between two positive portions of the cycle observed in the experiment above), then the capacitor will not discharge very much before it starts charging again, so this "ripple" will be small. Ideally, if it is small enough, it can almost be like having a constant or nearly constant voltage. But even with large R and C, input voltage may fluctuate (need a voltage regulator to stabilize voltage).

Voltage much more "constant" than when just using the half wave rectifier circuit

Ripple Amplitude
-Added a 47 uF capacitor in parallel with the 2.2 kOhm load resistor in the half wave rectifier circuit.

Calculate ripple amplitude:
delta V approx = (1/60 s)/(R-load*C) = 10.8(1/60 s)/(2.2 kOhms * 47 uF) = 1.6 V

Measure ripple amplitude:
delta V = 1.4 V

The values are relatively similar, taking into account the uncertainties of both the resistor and capacitor.


Signal Diodes, Experimentally (Lab 3-5)
Square wave, 10 kHz, 5 V peak to peak

Observation: What we saw on the oscilloscope was just like what we saw last week with the differentiator. The square wave was differentiated, in which the voltage became a straight line (constant) except the relatively sharp peaks at where the square wave began to rise or fall very quickly. 

Removed the 2.2 kOhm resistor and saw:
Long decay time (even after a cycle of square wave ends)

Looks familiar... but we never used a capacitor in the circuit...

We see this on the oscilloscope due the "parasitic capacitors" in the circuit effectively in series from the capacitance of the scope, cable, breadboard, and etc (not actual capacitors but the effect of having capacitors in series).

RC discharge with 2.2 kOhms:
Time constant = RC = 96 ns --> C = 44 pF (R = 2.2 kOhms)

RC discharge without 2.2 kOhm resistor:
Time constant = RC = 31 microseconds --> C = 31 pF where R = 1 MOhms from the scope

SIGNIFICANCE: So, the output voltage appears to be differentiated and rectified in that  only the positive portion of the square wave is getting through as the output (like the exercise before).


Diode Clamp

Outputs:


Observations:
-Voltage never got greater than 6.6 V (expected this value to be 5.6 V because we used a 5 V input (Arduino)... so on the other side of the diode, we expected 5 + 0.6 = 5.6 V). This may have been due to use of AC coupling on the scope (vs. DC). We will fix this soon!
-Also, though the voltage output "plateaus" at 6.6 V, Vout here is not flat, showing that resistance of the diode is not static (or "dynamic resistance") and how it depends on the voltage across the diode. More quantitatively, we'd have to look at dV/dI, the slope of the V vs. I curve. We could use the triangle wave to do this, since portions of wave are linear, where slopes are easier to determine. 

Update: We tried DC coupling.
Output voltage = 6 V, which is closer to 5.6 V.


Diode Limiter

Why might we care?
-Some instruments can be damaged if applied voltage is too large. So, we need a way to limit the input voltage to < 0.6 V. So, we can keep the shape of the applied signal while limiting the voltage to less than 0.6 V.

-works for both positive and negative input voltages



How does this work?
As mentioned before, this limiter can work for both positive and negative input voltages.
1) For positive input voltage:
-Since the voltage drop across a diode is up to 0.6 V, most of the voltage drop in this circuit is across the 1 kOhm resistor. Then, note that no current goes through the diode on the left. So the voltage across the right diode (0.6 V) is the output voltage. Note that in the photos above, even after changing the amplitude of the applied voltage, the output is limited up to 0.6 V.

2) For negative input voltage:
-Again, most of the voltage drop in this circuit is across the 1 kOhm resistor. However, this time, the current goes through the diode on the left because the negative input voltage is less than the voltage of the ground. (No current flows to the diode on the right.) Therefore, the output is now limited down to -0.6 V.

*These can be used as "protection circuits" to keep instruments from frying from high applied voltage.



Impedances of Test Instruments
-Good for voltage measuring device to have as large input impedance as possible (to prevent perturbing circuit we're measuring as little as possible)


-For instruments to measure high frequency signals (e.g. oscilloscope), input impedance (Zin) is due to 1 MOhm resistor in parallel with ~30 pF of "stray capacitance." (No actual capacitor component). This stray capacitance limits scope's ability to observe high frequency signals. So, we want to make this capacitance as small as possible. 

Magnitude of capacitor's impedance = -i / omega*c

At low frequencies, input impedance close to 1 MOhm (close to the resistance of resistor). In a parallel circuit with resistor and capacitor, smaller resistance dominates (low frequencies imply large impedance for capacitor). Vice versa.

So input impedance of oscilloscope frequency dependent. 



Impedances of Test Instruments, Experimentally 
(Lab 3-8)
1) Measuring Internal Resistance of the DVM
DC Voltage Source: +5V pin on Arduino
"DVM good at what it does" --> high input resistance so we chose to use a 1 MOhm resistor

Created this voltage divider:
where R1 = 1 MOhm, Vin = +5 V

Measured Vout = 4.57 V

So, 4.57 V = (Rint / (Rint + 1MOhm))*5 V 
---> R-int = 11 MOhms


2) Measure the Input Resistance of the Scope
100 Hz sine wave

Similar voltage divider as before:
where R1 = 1 MOhm (because again, a good voltage measuring instrument expected to have high resistance), Vin = 5V

Vout = 24.6 V

So, 24.6 V = (R2/(R2 + 1MOhm))*5V
---> R2 = input resistance of the scope = 1.3 MOhms


3) Measure scope's input impedance
*Note: We were having a hard time getting the expected output signal for this (we expected Vout's amplitude to be half of that of Vin). Then, we realized that we were using the scope probes for Vout, and these scope probes are used to decrease attenuation, which was something we wanted to see in this case.

-We know that the output impedance of the function generator is << 1 MOhm because for a power supply, good to have 0 or very small resistance so voltage is delivered to output instead of dropping significantly across supplier.

What is the low frequency (f < 1 kHz) attenuation?
At low freq --> C high impedance so in parallel with resistor, smaller impedance dominates --> resistance of resistor --> 1 MOhm 
-In this case, this circuit is like a divider (both resistances around 1 MOhm... 1 MOhm resistor and we measured about 1.3 MOhms for the input resistance of the scope). So attenuates by 2 (decreased by a factor of 2... "cut" in half). 

At high frequency? (5 kHz)
-C low impedance so now impedance of C dominates --> Zc = -i/omega*C. 

omega = 2*pi*5 kHz
C = ~ 30 pF (our oscilloscope has ~30 pF of stray capacitance)
(R = 1.3 MOhms (solved in #2))

so Zc = impedance of capacitor = 1.1 MOhms

Check:
Req = (1.3 MOhm*1.1MOhm)/(1.3 MOhm + 1.1 MOhm) --> Req  = 6E5 Ohms
Then voltage divider.

V-out = (6E5/(6E5+1E6))*2V = 0.75 V = 750 mV

Our V-out values were not very close, so we'll try it again next time!



4) Looking at Oscilloscope Probes
-Since Z-in (input impedance) is frequency dependent, different frequency components of a signal can be attenuated by different amounts --> distortion. To minimize this, we use an oscilloscope probe.
-suppresses or exaggerates high frequencies by changing capacitance (not actual capacitors but behave/result in having effects of capacitors). 
-The x10 probe raises input impedance of oscilloscope by a factor of 10 for all frequencies--> attenuates signal
-but decreases sensitivity by a factor of 10 (bad for looking at very weak signals)
-variable capacitance 
suppressing vs. exaggerating

When using these probes, want to adjust the "compensation" screw to have "perfect" rectangle/square waves:



5) Measure the internal resistance of the function generator. 
-Knew this value would be relatively low because again, for a power supply, good to have 0 resistance so voltage is delivered to output instead of dropping significantly across supplier. 
-So used R = 47 Ohms
Vin = 1V using the function generator

First circuit to look at Vin. Then, second to look at Vout.

Vin = 1 V
Vout = 0.504 V (which indicated R1 would be close to 47 Ohms)

0.504 V = (47/(R1 + 47))*1 V
--> R1 = 46 Ohms






















Monday, February 16, 2015

Feb 13: Capacitors (High Pass/Low Pass Filters)

Reactance of a Capacitor
-Consider a circuit with a time varying source and a capacitor (without a resistor).
-Using the definition of capacitance and differentiating, we obtain I = C*dV/dt, which we can then show that there is a 90 deg phase shift between V(t) and I(t), with the ratio of voltage amplitude to current amplitude of 1/ωC. 
-Recall that for resistors driven by a time varying source, using Ohm's Law, we found that V(t) and I(t) were in phase (0 deg phase shift) with the ratio of voltage amplitude to current amplitude of R. Thus, 1/ωC can be considered as being analogous to the resistance. This quantity 1/ωC is the capacitive reactance.
-Note that ω = 2*pi*f
-In many ways, capacitors behaves as a resistor (a freq-dependent resistance of 1/ωC). Thus, at high frequencies (which is like having a "resistance" of 0), capacitors start to look like a "short circuit," whereas at low frequencies (which is like having an infinite "resistance"), capacitors start to look like an "open" circuit.

An RC differentiator, experimentally
-Only works at low frequency regime ... after that range, the circuit behaves as just a regular RC circuit. (voltage across resistor << voltage across capacitor)
-We were able to see this as we manually varied the frequency of a square wave from 500 Hz to 100 kHz where we noted the behavior of the "differentiator" circuit for cases where ω << 1/RC was no longer satisfied. (1/RC = 1/(100k Ohms*100pF) = 100 kHz). The frequency we measure and can adjust is f, which is ω/2pi, so ω was still relatively large (not << 1/RC). 
(square wave output voltage at 100 kHz)


-After constructing the RC differentiator, we drove it with a square wave with a frequency of 100 kHz and 1 Vpp amplitude. We then tried the triangle wave and sine wave.
-We expected this output voltage (vs. time) with peaks having a width ~RC. The circuit is unable to differentiate the high frequency components of the square wave and as a consequence of the time lag by the RC circuit, we see these peaks with widths. 

As the name suggests, we saw that the input voltage function was differentiated:


 


*Side Note: Because we saw some significant oscillations on the output voltage on the oscilloscope, we used scope probes instead of regular coaxial cable. After the replacement, we saw significant decrease in these oscillations: (before and after)

Input Impedance
  • Input Impedance at DC (impedance to get to ground) = infinity (f = 0 --> ω = 0 --> zc = 1/0 = infinity)

  • Input Impedance at infinite frequency = resistance of resistor (100 kOhms) because impedance of capacitor = 1/infinity = 0 (looks like a wire)


Filters
Low Pass Filter
-Circuits containing capacitors behave differently as frequency changes (we can think of capacitors as frequency-dependent resistors).
-Then, we can see this circuit as being a type of divider.


-Similar to a voltage divider with two resistors:

  • If 1/ωC >> R, then Vout is approx equal to Vin. 

This is because if R is very small compared to 1/ωC , the voltage drop across R is negligible (compared to the Vin or Vp value), making Vout close to Vin. 


  • If 1/ωC << R, then Vout << Vin 

This is because if 1/ωC is very small compared to R, the voltage drop across R is significant, making the voltage drop across 1/ωC negligible (or much less than Vin or Vp).

Conclusion: Thus, for low frequencies (low ω), Vout is approx equal to Vin, and for high frequencies, Vout << Vin, making this circuit a LOW PASS FILTER. It lets through low frequencies while high frequencies are attenuated. 


Complex Impedance (Still about Low Pass Filter)
-Using complex numbers to characterize impedance (because it has both a magnitude and a phase), the reactance of a capacitor can be written as -i/ωC. Then, just as before (using resistance), Vout = (X/(R+X))*Vin, where X is the reactance. 
-Using the relative amplitudes of the signals, |Vout|/|Vin|, we see that if ω << 1/RC, then |Vout|/|Vin| approx = 1, whereas if ω >> 1/RC, |Vout| << |Vin|.
-We see that the cutoff frequency (threshold) of 1/RC roughly shows the boundary between frequencies that pass or don't pass.
-Also, using Vout = (X/(R+X))*Vin again, but now looking at the imaginary portions, we can simplify to 1/(1+iωRC). We can see that at low frequencies, the imaginary term doesn't contribute significantly, leading to input and output voltages being nearly in phase. Here, the capacitor's impedance is more significant vs. impedance of the resistor. On the other hand, at high frequencies, the impedance of the capacitor is less significant, leading to a more significant imaginary term. Thus, the voltage across the capacitor will be nearly 90 degrees out of phase with the input voltage. 

Decibels
-ratio of two voltages usually given in decibels
-In low pass filter circuit, at cutoff freq ω0, the ratio of signal (Vout/Vin) attenuated by a factor of 1/sqrt(2), which is equal to -3.01 dB.

Q: Beyond the cutoff, the response of a low pass filter drops at a rate of 6dB per octave. Explain.
-Beyond the cutoff, meaning at high frequencies, Vout is attenuated at a rate of 6 dB/octave. This is 2*3 dB. And frequency doubles per octave. This means that the amplitude of Vout drops by a factor of 2 per octave at these high frequencies as frequency is doubled. 

In other words:

Low Pass Filters, Experimentally
-Integrator vs. Low Pass Filter 
Integrator is a special case of a low pass filter. This circuit is a decent integrator only at high frequencies. 

What do you calculate to be the filter's -3 dB frequency? ω = 1/(RC) = 1/(1.5 kOhms * 0.01 uF) = 6.7 kHz or f = 1.1 kHz.

-We drove the circuit with a sine wave, sweeping over a large frequency range. 
Observation: We noted that as frequency increased (to a relatively large magnitude), Vout decreased, which was what we expected from theory discussed above.

-We then found the f-3dB experimentally by measuring the frequency at which the filter attenuates by 3 dB (or Vout cut down to 70.7% of full amplitude or Vout = 0.707*Vin) and got a value of 1.2 kHz (which was relatively close to the calculated value, considering uncertainties in the resistor and capacitor). 

What is the limiting phase shift, both at very low frequencies and at very high frequencies?
DC or high freq?
Low freq (0.5 Hz) --> no phase shift.


High freq (25 kHz) --> 90 deg phase shift. 
We determined this phase shift by measuring the delta t using the cursor from peak to peak then dividing by the period. Here, we got (10 us / 40 us)*360 deg = 90 deg


Check to see if Low Pass Filter attenuates 6 dB/octave for frequencies well above -3 dB point (i.e. check if output voltage drops by a factor of 2 as frequency is doubled. Frequencies we choose have to be well above ~1 kHz).
We chose to take voltage measurements at 10 (10 times f-3dB), 20 (20 times f-3dB), and 40 kHz .
Data:
f= 10 kHz --> Vout = 348 mV
f= 20 kHz --> Vout = 178 mV
f= 40 kHz --> Vout = 88 mV

 

(left to right: 10, 20, 40 kHz)
Observation: We do see that at frequencies well above the -3 dB point, the filter attenuates 6 dB/octave.

Phase shifts:
f << f-3dB --> no phase shift (tested above)
f = f-3dB --> (108 us/ 833.33 us)*360 deg = 46.7 deg (close to 45 deg)
f >> f-3dB --> 90 degrees (tested above)

Finally, measure attenuation at f = 2f-3dB and write down the attenuation figures at f  =2f-3dB, 4f-3dB, and 10f-3dB. 

Data:
f = 2 * f-3dB --> 1.32 V/3.00 V
f = 4 * f-3dB --> 740 mV/3.00 V
f = 10 * f-3dB --> 296 mV/3.00 V

Observation: We noted a steep "rolloff" in the attenuation figure (Vout/Vin) as freq increased.


High Pass Filter
-Similar to a voltage divider with two resistors (opposite of low pass filter)

  • If 1/ωC << R, then Vout is approx equal to Vin. 

This is because if 1/ωC  is very small compared to R , the voltage drop across 1/ωC  is negligible (compared to the Vin or Vp value), making Vout close to Vin. 


  • If 1/ωC >> R, then Vout << Vin 

This is because if R is very small compared to 1/ωC , the voltage drop across 1/ωC is significant, making the voltage drop across R negligible (or much less than Vin or Vp).

Thus, for high frequencies, Vout is approx equal to Vin, while for low frequencies, Vout << Vin, making this circuit a HIGH PASS FILTER. It lets through high frequencies (unattenuated) while low ones are. 

Again, the cutoff freq ω0 = 1/RC is the boundary. 


High Pass Filter, Experimentally
Where is this circuit's 3 dB point?
Because the resistor and capacitor is the same as the one we used for the low pass filter, the 3dB point should be the same (~1.1 kHz). Our measured value was 1.04 kHz, which was relatively close, considering our resistors have 10% and capacitors have 20% uncertainties.

Check out how the circuit treats sine waves.
(out of phase at first glance; haven't played around with frequencies yet)

Check to see if the output amplitude at low frequencies (well below 3dB point) is proportional to frequency.
Yes, we saw the "linear" portion of the curve and checked for the proportionality by plotting several points and noting a high R^2 value of the regression line and a slope of 0.9208 (almost output voltage equaling frequency?)

Frequency (Hz)
Vout (mV)
500
440
250
256
125
136
62.5
76

 

Limiting Phase Shifts
Low (62.5 Hz) --> (4ms/16ms)*360 = 90 deg
High (25 kHz) --> 0 deg

(Left: low freq, Right: high freq)


Garbage Detector
-Used a "transformer" to make a low voltage (thus "safe") replica of 110-volt power line signal and then use the high pass filter to attenuate the 60 Hz portion of the signal so we can clearly see the high freq "garbage" (unwanted signal/noise) that "sits on top of it." 
-"Transformer" --> reduces the 110 V to 6.3 V and "isolates" circuit we're using from the potentially lethal power line voltage

Looking at A, the output signal looked like a classical sine wave. 
However, looking at B, we saw the glitches and wiggles (the output of the filter). 

What is the filter's 3dB frequency?
Again, it should be around 1.1 kHz, and experimentally, we measured 1.06 kHz.

What is the filter's attenuation at 60 Hz? 
We know that amplitude grows linearly with frequency at frequencies well below f-3dB, so we measured the "slope" or rate at a low frequency. We got 55.2 mV / 6.3 V = 0.009. BUT high pass filters don't (significantly) attenuate high frequency signals (although I thought these frequencies had to be well over f-3dB.) I was expecting a higher attenuation value at 60 Hz, which is a relatively low frequency. I may want to redo this exercise to check. The value we got seemed small. Here, 60 Hz would be considered as "noise."


Blocking Capacitor

-"tug of war" between two power supplies --> Think of the circuit as Thevenin equivalent circuits for each power supply. Voltage at point A = 15 V - I(Rth1) using Kirchoff's Law(?) which equals 15 V - (10V/(Rth1 + Rth2))*Rth1.
From here, we can see that if Rth1 << Rth2, V at A is close to 15 V and if Rth1 >> Rth2, V at A is close to 5 V (current flowing in the way of least resistance). Thus power supply with smaller output impedance tends to win out. 
-For DC voltages, the function generator is effectively no connected to output (whereas for AC, it is).

-Thus, the AC voltage supplied will "ride on top of " the 5V DC voltage supplied by the voltage divider. 

-This is what we've been talking about more broadly about AC coupling mode. AC coupling "blocks" any DC signals (with a blocking capacitor in series with a 1 MOhms input impedance of the scope). In other words, this RC circuit is a high pass filter with a very small cutoff freq that lets "high" (low cutoff so doesn't take much to be considered high) signals through and we are able to view a small AC signal that rides on top of a large DC offset. 

Blocking Capacitor, Experimentally
-Instead of attenuating noise, blocking unwanted DC signals

-Wiring up circuitry A
Observations:
This circuit let the AC signal "ride on" 5 V, but it in fact "rides on" 1.6 V (1/3 of 5) offset. This portion seemed to have "blocked" about 2/3 of the DC offset.

-Wiring up B
Observations:
By adding another blocking capacitor, this effectively blocked the DC signal.



Note the 1.60 V offset.

f-3db = 1/RC = 1/0.47 = 2.13 Hz --> low freq limit for this blocking circuit

At low freq:
We observed a phase of 90 degrees, with the circuit acting as a high pass filter.


-This circuit (full circuit) acted as a high pass filter, but as long as f > f-3dB, all it did is block DC signal without attenuating AC signal. If f is low, it would attenuate AC signal as well, which leads to distortion in signal and phase shift between Vin and Vout.