Sunday, February 23, 2014

2/14: More with capacitors; Diodes

in which Julia continues capacitor investigations and explores voltage-limiting diode circuitry

ΔμΩ

H&H Lab 2-6: Filter Application: Garbage Detector

The garbage detector makes the input signal (purple)'s noise visible (yellow).
Here we used a transformer to make a low-voltage signal from the standard 110 V outlet, then added a high-pass filter to attenuate the 60 Hz portion of the signal.  This circuit clearly shows the high-frequency "garbage" that sits atop the 60 Hz signal.

We expect the voltage to be attenuated by
-24 = 20*log(Af/Ai)
Af/Ai = 10^(-1.2) = 6.3%

We measured Vout = 2.88 V and Vin = 187 mV.  Our actual attenuation value was in good agreement with the expected value:
Vin/Vout = 0.187/2.88 = 6.3%

Lab 2-8: Blocking capacitor

(orange: red of FG. yellow: black of FG.  Brown: Red of scope.)
The circuit diagram in H&H.
First, we built only circuit "A", which added +5 V to the AC signal from the function generator.
For DC voltages, the capacitor lets no current pass; as a result, this circuit lets AC voltage from the function generator sum with DC voltage from the voltage divider.  

DC offset adds to AC signal...at a scale of 2.5 ms?!
Unfortunately, what we assumed was a constant DC voltage produced by the transformer was actually (although always positive) highly variable.

The transformer's "DC" voltage is always positive, but not constant.
We decided to use a battery pack as the voltage source instead (although this gave us only about +4.2 V, this was a constant source).

Constant voltage source shows DC offset to the AC signal.
Adding the circuit part "B" caused the circuit to do nothing (as confirmed by oscilloscope readings and noting no change when removing the battery voltage source from the circuit).
Here the output signal matches the input: the circuit has no net effect.

Diodes!

Next we investigated the circuit element known as a "diode".  This element limits current flow to only one direction; its J-shaped IV curve causes high current flow (low resistance) at high voltages (at about +0.6 V for our 1N914 diodes), and essentially zero current flow (very high resistance) at lesser voltages.  When we measured the 1N914 diode with an ohmmeter, we measured lower resistance at higher voltage scales (because the voltage applied during testing was higher).

Lab 3-2: Half-wave rectifier

Only the positive portion of a half-wave-rectified signal is visible (shifted down by 0.6 V by the diode).
The output (shown above) had the expected flatlines between positive peaks, which shows that above a certain voltage (0.6 V) all of the current flowed through the diode, through the resistor, to ground; but below that voltage, no current flowed through the diode (and so no voltage drop was seen over the resistor).
Although we used a variable transformer with dial set to approximately 6 Vac, our output signal had an amplitude of 1.04 V, suggesting that the transformer's scale is not particularly accurate for AC voltages.

Pre-Lab 3-5:

Add a 47 μF capacitor (we used a 4.7 μF capacitor, as 47 μF were unavailable) in parallel with the 2.2 kΩ resistor in the half wave rectifier circuit.  Explain the output; calculate the "ripple" amplitude, compare to measured peak height.


The resulting "ripple" had an amplitude of 0.640 V.

We measured the fall to be 640 mV (0.640 V) in this circuit; the maximum voltage (without capacitor) was 960 mV.


We calculated the "ripple" amplitude using the equations in Electronics.pdf:



Δ (0.960 V)/[(60 s)*(2200 Ω)*(4.7 x 10^-6 F)] = 1.55 V

However, our measured ΔV  was 680 mV, which is far from this calculated value.  We thought perhaps the approximation was invalid for small capacitance, and tried the exact formula:

ΔV = (0.960 V) - (0.960 V)*exp(-1/[(60s)*(2200 Ω)*(4.7 x10^-6 F)]
ΔV = 768 mV

Although this is certainly closer than the approximate formula's result, the calculated value still did not agree with our observations.
Concerned, we tried a capacitor with a higher capacitance: 470 μF.
As expected, the ripple circuit with a 470 μF capacitor showed smaller peaks.
We then measured the peak height to be 16 mV (0.016 V), which agreed with our approximate calculation:

Δ≈ (0.960 V)/[(60 s)*(2200 Ω)*(470 x 10^-6 F)]
Δ≈ 155 mV

The exact calculation gave a similar value:

ΔV = (0.960 V) - (0.960 V)*exp(-1/[(60s)*(2200 Ω)*(470 x10^-6 F)]
ΔV = 153 mV

Still, we were confused why our calculations were so inaccurate for smaller capacitance.  We tried a 0.22 μF capacitor, which caused no noticeable change in the capacitor-free output.  We also investigated the effects of a 10 μF capacitor, which did cause a noticeable change: a measured ΔV of 420 mV.

The ripple circuit with a 10 μF capacitor showed an intermediate ripple height.
The approximate value was much higher than our measured ΔV of 420 mV:


Δ≈ (0.960 V)/[(60 s)*(2200 Ω)*(10 x 10^-6 F)]
Δ≈ 727 mV

While the "exact" calculated value was closer to our measured value, it was still higher than that found in the experiment:

ΔV = (0.960 V) - (0.960 V)*exp(-1/[(60s)*(2200 Ω)*(10 x10^-6 F)]
ΔV = 510 mV

In general, it seems that the approximation is less valid for smaller capacitance values--as expected, because the Taylor series approximation of exp(-x) = 1 - x is less valid when x is inversely proportional to a small capacitance value.  However, the "exact" formula also does not yield a ΔV in agreement with experiment for small capacitance values, which suggests that this formula neglects some part of the circuit.  For these relatively small voltage values, perhaps the resistance of the wires and breadboard is significant?

Lab 3-5: Signal diodes

Here we used a diode to make a rectified differentiator, as shown above (though we used a 470 pF cap, as 560 pF was unavailable).  When driven with a 10 kHz wave, the output undergoes rapid RC decay.
At the 5 μs scale, the circuit appears to generate a sharp peak.
RC decay is visible at the 250 ns scale (0.25 μs).
The 2.2kΩ resistor amplifies output signal by providing resistance to current flow so it slows current flow to ground.  Without this resistor, all of the current flowing through the diode goes to the output, which makes the ratio of RC decay to total signal smaller, so it is more difficult to see the RC decay.  The first resistor (1 kΩ) and the capacitor (470 pF) determine the RC decay in this circuit.

Lab 3-6: Diode clamp

H&H's diode clamp circuit.
The diode clamp begins to limit voltage at about 10.6 V; it only limits the positive voltage(top peaks) because this circuit uses a diode, so current cannot flow through the diode when voltage is negative.  10.6 V is a reasonable value: half of this (because the diode only works in positive voltages) is 5.3 V; subtracting 0.6 V (to get into the diode's low-resistance IV curve region) yields 4.7 V.  While we expected a final value of about 4.2 V, because that is the voltage supplied by our batteries, 4.7 V is fairly close; the small difference may be due to internal resistance in the batteries.


The diode limiter clearly limits voltage with a 13.7 V input signal.
The diode limiter flattens the signal's top peaks.
While the diode clamp flattens the peak, there is still some curvature in the output signal (this is more clearly evident in the zoomed-out image above), which reflects the diode's non-zero impedance.

Next we added a voltage divider to the circuit:

H&H's diode clamp + voltage divider circuit.
This caused a more rounded voltage-limited output peak:
Adding a voltage divider made the output peaks rounder.
Voltage flows through the second 1kΩ resistor only if the applied voltage (Vin) is greater than 4.7 volts.  If Vin > 4.7 V, all of the "extra" voltage goes through the diode, through the second 1kΩ resistor, to ground.  Increasing the extra voltage increases the voltage drop through the resistor, which makes this output curve rounded.

Driving the circuit with a triangle wave caused a similar output voltage shape: a triangle beneath a triangle.  In the upward-sloping region, the capacitor is charging, which limits the amount of extra current supplied through the load circuit; in the downward-sloping region, the capacitor is discharging, and thus limiting the "negative" current provided to the load circuit.
Triangle wave input (yellow) through the diode limiter yields a symmetrical output peak of lesser slope (purple).

Adding a second capacitor over the final resistor in the circuit flattened this peak.

Triangle wave input (yellow) through the diode limiter with a 15 μF secondary capacitor yields a symmetrical, flattened output (purple).

Here, the extra current (that would have increased the voltage across the second 1 k
Ω resistor) instead goes to charging the capacitor.  Decreasing the applied voltage slowly decreases the capacitor's charge; even though voltage is decreasing through the resistor, capacitor provides extra voltage to keep the voltage drop over the resistor steady.
We were curious about how the size of the capacitor affects this flattening, so we tried a tiny capacitor (0.01 μF) for comparison.  This charges very quickly (so the first half of the peak is approximately triangular), and discharges slowly (the second half of the peak is curved).
Triangle wave input (yellow) through the diode limiter with a 0.01 μF secondary capacitor yields an asymmetrical output (purple).

3.7: Diode Limiter

If the diode receives over +0.6 V, current flows through 1; if the diode receives less than -0.6 V, current flows through 2 to ground.  A diode limiter such as this would be useful to protect a sensitive instrument from high voltage.
The diode limiter (yellow) limits an input sine wave (purple) to +/- 0.6 V.

Next lab: Instrument Impedances and Op Amps!

Tuesday, February 18, 2014

2/11: Reactance of a Capacitor; Low and High-Pass Filters

in which Julia revisits the integrator and differentiator circuits as frequency filters


(A note on reading capacitors:

"1 0 4" means:
10 x 10^4 pF
so 1 x 10^5 pF
so 1 x 10^5 x 10^-12 F
so 1 x 10^-7 F
so 0.1 μF)


H&H, Lab 2-2: Differentiator circuit

As previously discussed, we began to investigate this circuit last class.  Now we're thinking about the circuit's impedance:
At f = 0, the capacitor's impedance is infinite, so it effectively acts like an open circuit--none of the signal gets through (Vout = 0).  As f approaches infinity, the capacitor's impedance approaches zero, so it effectively acts as a wire--almost all of the signal gets through (Vout = Vin).
("Input impedances" and "output impedances" are fancy names for Rth, in or out.  Remember: for a good circuit, Rout<<Rin!)

Measuring Vout across the resistor, driven with a square wave:



The square wave output--voltage over the resistor (yellow)--compared to input (purple).
Beginning from the highest peak of the output voltage:
The peak of the output voltage occurs when the voltage through the resistor (Vr) is largest, so the voltage through the capacitor (Vc) is smallest, so the capacitor is fully uncharged.
Vr then decreases because the capacitor is charging (Vc is increasing, so Vr is decreasing).
When the input voltage falls rapidly, the capacitor rapidly discharges, so the output voltage follows the input voltage in this dramatic fall.  Switching voltage causes the capacitor to charge in the opposite direction (so the voltage across the resistor slowly increases while the input plateaus at a negative voltage)--Vr increases after the peak because the capacitor is charging (Vc increasing negatively, so Vr is decreasing negatively, so Vr gets more positive).

Next we tried driving the circuit with a triangle wave:

The triangle wave output--voltage over the resistor (yellow)--compared to input (purple).
Triangle wave up: capacitor gives resistor a little extra voltage (discharging)
Triangle wave down: capacitor takes a little voltage from resistor (charging)
We still see the triangle shape in output because almost all the input voltage is going through, since the capacitor can't charge very much because the frequency is fast.

Lab 2-3, part II: differential circuit where ω is not << 1/RC

For ω < RC: For low frequencies, the capacitor's impedance is high, so the square wave doesn't pass--only the high frequencies (in the Fourier spectrum that make the square wave) associated with the peak pass through the capacitor, so the circuit effectively "differentiates" the square wave to show peaks at each rise and fall of the input wave.
A differentiator peak at low frequencies.
For omega >> RC: The high-pass filter passes a square wave, because all frequencies are high and thus pass through the "differentiator", so it no longer differentiates.

Thinking about this graphically--in the first case, omega is small so Vout/Vin ~ 0 (except where the slope of the input wave is large).  In the second case, omega is large so Vout/Vin ~ 1.

Driving with increasingly high frequencies makes the ouput square wave closer to the input--presumably because more input voltage is getting through the circuit because the capacitor has less time to charge (its impedance is lower).
Similarly, lower frequencies make the output square wave less close to the input--because less input voltage is getting through, as the capacitor's impedance is higher as it can charge for a little while.


Notes from the RC circuit reading:

The cutoff frequency, ω(0) = 1/(RC), roughly represents the boundary between frequencies that will pass and frequencies that will be blocked by an RC circuit.
When ω << 1/(RC) (at low frequencies), the capacitor's impedance is large compared to the resistor, so Vout will be almost in phase with Vin (it is difficult to see the phase change effect of the resistor at low frequencies).
When ω >> 1/(RC) (at high frequencies), the capacitor's impedance is small compared to the resistor, so Vout will approach a maximum of 90 degrees out of phase with Vin.
The ratio of two voltages is usually given in decibels:
dB = 20*log(A2/A1)

where "log" is log base 10, A2 is the amplitude of Vout, and A1 is the amplitude of Vin.


 Lab 2-4: Low-pass filter, "integrator" circuit

What does the phrase "beyond cutoff, response of low pass filter drops at 6 dB/octave" mean?
"Response" corresponds to the ratio of the amplitudes of Vout to Vin (A2/A1).
An "octave" means doubling the frequency of the input voltage signal, ω (or f).
Use the decibels formula:
dB = 20*log10(A2/A1)
According to this statement, if we double ω then:
-6 = 20*log10(Aout/Ain)
log10(Aout/Ain) = -6/20
Aout/Ain = 10^(-6/20) = 10^-.3 = 0.5
So one would expect doubling ω to double the attenuation (halve the output amplitude).

To find ω for -3 dB:
-3 = 20*log10(Aout/Ain)
Aout/Ain = 1/sqrt(2)
ω = 1/RC = 2*π*f = 1/(sqrt(2)*RC)
f = 0.71/(2*π*RC)
where R and C are the resistance and capacitance values for the particular RC circuit.

Using our capacitance and resistance values, the driving frequency for the 3dB point should be 1.06 kHz:
R = 15 kΩ, C= 0.01 μF
RC = (15 x 10^3)*(0.01 x 10^-6) = (1.5 x 10^4)*(1 x 10^-8) = 1.5 x 10^-4

1/RC = 6666.7
1/(2*π*RC) = f = 1.06 kHz

When driving the circuit with 1.06 kHz, we observed an output voltage of 2.69 V for an input voltage of 4.00 V.  This corresponds to an attenuation of (2.69/4 = ) 0.67, or 67%, which is close to the expected 70.7% amplitude decrease.

Theoretically, the phase shift at 1.06 kHz should be π/4 (45 degrees):
2*π*dt/T = π/4
dt/T = 0.125
Thus we expected a dt value of 125 μs.
Measuring the phase shift, we observed a dt of 112 μs, which is close to our expected value of 125 μs.

For a low frequency signal (10 Hz), we expected a phase shift of 0, because the capacitance's impedance would be much larger than that of the resistor.  For a high frequency signal (10 kHz), we expected a phase shift of π/2 (90 degrees), because the capacitance's impedance would be much smaller than that of the resistor.  As discussed above, experiments were in reasonable agreement with our predictions: we found no observable offset for a 10 Hz input signal and an offset of approximately 90 degrees with a 10 kHz input signal
.


The 45-degree offset between 1.06 kHz input and output waves.
In general, increasing the frequency decreased the voltage (causing greater attenuation): doubling the frequency halved the output voltage (doubled the attenuation).
When driven at a frequency of 10 kHz (10*f(3dB)), the output voltage was 0.52 V for an attenuation of (4.00/0.52 = ) 7.70.
A 20 kHz frequency (20*f(3dB)) made Vout = 0.28 V, for an attenuation of (4.00/0.28 = ) 14.3.
A 40 kHz frequency (40*f(3dB)) made Vout = 0.14 V, for an attenuation of (4.00/0.14 = ) 28.6.
In the decibels formula:
dB(10 kHz) = 20*log(7.70) = 17.7
dB(20 kHz) = 20*log(14.3) = 23.1
dB(40 kHz) = 20*log(28.6) = 29.1

The decibel difference between octaves was thus (23.1 - 17.7 = ) 5.4 for the first octave and (29.1 - 23.1 = ) 6 dB for the second octave.  This agrees fairly well with the "6 dB decrease per octave" suggestion interpreted previously.

When driven at a frequency of 2*f(3dB), or 2.1 kHz, this circuit's output voltage was 1.94 V; at 4*f(3dB), or 4.2 kHz, Vout = 1.1 V; at 10*f(3dB), or 10.6 kHz, Vout = 0.52 V.



Lab 2-5: High-pass filter

A high-pass filter (which passes only high-frequency signals) was constructed with a 0.01 μF capacitor and 15 kΩ resistor to form an RC circuit.  Because the values for R and C were the same as for our low-pass filter circuit, the 3dB point is the same for this circuit: at f = 1.06 kHz.
At low frequencies, the output amplitude was proportional to the frequency
Like the low-pass filter, the limiting phase shifts for the high-pass filter were π/2 and 0 radians; however, a phase shift of π/2 occurred with a low input frequency, and a phase shift of 0 occurred with a high input frequency--the opposite of the low-pass limits.

Tuesday, February 11, 2014

2/6: RC circuits!

in which Julia learns about capacitors and investigates persistent wiggles

(I'm particularly excited about this because we just talked about modeling viscoelastic materials with an RC circuit in my Structural Biomaterials class!)

Our first task: Lab 2-1 in H&H, in which we verify that a square wave applied to an RC circuit generates an asymmetrically peaked wave over the capacitor:

Image from Electronics pdf.
We found a curve as expected, shown below:
Measuring the square wave (blue) and RC output (yellow).
We measured the time to fall from 100% to 37% (or climb from 0% to 63%), which took about 110 µs.

Next we used the LogoChip to characterize an RC circuit, building a "capacitance meter" wherein the LogoChip could read (and PicoBlocks could interpret) an unknown capacitance.
LogoChip RC circuit diagram (Electronics pdf).
The real-life LogoChip RC circuit.
PicoBlocks code for the LogoChip capacitor identification (Electronics pdf).
 The PicoBlocks code shown above will display (approximately) the amount of time it takes for the unknown capacitor to charge to 63% of its capacity.  From this it is easy to determine the capacity: this Δt (measured in ms) is equal to the resistance of the resistor in series with the capacitor (100 kΩ here) multiplied by the capacitance.  To get the actual capacitance from the displayed value of "Δt":
(Δt) x 10^-6 s = R*C = (100 kΩ)*C = (1 x 10^5 Ω)*C
C = [(Δt) x 10^-3 s]/(1 x 10^5 Ω) = (Δt) x 10^-8 F = (Δt) x 10^-2 µF = C
The "capacitor meter" accurately identified both a 0.1 µF and a 1 µF capacitor by these calculations:
Identifying a capacitor based on the LogoChip/PicoBlocks output reading of 10.
We attempted to program PicoBlocks to display the capacitor's value in µF, as shown above, but ran into difficulties as the programming language (designed for elementary-school kids) could not process fractional values.  We presumed dividing by 100 was something that could be reasonably accomplished in one's head and decided to leave it at that.

In further studies of the capacitance meter, we determined the effective capacitance of identical capacitors in parallel and in series.  Recalling that capacitors in parallel add and capacitors in series add inversely, we were unsurprised to find that two parallel capacitors had double the effective capacitance of one, while two capacitors in series had half the capacitance. (PicoBlocks read 10 ms for one 0.1 µF capacitor, 20 ms for two caps in parallel, 5 ms for series.)

Finally we investigated the integrator circuit in Lab 2-3:
The integrating circuit: RC.

In this circuit, the output voltage (Vout) is proportional to the charge on the capacitor, which in turn is proportional to the integral of the input voltage (Vin).  With a square wave input, we expected the output voltage to appear as a triangle wave in the same phase, increasing when Vin was positive and decreasing when Vin was negative:
Our (correct) prediction for the integrator circuit output voltage (left) compared to the input voltage (right).
Our experimental integrator, at high frequency (100 kHz) in good agreement with the prediction.
A triangle wave input (purple) yields a cycloid output signal (yellow).
We finished a little early and decided to explore the differentiator circuit of Lab 2-2:
The differentiating circuit: CR.
As the name implies, at high frequencies this circuit yields an output voltage signal approximately equal to the differential of the input signal.
As expected, a sine wave input gave a cosine output.
The differentiator also worked as expected for a high-frequency sine wave:
The input square wave (purple) was also correctly differentiated (yellow).
 However, upon increasing the timescale, we noticed a startling aberration in the output signal--it seemed to oscillate very quickly immediately after each peak.

The puzzling wiggle.
Confused, we consulted several professors.  After a good hour of puzzling (thinking about high-pass filters and reflections within the wires), we finally determined that the BNC breakout cables we had been using as oscilloscope leads were not impedence-matched with the scope.  Switching to scope probes seemed to help the issue.
The output wiggle after one calibration (yellow) suggests that we should replace the BNC breakout input cable (purple) with another scope probe.
At last--a clear signal!

Next lab: Impedence and Hi-Pass/Low-Pass Filters!