Thursday, February 26, 2015

Session 6 - Tuesday February 17

Diodes
Diodes only allow current to flow through them in one direction and have an effective resistance given by the ratio V/I. Since diodes allow current in only one direction we can think of the resistance being approximately 0 in the direction current is allowed to flow and infinite in the direction it can't flow.

Golden Rule of Diodes: When a diode with an I-V curve that looks like an exponential function is "forward-biased" and is carrying appreciable current (> 10 mA) it will have a fixed voltage drop across it: approximately 0.6 V in the case of a "regular" silicon diode and approximately 2-3 V in the case of a light-emitting diode.

Measuring the Resistance of a Diode
Ohmmeters output a constant current in order to measure the resistance of an unknown resistor. However, the amount of current output depends on the scale of the ohmmeter, so changing the sensitivity of the ohmmeter changes the current output. Since a diode's resistance is dependent on current this means that an ohmmeter will measure different resistances of the diode depending on what setting it is on. Specifically, the more sensitive the ohmmeter setting the smaller the resistance measured on the diode. To prove this to ourselves we measured a resistance of 136kΩ on our ohmmeter (not the standard ohmmeter) at a sensitive setting and 2.83 MΩ on its least sensitive setting.

Half Wave Rectifier
Rectifiers turn an AC signal into a DC signal, which is very useful for converting the AC voltage from the standard wall power supply in the DC voltage needed by most devices.

If we consider a circuit with a diode and 2.2kΩ resistor in series to create a kind of voltage divider with the diode as its top half we can see that current will only be allowed to flow in one direction. The diode is between the voltage source and the resistor and current can only flow from the voltage source to the resistor. Since the voltage drop across our diode is approximately 0.6 V, we know that if the voltage signal is below this value no current will move through the diode. We also know that the output voltage will now be 0.6V less than the input since that is how much was lost across the diode and that the diode's resistance is huge compared to the resistor.

Half Wave Rectifier, Experimentally
Lab 3-2 in the Student Manual
For this lab we constructed the circuit discussed above with a 2.2kΩ resistor and a 1N914 diode and a 6.3Vac(rms) transformer as the power source. It is important to note that since the transformer is 6.3 V rms we will actually see 9.6 V on the oscilloscope. You can see our observed output in the picture below:
This is the output expected as the output (yellow) never goes negative due to the influence of the diode which prevents any voltage less than +0.6V, giving the result a positive polarity. There are have as many "wiggles" in Vout (yellow) as in Vin(blue) because the diode blocks the current when there is not sufficient current to produce the necessary +0.6V.

We also expect to see a 0.6 V or 600 mV difference between Vout and Vin due to the voltage drop across the diode. We took measurements of this difference at the peaks of the voltages and off to the side. You can see the side measurement in the picture below:
The voltage difference measured in both locations was 640 mV which is very close to the expected value of 600 mV.

Ripple
If we add a capacitor in parallel with the load resistor in order to add a "RC time lag", our output voltage will no longer closely follow Vin on the falling edges. This is because on the rising edge the diode is allowing current and therefore has an extremely small resistance resulting in a small RC allowing the capacitor to charge very quickly and the Vout to act as normal. However, on the falling edge of Vin the capacitor can not discharge through the diode as the current is not allowed to flow in that direction. Instead the capacitor has to discharge through the resistor and therefore has a much larger RC time constant. Since the capacitor charges quickly, but takes longer to discharge and doesn't have enough time to discharge much at all(1/60 s), the resulting Vout looks like ripples as can be seen in the picture below:

The height of these ripples can be calculated by deltaV = Vmax - Vmax*e^((-1/60 s)/(Rload * C)) which is approximately deltaV = Vmax*((1/60s)/(Rload*C)). 

To test the above equation, we added a 47 microFarad capacitor in parallel with the 2.2kΩ load resistor in our half wave rectifier circuit. We calculated that the "ripple" amplitude should be 9.6V*(1/60)/(2.2k*47micro) = 1.55V. We then measured the "ripple" amplitude on the oscilloscope and got a value of 1.14V which is approximately equal to our calculated value, showing that the formula above works.

Signal Diodes, Experimentally
Lab 3-3 in the Student Manual
For this lab we constructed a rectified differentiator as seen in the diagram below, but with a 470 pF capacitor instead of the 560:
We then drove it with a 5Vpp square wave at 10kHz and the input(blue) and output(yellow) can be seen below:
This output makes sense because this is the same result as the differentiator circuit we made in the previous lab session, but cleaner because the rectifier eliminates the dip below 0V.

The 2.2k load resistor decreases the time the capacitor needs to discharge by providing another resistor for the current to discharge across. If you remove the 2.2k resistor the time constant increases and the capacitor takes longer to discharge. This longer time constant is just 560pF*1kΩ. or 560 ns. We took a measurement of this time constant using the oscilloscope and got 480 ns which is close.

With the 2.2k resistor in the circuit the time constant that we measured using the oscilloscope is 320 ns. Using the relation 320 ns = RC and knowing that the R is 2.2kΩ, we calculate the capacitance to be 145pF. This capacitance is called "parasitic capacitance" and it is inherit in the system. Roughly 30pF comes from the oscilloscope and there is another 30pF or so from each foot of coaxial cable. Knowing this, our value of 145pF makes sense because we were using a total of roughly 3 feet of coaxial cable which combined with the machine's 30pF should give a parasitic capacitance of approximately 120pF which is very near 145pF.

Diode Limiter
Large voltages can easily damage some instruments, but these instruments can be protected by using two diodes in pointing in opposite directions to limit the voltage to values less than 0.6V. We will explore how this works in lab 3-6.

Lab 3-6 in the Student Manual
We begin this lab by constructing a voltage divider that has a 1kΩ resistor on top and an 1N914 diode on the bottom which connects to +5V voltage source.Driving this circuit with a sine wave from our function generator at max output amplitude we can see that the output is cut off on the top of the sine waves. You can see this is the photo below:
This cutting off of the peak is called clamping and, as we can see in the zoomed in photo below, is not quite a flat chop. This is the effect of the diode's non-zero impedance causing the voltage to gradually cut off.


Diode Emitter, Experimentally
Lab 3-7 in the Student Manual
For this lab, we built the circuit shown in the diagram below:
We then drove it with a sine wave, triangle wave, and square wave of various amplitudes. You can see the output of these in the following order below: sine wave 5Vpp, triangle wave 5Vpp, and square wave 5Vpp.


Note that in all of these wave types, the output voltage has a max Vpp of just over 1V. To show that this 1 Vpp of the output is independent not just of the wave type, but also the amplitude of the Vin look at the pictures below:

The only difference between the two inputs in the pictures above was the amplitude of Vin, but the Vout didn't change at all. This is the perfect solution to the difficulties of needing to power sensitive circuits that can't handle large voltage from large voltage sources such as a standard wall plug.

Impedances of Test Instruments
Ideal instruments for measuring voltage will have infinite input impedance in order to have little impact on the circuit they are measuring. Of course, things are rarely ideal in the real world. Inside our oscilloscopes there is a "parasitic" or "stray" capacitance of 30pF that is in parallel with its 1MΩ resistor. The engineers who create instruments work as hard as they can to make this "stray" capacitance as small as they can and thus get their instruments closer to the ideal. This "stray" capacitance has the unfortunate affect of limiting the scope's ability to measure higher frequencies. The high frequencies make it difficult to meet the impedance requirement that Zout << Zin. Also, Zin is frequency dependent and thus the signal can be attenuated by different amounts at different components leading to distortion.

The Oscilloscope Probe
The Oscilloscope Probe is one way to help minimize these problems discussed above. The Oscilloscope Probe has a 10x setting that raises the input impedance of all frequencies for the oscilloscope by a factor of 10. This helps with the Zout << Zin requirement and also minimizes distortion. The drawback to using an Oscilloscope Probe is that its 10x setting decreases the sensitivity of the oscilloscope by a factor of 10 and therefore doesn't work well for weak signals.

In order to raise the input impedance of the oscilloscope by a factor of 10, the Zprobe has to be 9 times the impedance of the scope and cable. This is because the total impedance is Zprobe + Zscope&cable which we want to be 10*Zscope&cable. We can accomplish this by matching the oscilloscopes 1MΩ resistor in parallel with a 30pF capacitor with a 9MΩ resistor in parallel with a 3pF capacitor for the probe.

Impedances of Test Instruments, experimentally
Lab 3-8 in the Student Manual
We began this lab by measuring the internal resistance of the DVM. We made this measurement by measuring the Vin, Vout, and Rload which we made the R1 in a voltage divider with the DVM being R2. Vin was 5V, Vout was 4.95V, and Rload was 1kΩ. Using our formula for voltage dividers (Vout=(R2/(R1+R2))*Vin) we found the resistance of the DVM to be 99kΩ (our DVM is not the standard lab DVM, but a cheaper one). This value makes sense because for a DVM to be good at measuring voltage it must have a high input resistance and thus we should choose a large resistor in order to measure its impedance.

Next, we again used the voltage divider trick, but this time to measure the input resistance of the oscilloscope. This time we used a voltage source of 10Vpp sine wave at 100 Hz. We found that the voltage attenuated by half when we used a 1MΩ resistor which means the oscilloscope has an internal resistance of 1MΩ. Again, this makes sense because for the oscilloscope to be good at measuring voltages it must have a very high resistance in order to minimally affect the circuit it is measuring.

After this we measured the scope's input impedance. We did this by driving it with a signal in series with a 1MΩ to channel 2 and just the signal to channel 1. We know that the output impedance of the function generator is 1MΩ which is of course not << 1MΩ. This is important because we want most of the voltage drop to happen across the oscilloscope's 1MΩ resistor so that it can measure the voltage drop.

The attenuation of the signal is 50% at low frequencies, but as we raise the frequency of the input the output signal actually becomes larger than the input. This effect can be explained by the model in the diagram below:

Since there is a capacitor in parallel with the oscilloscope's 1MΩ the oscilloscope's attenuation value is frequency dependent. When the frequency is very high the capacitor acts like a wire and short circuits the resistor.

We know from the above that the R of the scope is 1MΩ. We can find the approximate value of C by solving the equation Vout = magnitude((-i/(w*C))/(R - i/(w*C)))*Vin with our measured values of Vout = 1.52V, Vin = 10V, delta t = 22 mircoseconds, and f = 11kHz. We get a final value of C = 150pF.

We can fix the circuit above to work as a divide-by-two signal attenuator at all frequencies by also making the load capacitance match the oscilloscope's, just like the resistor. This way, no matter what the frequency the load and oscilloscope are each losing half the voltage causing the oscilloscope to only measure half (divide-by-two) of the input voltage. Since we calculated C to be 150pF we know this is how much capacitance to add to the load. Since we don't have 150pF capacitors in the lab we used a 100pF and 50pF capacitor in parallel. You can see our circuit in the photo below:
This circuit does in fact create a divide-by-two signal attenuator for all frequencies. You can see some of our tests in the photos below:



Finally, we measured the internal resistance of the function generator. We did this by loading the generator with a known resistor and watching the output drop with a signal of 1 Vpp at 1kHz. To choose our known resistor we considered the purpose of a function generator. Function generators want to be good voltage providers and therefore want to minimize internal voltage drops and thus internal resistance. Knowing this we chose the small value of 10Ω for our known resistor. This resulted in a Vout of 208 mV from a Vin of 1.06V and by applying our voltage divider equation of Vout=(R2/(R1+R2))*Vin we find that the value of R1 is 40.9 Ω. To double check this result, we chose the closest resistor to 41Ω, the 47Ω resistor. The attenuation in the circuit with a 47Ω is approximately 50% which confirms that the internal resistance of the function generator is approximately 41Ω.

Session 5 - Friday, February 13


Section 1 - Reactance of a Capacitor

Capacitors change their charge with relation to the change in voltage over time and this relationship is shown by V(t) = q(t)/C or the differentiated version, dV/dt = (dq/dt)/C. This changing charge over time is the same as current (I = C(dV/dt)) and we can think of this as the "sloshing"(changing) charge causing current to be induced in response on the other side.

If the Voltage is a sin wave we can say that V(t) = Vo*sin (w*t) and therefore I(t) = C*w*Vo*cos(wt) = Io * cos(w*t).

As these are all sine waves, there are potential phase shifts of between 0 and 90 degrees between the V(t) and I(t). This phase shift can be modeled a Vo/Io = Vo/(C*w*Vo) = 1/(w*C). We call this 1/(w*C) term the capacitive reactance and it is sometimes written as Xc. Comparing this result to the one we found in a previous lab for resistors (Vo/Io = R) we realize that the value 1/(w*C) is analogous to resistance, but with a frequency-dependent phase shift component.

A very important concept that comes from these statements is that at high frequencies capacitors act like a wire or "short circuit", and that at low frequencies they look like an "open circuit".

Integrator Revisited
When a resistor and capacitor are in series in a voltage divider we can utilize the frequency dependence of the capacitor to insure that Vout << Vin. We can do this by making Xc << R and thus insure that this integrator circuit will have an output voltage proportional to the integral of the input signal, provided that the frequency of the input is high enough to meet the requirement that w is much less than 1/(R*C).

Differentiator
Remembering that Vin(t) = Vo*sin (w*t) and I(t) = Io * cos(w*t), we can also note that dVin/dt = Vo*w*cos(w*t). If we reverse the voltage divider we created for our integrator circuit, we now have a voltage divider with a capacitor and then a resistor. If we apply the principles mentioned in the previous sentence and Ohm's Law we can show that Vout(t) = Io * cos(w*t)*R = C*w*Vo*cos(w*t)*R = R*C*(dVin/dt). This has the fascinating result that at sufficiently low frequencies, that is RC << (1/w), this circuit works as a differentiator.

An RC Differentiator, Experimentally
Lab 2-2 in the Student Manual
For this lab, we constructed an RC differentiator with a capacitor of 100pF and a resistor of 100Ω. We then drove this circuit with a square wave of 1 Vpp amplitude and frequency of 100kHz. The output is shown below:
When you zoom in in units of time on a square wave, you can see that there is actually increases on a curve. The slope of this curve is shown by our differentiator circuit and is the yellow line. This output makes sense because as the blue curve gets steeper (the slope increases) the yellow line increases, and as the blue line starts to level off (the slope decreases until it gets to zero) the yellow line decreases but does not go below zero.

We confirmed that our circuit works as expected by trying a 100kHz triangle wave. The output can be seen below:
This output makes sense because the slope of the blue line is alternating between a positive constant value and a negative constant value, which is reflected in our flat yellow line that alternates between a positive and negative value.

Trying this one more time for a sine wave we get the output seen below:
This output also makes sense because the yellow line, which represents the slope, is zero at each peak of the blue sine wave and the yellow wave has a peak each time the slope of the blue line is greatest as the blue line passes through zero. This further confirms that the circuit (yellow) is a differentiator of the input voltage (blue).

Input Impedance
As a final exercise in lab 2-2 we did a quick worst-case impedance calculation for a DC input and a input at infinite frequency. Due to the capacitor, we know that the input impedance at DC would be infinite since the capacitor acts like an open circuit, and that at infinite frequency it would be 0 since the capacitor acts like a wire.

Lab 2-3 Part 2 in the Student Manual
For this lab we are looking at the behavior of the differentiator circuit when w<< 1/(R*C) is violated. We can see the effects of breaking this condition in the outputs below for the square wave (picture) and triangle wave (video). The effect for the square wave happens because the frequency is so high that the capacitor does not have time to sufficiently charge and therefore instead of the brief peak, it is a stretched out peak that decreases gradually.
The effect for the triangle wave can best be seen when you vary the frequency of the triangle wave. In the video we manually varied the frequency from 500Hz to 100kHz, adjusting the scale of the display as needed. Just like for the square wave, these odd effects occur because the capacitor doesn't have enough time. For the triangle wave, the capacitor isn't able to charge fully to then hold its constant value for a while. It never reaches this constant value that models the slope of the input and thus it increases and decreases similarly to the input wave. You can see as this happens because the yellow line goes from the expected stair stepping, to a rounded sawtooth, to finally a triangle wave matching the input.

Filters:
Low-Pass Filter
For a circuit of two resistors set up as a voltage divider we know that if R2>> R1 then Vout ≈ Vin and  conversely, if R2 << R2 then Vout << Vin. This translates to an RC circuit set up as a voltage divider with the capacitor as the bottom half of the divider as if 1/(w*C)>> R then Vout ≈ Vin and  conversely, if 1/(w*C) < R2 then Vout << Vin. From these we know that if a frequency is low Vout ≈ Vin and if a frequency is high Vout << Vin. Therefore this circuit only passes through low frequency inputs and "kills" high frequency inputs. Thus, we call this circuit a "low-pass filter".

Complex Impedance
Since the reactance of a capacitor is similar to resistance, but isn't the same, we need a way to describe reactance that can be used in the voltage divider equation of Vout = (R2/(R1 + R2))*Vin, but also keeps track of both the amplitude and phase. The answer to this dilemma is to use complex numbers. Instead of 1/(w*C) as we were using earlier, Xc = -i/(w*C).

Now, the magnitude of the complex factor (Xc/(R + Xc)) gives the relative amplitudes of the signals for a low-pass filter voltage divider. If we graph the relative amplitudes as a function of frequency we find that the cutoff frequency which is the boundary between the frequencies that do and don't pass through the filter(approximately 70.7%) is wo = 1/(R*C) which makes sense as this is also the limiting factor of the capacitor. We will verify this later in lab 2-4.

Phase Shifts
The complex number we used for capacitance also carries information about the phase shift between Vout and Vin. Looking at just the complex part of the term gives us Vout = (1/(1+i))*Vin = ((1-i)/2)*Vin. Plotting the complex number on a complex plot shows there should be a 45 degree phase shift with Vout lagging 45 degrees behind Vin. 

Based on the fact that at low frequencies the "impedance" of the capacitor is larger than the impedance of the resistor, we know that there will be little contribution from the imaginary part of complex term and thus Vout will nearly be in phase with Vin. That is, the phase shift will be close to 0 degrees.

On the other end of this spectrum, at high frequencies the capacitor will have a much smaller impedance than the resistor. This means that the imaginary term dominates and the Vout will be near 90 degrees out of phase with Vin. Again, we will verify this with Lab 2-4.

Decibels
Decibels is the a unit for measuring the ratio of two voltages. It is defined as dB = 20*log(10, (A2/A1)). We can use decibels as another way to describe the cutoff frequency point of the low-pass filter. The cutoff frequency point has a ratio of voltages such that the signal is being attenuated by a factor of 1/(2^0.5). Expressed in decibels this is known as the 3dB point because 20*log(10, (1/(2^0.5))) = -3.01 dB

When people say things like 'beyond the cutoff the response of a low pass-filter drops at a rate of 6dB per octave', they mean that since an octave is a factor of 2 change in frequency the attenuation changes to 20*log(10, 2). This evaluates to 6.02 and thus is called a 6dB drop rate per octave.

Low-Pass Filters, Experimentally
Lab 2-4 in the Student Manual
For this lab we constructed a low-pass filter out of a 15kΩ resistor and a 0.01 microFarad capacitor. We calculated the filter's 3dB frequency to be 1061.03 Hz (w = 1/RC = 1/(15k * 0.1 micro) = 6666.6, f = w/(2*pi) = 6666.6/(2*pi) = 1061.03). We then drove this circuit with a sine wave ranging from 1kHz and 10kHz to observe how the high frequencies were cut out by the low-pass filter and the signal became heavily attenuated. 

We then found the 3dB frequency point experimentally by finding the frequency at which the filter  attenuated the Vout down to 70.7% of its full amplitude. We found this value to be 1.2 kHz which is very close to our calculated value of 1.06 kHz. 

Then we found the limiting phase shift at very low frequencies to be 0 degrees, and the phase shift at high frequencies to be approximately 90 degrees, confirming the findings above in Phase Shifts.

We also measured the output, frequency, and phase shift at 2, 4, and 10 times f3dB to make sure that the low-pass filter was attenuating 6dB per octave. The input voltage was 1 V. The results are below:
Frequency in f3dB
Frequency in kHz
Amplitude in mV
Attenuation in dB
(20*log(10, Vout/Vin)
Phase shift in microseconds
Phase shift in degrees
(phase shift in seconds/period)*360
2
2.4
448
6.9
78
67
4
4.8
252
12.
49
85
10
12
110
19
21
90.7

These results confirm that the attenuation is approximately 6dB per octave (note that 4.8kHz to 12kHz is not an octave jump) and that the phase shift approaches 90 as we increase the frequency (going over 90 is probably an error in measurement).

High-Pass Filter
A high-pass filter is the opposite of a low-pass filter. The positions of the capacitor and resistor are swapped and the high-pass filter attenuates low frequency signals while passing along high frequency signals and the cutoff frequency is still 1/(R*C).

High-Pass Filters, Experimentally
Lab 2-5 in the Student Manual
For this lab we constructed a high-pass filter out of a 15kΩ resistor and a 0.01 microFarad capacitor. We calculated the filter's 3dB frequency to be 1061.03 Hz, same as the previous low pass circuit. Although this time we experimentally found the 3dB frequency to be 1kHz. We then drove this circuit with a sine wave ranging from 500Hz and 10kHz to observe how this circuit passed along the high frequencies, while the low frequency signal became heavily attenuated. 

We then checked that the output frequencies at low frequencies well below the 3dB point (1/2, 1/4, and 1/10 times f3dB) were proportional to frequency. The input voltage was 1 V and the results are below:
Frequency in f3dB
Frequency in Hz
Amplitude in mV
1/2
500
448
1/4
250
240
1/10
100
112

We can see that the output is in fact proportional to frequency as the amplitude in mV is the same fraction of the original 1 V as the frequency fraction.

The limiting phase shift for this circuit is 90 degrees at very low frequencies and 0 degrees at very high frequencies.

Garbage Detector
Lab 2-6 in the Student Manual
This lab combines a high-pass filter with with a transformer to show you the high frequency "garbage" that comes with the 110-volt power line. Since this is the same circuit as the lab before, but now with an added transformer, we know that the calculated 3dB frequency is 1061Hz, and we confirmed this with a measured 3dB of 1kHz. To find the filter's attenuation at 60 Hz we counted octaves to make the arithmetic easier. 1kHz -> 500Hz -> 250 Hz -> 125 Hz -> 62.5Hz is 4 octave changes. The voltage at 1kHz will be 70.7% of the total 6.3V provided by the transformer, since it is the cutoff frequency. A 4 octave change means that the fraction of the original voltage is 1/(2^4) or 1/16. Thus, the attenuation at 60 Hz is (0.707 * 6.3)/16 = 0.28 V.

Blocking Capacitor
Since capacitors act as an open circuit for direct current and are closer to a short circuit for alternating current, a capacitor can be used to take in a varying voltage and block the DC component.

Blocking Capacitor, Experimentally
Lab 2-8 in the Student Manual
In this lab, we added a 10kΩ resistor and +5V source from our Arduino chip, to a high-pass filter consisting of a 4.7 microFarad capacitor and a 4.7kΩ resistor. Driving the high-pass filter with the function generator and looking at the output on the oscilloscope on the DC coupling setting, we can see the AC signal "riding" on +1.6V which comes from the voltage divider giving a third of the 5 volts from the Arduino.

Now we add another high-pass filter to the output of our previous circuit. This time the high-pass filter added consists of a 4.7 microFarad capacitor and a 100kΩ resistor. The low frequency limit for this blocking circuit is 0.34 Hz (wo = 1/(R*C) = 1/(100k * 4.7 micro) = 2.13, wo/(2*pi) = f = 2.13/(2*pi) = 0.34 Hz).

We will explore the applications of this circuit in the next lab.