Lab 4 - First Order Transient Response of Circuits Lab Performed on October 22, 2008 by Nicole Kato, Ryan Carmichael, and Ti Wu Report by Ryan Carmichael and Nicole Kato E11 Laboratory Report – Submitted November 7, 2008 Department of Engineering, Swarthmore College 1 Abstract:__________________________________________________________ Different circuits were assembled from a voltage source, resistor, and a single energystoring passive element, either a capacitor or an inductor. A circuit that contained a capacitor, voltage source, timer, potentiometer, speaker and resistors, was also assembled using a breadboard. Tests were then performed to examine the behaviors of Vin and Vout over time for each configuration, and to determine how the time constant varied with changes in the magnitude of the capacitance or inductance of the passive elements. The experimental results were, for the most part, close to the predicted, theoretical values. Introduction:_______________________________________________________ Capacitors and inductors are two of three passive elements that can be used in a circuit. Ideally, these two passive elements are not able to dissipate or generate energy, but can store and release energy in a circuit. Capacitors and inductors can be used in very simple circuit designs, such as that for a blinking light, or in very advanced designs, such as those used in radio reception. In addition to being unable to dissipate energy, ideal capacitors do not have inductance or resistance, and the voltage across the element cannot change instantaneously. Similarly, ideal inductors do not have capacitance or resistance, and the current across this element cannot change instantaneously. However, in reality, both capacitors and inductors exhibit small amounts of characteristics that they ideally would not have. Theory:___________________________________________________________ A capacitor (C) is composed of two closely and evenly spaced conducting plates. If there is no charge placed on a capacitor, it will remain neutral. Initially, when a charge is placed on a capacitor, it will act as a short circuit. Over time, one plate of the capacitor will become Figure 1: Capacitor Symbol more positively charged and the other more negatively charged. This allows the capacitor to store energy. When the capacitor cannot store any more energy, ideally, it will not allow anymore current to go through, as if it were an open 2 circuit. If the energy source is removed, the capacitor will begin to release its stored energy to keep the energy of the circuit constant until it runs out of energy. An inductor (L) is composed of a conducting wire that is tightly wound or coiled. If there is no charge placed on an inductor, it will remain neutral. Initially, when a charge is placed on an inductor, it will act as an open circuit. Over time, one side of the inductor will become positively charged and the other negatively charged. This causes the inductor to store Figure 2: Inductor Symbol energy. When the inductor cannot store any more energy, ideally it will allow all of the current to flow through, as if it were a short circuit. If the energy source is removed, the inductor will also begin to release its stored energy to keep the circuit constant until it runs out of energy. A circuit with only one type of passive element that stores energy is called a first order circuit– or more specifically, in our case, an RC or RL circuit. An RC circuit is composed of a resistor and a capacitor, while an RL circuit is composed of a resistor and an inductor. If a circuit is a first order circuit, we can find either the current or voltage for t greater than zero using the following equation: X(t) = X(∞) + ( X(0+) - X(∞) ) e^(-t / τ) (Equation 1) X(∞) is the value of either current or voltage when time is infinity, X(0+) is the value of either the current or voltage right after t, or time becomes 0. τ, the time constant, is RC for an RC circuit and L/R for an RL circuit. - + For a capacitor, we know that the voltage from 0 to 0 must be equal because it cannot - + change instantaneously. For an inductor, we know that the current from 0 to 0 must be equal because it cannot change instantaneously. We know that when a capacitor cannot store any more energy, it will act as an open circuit (so when t goes to ∞, the current through the capacitor must be 0). We know that when an inductor cannot store any more energy, it will act as a short circuit (so when t goes to ∞, the voltage through the inductor must be 0). In circuit 1.a, we know that the resistor is 1kΩ and the capacitor 1µF; therefore, we can find the time constant as RC or 0.001s. If we are looking at the rising edge of the circuit, Vin will initially be zero at 0- and will become 1 at 0+. At Vc(0-), the voltage is zero since there is no voltage going through the capacitor. Since we also know that the voltage across a capacitor 3 cannot change instantaneously because the capacitor initially acts as a short circuit, when Vin initially equals 1V the Vc(0+) is also zero. At time infinity, the capacitor will act as an open circuit and Vc(∞) will become 1V at steady state. Using equation 1 we can see that Vc(t) is equal to V(∞) + ( V(0+) - V(∞) ) e^(-t / τ) or 1 + (0-1)e^(-t/.001) V. In circuit 1.b, we know that the resistor is 2kΩ Figure 3: Circuit 1.a (Vin = 1V, R = 1kΩ, C = 1µF) and the capacitor 1µF therefore we can we can find the time constant as RC or 0.002s. At Vc(0-) the voltage is zero since there is no voltage going though the capacitor. Since we also know that the voltage across a capacitor cannot change instantaneously because the capacitor initially acts as a short circuit, when Vin initially equals 1V the Vc(0+) will remain at zero. At time infinity, the capacitor will act as an open circuit and Vc(∞) will become 1V at steady state. Figure 4: Circuit 1.b (Vin = 1V, R = 2kΩ, C = 1µF) Using equation one we can see that Vc(t) is equal to 1 + (0-1)e^(-t/.002) V. In circuit 1.d, we know that the resistor is 1kΩ and the capacitor 1µF therefore we can we can find the time constant as RC or 0.001s. If we are looking at the falling edge of the circuit, Vin will initially be 1V at 0- and will become 0V at 0+. At Vc(0-) the voltage is 1 since Vin has been going through the capacitor for a long time and the capacitor has reached a steady Figure 5: Circuit 1.d (Vin = 1V, R = 1kΩ, C = 1µF) state. This also means that Vc(0+) will remain 1V when Vin becomes 0V. At time infinity the capacitor will discharge and Vc(∞) will go to 0V. Using equation one we can see that Vc(t) is equal to 0 + (1-0)e^(-t/.001) V. 4 In circuit 2.a, we know that the resistor is 1kΩ and the capacitor 1µF therefore we can we can find the time constant as RC or 0.001s. If we are looking at the rising edge of the circuit, Vin will initially be zero at 0and will become 1 at 0+. At Vc(0-), the voltage is zero as there is no voltage going through the capacitor. Since we also know that the voltage across a capacitor cannot change instantaneously because the capacitor initially Figure 6: Circuit 2.a (Vin = 1V, R = 1kΩ, C = 1µF) acts as a short circuit, when Vin initially equals 1V, the Vc(0+) is zero. At time infinity, the capacitor will act as an open circuit and Vc(∞) will become 1V at steady state. Using equation one, we can see that Vc(t) is equal to 1 + (0-1)e^(-t/.001) V. In circuit 3.a, we know that the resistor is 1kΩ and the inductor is 112mH therefore we can we can find the time constant as L/R or 0.000112s. If we are looking at the rising edge of the circuit, Vin will initially be zero at 0- and will become 1V at 0+. At t=0- we know that if there is no voltage going though the circuit, the current will be zero, so VL(0-) will be 0V. At 0+ the Vin will Figure 7: Circuit 3.a (Vin = 1V, R = 1kΩ, L = 112mH) become 1, but the inductor will act as an open circuit so there will be no current going through the inductor and therefore the voltage will remain 0V. At VL(∞), the inductor will act as a short circuit, current will become Vin /R which means that VL(∞) will be Vin or 1V. Using equation one, we can see that Vc(t) is equal to 1 + (0-1)e^(t/.000112) V. Circuit 4.a can be redrawn as circuits 4.b and circuit 4.c. We are given the information that when Vc is less that V1, the switch opens, but when Vc is greater than V2, the switch closes. When the switch is open, we can see that the Vc is charging the capacitor to V2 and when the capacitor has reached V2, the switch opens to allow the capacitor to dissipate back to V1. The capacitor dissipating energy causes a sound from the Figure 8: Circuit 4.a (Ra = 33kΩ, Rb = 20kΩ, C = 0.1µF, Vcc = 5V) 5 speaker. With this information we can use circuit 4.c to find that the time constant, τ1, before Vc is greater than V2 is (RA + RB)C or 5.30 ms, and that after the switch closes the time constant, τ2, after Vc is greater than V2 is RBC or 2.00 ms. Looking at circuit 4.b, we can find the current to be 5V/15KΩ or 1/3mA. We can use this information to find that V2 is equal to 5V-5kΩ/3mA or 3.33V, and V1 is equal to 5V – 2(5kΩ/3mA) or 1.67V. Using the equation X(t) = X(∞) + ( X(0+) X(∞) ) e^(-t / τ) we can solve for the voltage before the switch closes as V(t) = 5 + (1.67 – 5)e^(188.7t1), and when we solve for t when V(t) is 3.33, we get t1 to be 0.003674s. We can use the same formula to get the equation V(t) = 3.33e(-500t2) and solve for t2 when V(t) is equal to 1.67 to get Circuit 4.b Circuit 4.c (Switch closes when Vc > V2) Figure 9: Circuits 4.b and 4.c (Ra = 33kΩ, Rb = 20kΩ, C = 0.1µF, Vcc = 5V) t2 to be 0.001386. We can now solve for the frequency, fosc to be 1/(t1 + t2) or 197.6 s-1. Procedure:_________________________________________________________ 1. First we connected the Wavetek signal generator, set to produce a square wave function that varied approximately between 0 and 1 volts to the oscilloscope. 2. We created Circuit 1a, as shown in the theory, and connected Vin from the function generator. We also set the resistor to 1kΩ, and the capacitor to 1µF. *Note: our 1a is the lab handout procedure’s 1d. In addition, our 1b is based off of our 1a not the lab handout procedure’s 1a. We apologize for the confusion. 3. For more precise measurements, we made the scale on the oscilloscope as large as possible, and set the triggering so that the rising edge of the Vin was displayed at the center of the screen. 4. We took and recorded the following measurements: a. The initial and final measurements of Vin and Vout b. The time constant where the Vout has progressed through 63% of its period. . 6 5. We downloaded and saved the following items: a. The screenshot of Vin and Vout with the measured time constant b. The data from Vout 6. We then doubled the resistance to 2kΩ and repeated step 4. 7. After, we predicted and observed what happens if the capacitance is doubled to 2 µF and the resistance returned to its original value. 8. We returned the capacitance and resistance to their original values and saw what would happen if we set the triggering to the minimum edge of the input at the center of the screen, and then repeated steps 4 and 5. 9. We assembled Circuit 2 from the theory and set the resistance to 1kΩ and the capacitance to 1 µF, with the function generator providing Vin. 10. We then repeated steps 3 through 8. 11. We created Circuit 3 from the theory and set the resistance to 1kΩ and the inductance to 112 mH, with the function generator providing Vin. Also, we set the function generator’s frequency so that Vout would reach steady-state before Vin changed. 12. We then repeated steps 3 through 6. 13. We created Circuit 4 using a breadbox, and connected it to an oscilloscope. 14. We watched pin 6 and 3 in the oscilloscope for one period. 15. We then downloaded and saved a screenshot of the oscilloscope, and the data from pin 6. 16. We also measured and recorded the frequency of pin 6. 17. We determined why the circuit oscillated, and saw what happened when we put our fingers across the leads of the resistors and capacitor. 18. We connected a 555 oscillator to the oscilloscope and attached the potentiometers at the midpoints. 19. We measured the frequency of the squealy oscillator when: a. The button was not pushed b. The button was pushed and i. LED of blinky stage was on ii. LED of blinky stage was off 7 Results:___________________________________________________________ Circuit Initial-Final Input Value Initial-Final Output Value Time Constant (Cursor Measurement) Time Constant (Curve Fit) Time Constant (Theoretical) 1A 1B 1D 2A 3A 4 1.02 V 1.04 V 1.02 V 1.02 V 1.02 V 3.88 V 1.03 V 0.920 V 1.04 V 0.960 V 0.960 V 2.24 V 1.22 ms 2.00 ms 1.00 ms 1.09 ms 0.128 ms -----1.15 ms ------ ------ 1.07 ms 0.112 ms 1.98 ms, 4.62 ms 1.00 ms 2.00 ms 1.00 ms 1.00 ms 0.112 ms 1.39 ms, 3.67 ms Table 1: Results Table In addition, the frequency of oscillation for circuit 4 is 196.4 Hz vs. a theoretical 197.7 Hz Figure 10: Circuit 1a Vin, Vout vs. Time 8 Figure 11: Circuit 1a Vout vs. Time Curve Fit 9 Figure 12: Circuit 1b Vin, Vout vs. Time 10 Figure 13: Circuit 1d Vin, Vout vs. Time *We erred with the cursor method. The vertical cursor line should have been placed around 1 ms 11 Circuit 2a: Oscilloscope Output with Cursor Determination of τ Voltage CH1 = Input CH2 = Output Time Figure 14: Circuit 2a Vin, Vout vs. Time 12 RC Circuit 2a Curve Fit Voltage (Volts) Circuit 2a curve fit General model Exp1: f(x) = a*exp(b*x) Coefficients (with 95% confidence bounds): a= 0.913 (0.9121, 0.9138) b= -933.8 (-935.2, -932.4) τ = -b -1 = 0.001071 (0.001069, 0.001073) Goodness of fit: SSE: 0.4912 R-square: 0.9979 Adjusted R-square: 0.9979 RMSE: 0.009954 Time (seconds) Figure 15: Circuit 2a Vout vs. Time Curve Fit 13 Circuit 3a: Oscilloscope Output with Cursor Determination of τ Voltage CH1 = Input CH2 = Output Time Figure 16: Circuit 3a Vin, Vout vs. Time 14 LC Circuit 3a Curve Fit Voltage (Volts) Circuit 3a curve fit General model: f(x) = a*(1-exp(b*x)) Coefficients (with 95% confidence bounds): a= 0.8528 (0.8524, 0.8532) b= -8947 (-8977, -8917) τ = -b -1 = 0.0001117 (0.0001114, 0.0001121) Goodness of fit: SSE: 0.6301 R-square: 0.9934 Adjusted R-square: 0.9934 RMSE: 0.01127 Time (seconds) Figure 17: Circuit 3a Vout vs. Time Curve Fit 15 Circuit 4: Oscilloscope Output for the 555 Oscillator Voltage CH1 = Output CH2 = Input Time Figure 18: Circuit 4 Vin, Vout vs. Time 16 Circuit 4 Dissipating Energy Curve Fit General model: f(x) = a+(b-a)*exp(-x/τ2) Coefficients (with 95% confidence bounds): a = 0.1849 (0.08446, 0.2853) b= 3.528 (3.524, 3.533) τ2 = 0.00198 (0.0019, 0.002061) Goodness of fit: SSE: 0.7867 R-square: 0.9967 Adjusted R-square: 0.9967 RMSE: 0.02537 Voltage (Volts) Time (seconds) Figure 19: Circuit 4 (Dissipating) Vout vs. Time Curve Fit 17 Circuit 4 Storing Energy Curve Fit Voltage (Volts) General model: f(x) = a + (b-a)*exp(-x/τ1) Coefficients (with 95% confidence bounds): a= 4.757 (4.724, 4.791) b= 1.878 (1.875, 1.881) τ1 = 0.004614 (0.004535, 0.004692) Goodness of fit: SSE: 2.425 R-square: 0.997 Adjusted R-square: 0.997 RMSE: 0.02542 Time (seconds) Figure 20: Circuit 4 (Storing) Vout vs. Time Curve Fit 18 Discussion:_________________________________________________________ In general, our experimental results matched up well with our theoretical results. In fact, for circuits 1b, 1d, and 3a we were able to match our theoretical values to three or more significant figures. For circuits 1b and 1d, this accuracy was somewhat due to luck as the cursor method used to obtain τ isn’t nearly accurate enough to expect such precise results. For the other circuits this method erred by an average of about 11%. For circuit 3a the cursor method gave about a five percent error. The theory-matching result was obtained from a very accurate curve fit that can be seen in Figure 17. A curve fit of such precision was unexpected as the errors that effected circuit 2a (which also had a good curve fit) somehow canceled. The remaining circuits ranged from a reasonable 7% error for circuit 2a to a mediocre 15% error for circuit 1a to rather large 26% and 42% errors for τ in circuit 4. For circuit 1a, the major error was a curve fit that did not accurately represent the oscilloscope data. As seen in Figure 11, the curve fit doesn’t intersect any of the data points until about 0.2 V and after this point the fit ranges between the upper and lower regions of the data points, failing to provide an accurate fit. Unlike in circuit 1a, fitting accuracy does not appear to be a major source of error for circuit 2a. Instead, the major error for this circuit appears to come from the discrepancy between real and ideal circuit elements. This can particularly be seen in the ideally flat square waves that take a rounded shape due to the inability of the voltage source to make a perfect jump between voltages. In addition, the voltage source has some impedance, which is a major contributor to the error due to a difference between real and ideal circuit elements. Creating a curve fit for the data helps to limit this error, but does not eliminate it. This error also appears in circuit 1a, but is overshadowed by the somewhat more evident curve fit error. Circuit 4 similarly has error due to nonideal circuit elements, but the time constant errors are much larger than for circuit 2a because the circuit contains two time constants. However, the frequency obtained from these time constants is very similar to the theoretical frequency (within 0.7% error). This occurs because, when the voltage source changes voltages, it overshoots briefly before settling at its assigned voltage. As there is an overshoot in both the positive and negative directions, the time constant will be greater than the theoretical value for one direction of the jump, and smaller for the other direction. Additionally, each overshoot duration will be approximately equal and opposite, so the sum of the time constants (or the period) will not be 19 greatly altered from the theoretical value. As the period will remain the same, its inverse, the frequency, will also remain near the theoretical value. Conclusion:________________________________________________________ In conclusion, for the six major circuits evaluated (1a, 1b, 1d, 2a, 3a, and 4), we were able to obtain our theoretical time constant values experimentally for three of the circuits, while the other three circuits had varying levels of accuracy for the time constant value. All of these errors, however, can be reasonably accounted by three major sources of error: poor curve fitting, impedance in the voltage source, and the inability of a voltage source to make an ideal jump between two voltages. Acknowledgments:__________________________________________________ Cheever, Erik. "Curve Fitting with Matlab." Swarthmore College :: Home. 29 Oct. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Ref/MatlabCurveFit/MatlabCftool.html>. Cheever, Erik. "E11 Lab (1st order time domain response) - Procedure." Swarthmore College :: Home. 29 Oct. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Class/e11/E11L4/Lab4(Procedure).html>. Cheever, Erik. "E11 Lab 3 (1st order time domain response) - PreLab." Swarthmore College :: Home. 29 Oct. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Class/e11/E11L4/Lab4(Prelab).html>. Cheever, Erik. "Measuring Time Constants on the TDS4013B Using Cursors." Swarthmore College :: Home. 29 Oct. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Ref/TDS4013/MeasureTau/MeasureTau.h tml>. "Circuit Schematic Symbols." Oracle ThinkQuest Library . 29 Oct. 2008 <http://library.thinkquest.org/10784/circuit_symbols.html>. "Electronics/Inductors - Wikibooks, collection of open-content textbooks." Main Page Wikibooks, collection of open-content textbooks. 29 Oct. 2008 <http://en.wikibooks.org/wiki/Electronics/Inductors>. We would also like to thank Anne Krikorian for teaching us the way of the comma. 20 Appendices:________________________________________________________ Figure 21: Button Not Pushed 21 Figure 22: Button Pushed, Blinky On *Note that the frequency is roughly half of the frequency with the button not pushed. 22 Figure 23: Button Pushed, Blinky Off *Note that the frequency returns to about that of when the button is not pushed. 23