Lab 2 – Introduction to Op Amps Lab Performed on September 17, 2008 by Nicole Kato, Ryan Carmichael, and Ti Wu E11 Laboratory Report – Submitted October 1, 2008 Department of Engineering, Swarthmore College 1 Abstract: In this laboratory, an operational amplifier was connected with resistors two circuits, an inverting op amp circuit and a non-inverting programmable-gain circuit with two switches. Tests were then performed to determine the input and output voltages (Vin and Vout) of the inverting op amp configuration and the four non-inverting configurations. Vout was then divided by Vin, determining the gain of each configuration. This value was then compared to the theoretical gain determined by a function of resistors specific to each configuration. Our results are summarized in Table 1 below. Configuration Sb Sa Theoretical Gain Measured Gain (actual resistors) (without distortions) Inverting Non-inverting Non-inverting Non-inverting Non-inverting -open open closed closed -open closed open closed -1.993 1.000 2.00 2.99 3.99 -2.02 0.945 2.04 2.97 3.98 Percent Error (%) 1.355 5.50 2.00 0.667 0.251 Table 1: Summary of Gains Introduction: An operational amplifier, or op amp (shown in Figure 1), is an electronic circuit that can control both the voltage and current of electrical circuits, often used in thermostats, strain gages, and accelerometers, among other things. In our lab, we used the LM741 operational amplifier, Figure 1: A Circuit Symbol for an Op Amp 2 commonly produced by National Semiconductor. A full understanding of op amps requires an understanding of the circuit’s components, including diodes and transistors. However, these complicated circuits can be treated as black box devices by addressing its terminal behavior as a function, rather than the circuit’s actual composition. When used in a circuit with resistors and a necessary dependent source, the op amp can be used to sum, scale, subtract, and perform other useful functions. When used with inductors and capacitors, it is used in integrating and differentiating circuits. Theory: The LM741 Op amps have eight terminals, but we will only examine five of them: the VS+ , VS-, inverting input (V- ), non-inverting input (V+), and output (Vout ). The VS+ and VS- are the positive and negative power supplies. The output voltage cannot be greater than the positive power supply nor can it be less than the negative power supply. In an ideal op amp, no current flows into the inverting and non-inverting inputs, although current can flow out of the input-controlled output. There is also no voltage difference between the inputs. One of these inputs cannot have its voltage change without the other input either increasing or decreasing in voltage to match. This ensures linear operation and keeps the output at the same voltage. This equilibrium is maintained by negative feedback through a feedback loop. Feedback loops direct the output voltage back to the inverting input. This negative feedback drives the circuit back to equilibrium in a manner specific to the circuit configuration. For non-ideal op amp there is a voltage difference between the inputs. Because the inputs are not equal, the output cannot return to its original value and the op amp leaves the linear region. 3 Here negative feedback, in the circuit of which the op amp is a part of, limits the differences between the two inputs, allowing us to assume linear operation to a good approximation. In this lab, op amps are used in two different configurations: inverting and non-inverting. With the inverting configuration shown below in Figure 2, the input voltage is connected to the inverting input and the non-inverting input is connected to ground. This causes gain, or the ratio of the output to input, to be negative, which in turn causes the sine waves of the output and input to oscillate at an offset of Figure 2: Inverting Op Amp Configuration pi. The output voltage then appears to be an inversion of the input voltage. Also, for this configuration, the feedback loop sends output voltage back through Rf into the inverting input. Were Vin to rise, it would increase the voltage at the input directly as well as decrease the output voltage. The output voltage would cause the feedback loop to decrease the voltage at the inverting input returning the system to equilibrium. Kirchoff’s current law states that the current going into a node must be equal to the Node A Σ I = 0 = Vin - (R1 * I) Vin = (R1 * I) current going out of the node. Using this fact Node B Σ I = 0 = Vout + (Rf * I) Vout = -(Rf * I) in our analysis, we can determine the current Vout/Vin = Gain = -(Rf * I)/(R1 * I) = -Rf / R1 into and out of nodes A and B and, in the math right, find that the gain is -Rf / R1. The negative sign indicates that this configuration is inverting. 4 In the non-inverting configuration below in Figure 3, the voltage source is connected to the non-inverting input, and the inverting input is connected to the output and to ground through resistors. This causes the gain to be positive. When we look at the sine waves of the output and input verses time we can see that they oscillate with no offset and so the output does not appear inverted. In this configuration, the feedback loop sends the output voltage through Rf into the inverting input. Figure 3: Non-Inverting Op Amp Configuration Should Vin increase the output would also increase. The feedback loop would then send the output voltage through Rf and into the non-inverting terminal, which would decrease the output voltage, returning the circuit to equilibrium. Kirchoff’s voltage law states that the voltage of a closed loop must sum to zero. Using this fact, we summed the voltages around loops 1 and 2 (shown above) and solved for Vout and Vin. From this, in the math below, we found that the gain was 1 + (Rf/R1). The positive value indicates that this configuration is non-inverting. Loop 1 ΣV = 0 = Vout -(Rf * I) - (R1 * I) Vout = I * (Rf + R1) Loop 2 ΣV = 0 = Vin + (V+) - (V-) - R1I 0 = Vin - (R1 * I) Vin = R1 * I Vout/Vin = Gain = [I * (Rf + R1)] / [R1 * I] = 1 + (Rf/R1) 5 Furthermore, in the noninverting programmable-gain op amp configuration shown in Figure 4, we see that there are two switches that can be either open or Figure 4: Op Amp Configuration With Switches closed, allowing us to adjust the gain in equal increments by opening or closing the switches. Table 2 summarizes the formulas for the theoretical gain for various switch positions. Sb Sa Gain open open 1 + (Rf /∞) open closed 1 + (Rf /Ra) closed open 1 + (Rf /Rb) closed closed 1 + (Rf /(Ra || Rb) Table 2: Theoretical Gain Formulas for Various Switch Positions If Ra=20kΩ, Rb=10kΩ, and Rf=20kΩ, the numerical gains are adjusted by one through the opening and closing of the switches. These gains are shown below in Table 3. Sb open Sa open Gain 1.000 open closed 2.00 closed open 3.00 closed closed 4.00 Table 3: Theoretical Gain for Various Switch Positions 6 Procedure: This section will be completed by Ti Wu with the assistance of Professor Cheever and handed in later. Results: a. The Inverting Configuration: Theoretically, for the inverting configuration shown in Figure 2, the gain should equal –Rf / R1. Were the resistors Rf and R1 exactly 20 and 10 kΩ, the gain would be -2.00. However, we measured the resistance of R1 as 9.88 kΩ and Rf as 19.69 kΩ, which yields a theoretical gain of -1.993. We first determined the measured gain by taking the ratio of the peak-to-peak voltages of Vout and Vin read directly off of the oscilloscope (the oscilloscope output is Figure 5 in Appendix E). This method determined a gain of -1.941. This value, however, includes distortion: blips and static in the oscilloscope graphs caused the oscilloscope to determine the Vout and Vin inaccurately. To find a more accurate gain, we measured the difference in height between the Vout and Vin’s maximum and minimum values using a ruler, and divided the values to determine our measured gain with less distortion, which we determined to be -2.02. In addition, we created a MultiSim model (Figure 6 below) of the circuit and used it to evaluate the gain with 20 kΩ and 10 kΩ resistors (Figures 7,8 below), yielding a gain of -2.01. All of these results are summarized in Table 3 below. It should also be noted that our supply voltages were 11.81 V and -11.90 V. If our output voltage was larger it could not have been greater than 11.81 V. Similarly, the output voltage could not have been less than -11.90 V. Vin Vout (with distortion) (v) (with distortion) (v) 1.01 1.96 (actual resistors) MultiSim Gain Percent Error -1.993 -2.01 1.355 Measured Gain Measured Gain Theoretical Gain Theoretical Gain (with distortion) (without distortion) (ideal resistors) -1.941 -2.02 -2.00 (%) Table 3: Gains for the Inverting Configuration Note: Percent Error = | Measured Gain (without distortions)- Theoretical Gain (actual resistors)| * 100 7 Theoretical Gain (actual resistors) Figure 6: MultiSim Model of Inverting Configuration Figure 7: MultiSim Simulation of Oscilloscope Reading 8 Figure 8: MultiSim Graphical Determination of Gain (Slope) b. The Non-Inverting Programmable-Gain Configuration: For the non-inverting configuration shown in Figure 3, we calculated the gain for the four possible permutations of switch positions (both switches open, Sb open with Sa closed, Sb closed with Sa open, and both closed). Similar to the inverting configuration, we determined the gain with distortion by taking direct readings from the oscilloscope (oscilloscope readouts are Figures 9-12 in Appendix E) and then determined the gain without distortion by determining Vout and Vin with a ruler. We also measured the values of our resistors as Ra = 19.69 kΩ, Rb=9.88 kΩ, Rf=19.69 kΩ. We plugged these values into Table 2 to determine more accurate theoretical gains. The results of these calculations are shown in Table 4 below. Vin (with Vout (with distortion) distortion) (v) (v) Sb Sa (with distortion) (without distortion) (ideal resistors) (actual resistors) Percent Error (%) Measured Gain Measured Gain Theoretical Gain Theoretical Gain 1.03 1.32 open open 1.282 0.945 1.000 1.000 5.50 1.02 2.20 open closed 2.16 2.04 2.00 2.00 2.00 1.02 3.14 closed open 3.08 2.97 3.00 2.99 0.667 1.03 4.14 closed closed 4.02 3.98 4.00 3.99 0.251 Table 4: Theoretical and Actual Gains for Various Switch Configurations 9 Discussion: For both the inverting configuration and the non-inverting programmable-gain configuration, our measured gains were very close to the theoretical gains. With the exception of one measurement, all of our measured gains were within 2.00% of the theoretical gain. The exception, the non-inverting configuration with both switches open, logically has the highest percent error because it produces the smallest gain, and thus slight errors result in larger percentage errors. In addition to having the most oscilloscope distortion, the measured value only differed from the theoretical value by 0.05. For comparison, the non-inverting configuration with Sb open and Sa closed (2.00% error) had measured and theoretical values that differed by 0.04. When working with such small ratios, every 0.01 of voltage, resistance, and gain makes a significant impact on the percent error of the experiment. Such small error comes both from machine and human error. The resistors were accurate to 5%, the oscilloscope produced blips and static that distorted gain by as much as 0.3, in lab we noted that the Vin and Vout had an error of about 0.02 V, and manuallydetermined gain from the oscilloscope output is only accurate to about 0.02. Furthermore, rounding a value such as 0.005 to 0.01 produces an error significant enough to be noted. Sources of error considered, all of the measured values fall reasonably within error of the theoretical values. This fact provides evidence that the op amps used in the E11 lab can be considered ideal op amps to a good degree of accuracy, providing the other equipment used are of similar accuracy to that of the equipment used in the E11 “Introduction to Op Amps” lab. If more accurate equipment were used and the theoretical value still differed from the measured value, then the error could not be feasibly attributed to the equipment and procedures used, revealing error due to a non-ideal op amp. However, for Engineering 11 we can consider the op amps used ideal. 10 Conclusions and Further Work: In conclusion, we obtained the following data for our lab: Configuration Sb Sa Theoretical Gain Measured Gain (actual resistors) (without distortions) Inverting Non-inverting Non-inverting Non-inverting Non-inverting -open open closed closed -open closed open closed -1.993 1.000 2.00 2.99 3.99 -2.02 0.945 2.04 2.97 3.98 Percent Error (%) 1.355 5.50 2.00 0.667 0.251 Table 1: Summary of Gains The measured results obtained are within error of the theoretical values for a given configuration. This suggests that the op amps used can be considered ideal in the configurations we used. To further check this conclusion, the experiment could be redone using a more accurate oscilloscope, more accurate resistors, and a more consistent voltage source. However, in the scope of Engineering 11, this is unnecessary. 11 Acknowledgements: We would like to acknowledge the following sources for their aid in this lab report: Cheever, Erik. "E11 Formal Lab Report Format." Swarthmore College. 28 Sep. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Class/e11/Formal_report.html>. Cheever, Erik. "E11 Lab #2: Lab Procedure." Swarthmore College. 28 Sep. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Class/e11/E11L2/Lab2(LabProcedure).html >. Cheever, Erik. "E11 Lab #2: Prelab." Swarthmore College. 28 Sep. 2008 <http://www.swarthmore.edu/NatSci/echeeve1/Class/e11/E11L2/Lab2(PreLab).html>. Nilsson, James W, and Susan Riedel. Electric Circuits (8th Edition). Alexandria, VA: Prentice Hall, 2007. In addition, we would like to thank Anne Krikorian for proof reading our grammar, punctuation, etc. 12 Appendices A-D: Assigned Questions These sections will be completed by Ti Wu with the assistance of Professor Cheever and handed in later. Appendix E: Oscilloscope Readouts for All Five Configurations Voltage vs. Time: Inverting Configuration (measured gain without distortion: -2.02) Vout = light line Vin = dark line Figure 5: Oscilloscope Output for the Inverting Configuration 13 Voltage vs. Time: Sb=Closed, Sa=Closed (measured gain without distortion: 4.02) Vout = light line Vin = dark line Figure 9: Oscilloscope Output for Sb=Closed, Sa=Closed Voltage vs. Time: Sb=Closed, Sa=Open (measured gain without distortion: 3.08) Vout = light line Vin = dark line Figure 10: Oscilloscope Output for Sb=Closed, Sa=Open 14 Voltage vs. Time: Sb=Open, Sa=Closed (measured gain without distortion: 2.16) Vout = light line Vin = dark line Figure 11: Oscilloscope Output for Sb=Open, Sa=Closed Voltage vs. Time: Sb=Open, Sa=Open (measured gain without distortion: 0.945) Vout = light line Vin = dark line Figure 12: Oscilloscope Output for Sb=Open, Sa=Open 15