Asish Balu Partners : Clayton Dickerson, Vinnie Simeone Section 1H Op Amp Design Lab Introduction: In this lab, we designed five different circuits using op amps. Each circuit solved a separate problem, and the problems were successively more difficult. Operational Amplifiers Laboratory Circuit 1: Design Objective The objective of this circuit was to take an audio signal with an amplitude of 20Vpp and decrease it to 4Vpp. The signal needed to stay in the same orientation (no inverting) so the easiest way to accomplish this task was to use a non-inverting op amp. Schematic Theory of Operation This op-amp circuit was relatively simple. A non-inverting op-amp takes a signal, and magnifies it according to a given gain. This gain is determined by the feedback loop resistor and the resistor connected from the inverting input to ground. Theoretically speaking, the gain of an ideal non-inverting op amp is represented by this formula: Since the two resistors can only be positive values, the gain of a basic non-inverting op amp can only be 1 or greater. This posed a problem – how would we divide the input signal by 5 and decrease it from 20Vpp to 4Vpp? The answer involves inserting two resistors into the non-inverting input of the op amp. One resistor connects from the non inverting input to ground, while the other resistor goes from the non inverting input to the voltage source. Since there is no current coming from either input terminal of the op amp, these added resistors are effectively in series. Thanks to voltage division, choosing the right resistor values allowed us to lower the voltage source’s effective output. The equation that describes the voltage at the non-inverting input is below: This lowered output would then be magnified by the two resistors at the inverting output according to the gain formula above. Derivations and Analysis The two resistors connected to the inverting input were chosen arbitrarily. Once these values were set, all that was left to do was put the correct resistors at the noninverting input. We had to make sure the effect of the voltage division multiplied by the gain would be one-fifth. We chose R2 = R1 = 36 kOhms. This meant that the gain produced by these resistors was 2 (According to the first formula above). To make sure the final gain was one fifth, the voltage division had to divide the voltage source by ten. These resistors could be chosen arbitrarily as long as R3 was 9 times greater than R4. We chose R4 = 9.1kOhms and R3 = 82kOhms. Experimental Results In the above picture, channel one (dark blue) shows the output voltage and channel two (light blue) shows the input voltage. The signal was attuned to 4.16V. The percent error is given with the following calculation: The percent error turned out to be 4%, which is fairly accurate. Results/Conclusions For a non-inverting amplifier, the only way to achieve a gain less than one is to use voltage division at the non-inverting input. This is because the gain of the non inverting amplifier is given by one plus the ratio of the feedback resistors, which is a value that must be greater than or equal to one. Our design worked well, but there was a 4% error. The experimental value for the final voltage was 4.16V, which was a little higher than the theoretical value of 4V. This problem was most likely due to two reasons. One influence could be external noise. To reduce the effect of external noise, we attached bypass capacitors to our circuit. Another more significant influence could be that the resistors were not exactly the values written on them. The 82k resistor was mostly likely too low, which would produce a higher voltage at the non inverting input. This higher voltage would be magnified by the gain at the inverting inputs, causing an output voltage that was too high. In the same way, the 9.1k resistor might have been too low producing the same result. To fix these errors in the future, we could use a potentiometer as opposed to two resistors. A potentiometer connected to the non inverting input could be adjusted to the perfect value; this would be easier than choosing individual resistors to produce the right ratio. Circuit 2 Design Objective The purpose of this design was to take a stereo audio input that had two signals, balance these signals, and combine them to produce a 16Vpp output that is inverted. To do this, we used a weighted summing amplifier. Schematic Theory of Operation The idea behind this circuit was to use the principle of superposition and essentially apply gain to both signals and then add them together. Since the output had to be 16V, the voltage from each signal would have to be -8V. Since the amplitude of the left signal was .5V, it would need a gain of -16 to reach -8V. Since the amplitude of the right signal was .2V, it would need a gain of -40 to reach 8V. The formula for the gain of an inverting amplifier is below: Since there are two signals, they have to be added together. Here is the formula for the two signals added together. Note that the feedback loop resistor (R2) is the same for both inputs: Derivations and Analysis We chose R3 arbitrarily to be 640k. The reason we chose such a high number was that the other two resistors had to be much smaller to produce the required gains. If R3 was too small, then R2 and R1 would be below 10k; unfortunately, resistors below 10k tend to be inaccurate in circuit designs. Using the formulas for gain above, we reasoned that R1, the resistor in front of the left input, would be 40k, and R2, the resistor in front of the right input, would be 16k. Experimental Results In the first figure above, channel one (dark blue) represents the right input voltage, and channel two (light blue) represents the left input voltage. In the second picture, the light blue figure represents the inverted sum of the input voltages. The peak-to-peak voltage (or amplitude) of this wave is 15.5 V. The percent error, given by the formula in circuit one above, was 3.13%, which is pretty accurate. Results/Conclusions The inverting summing amplifier simply amplified the separate signals and added them together. The second figure shows how this combination looks as a waveform. Note that the wave takes the general shape of channel two super-imposed onto channel one. We had to use a computer to generate the two inputs because the function generator only allows one input signal at a time. The percent error we obtained was 3.13%, so there must have been some slight errors in the circuit. One error could be that the resistors were not the correct values. Our final result was lower than the theoretical value, which means that either the feedback loop resistor was too low or one of the input resistors was too high. For instance, if the feedback loop resistor was too low (say 600k instead of 620k), the gain of the op amp would be lower, reducing the final voltage. To fix this error, we should use resistors with a gold band, as these resistors have a low tolerance and are more likely to be accurate. We should also check the resistors before hand and find ones that are close to the theoretical value. This circuit could be used in headsets to balance the volume on both ears. Circuit 3 Design Objective The objective of task 3 was to create a circuit that took two balanced inputs (.5V) and allowed the user to vary the gain to produce an output voltage between .4Vpp and 16Vpp. To do this, we created a two-channel mixer. Schematic of Operation The ory To produce variable gain, a potentiometer was required. Since the circuit could vary the gain of both resistors, we need to include a potentiometer after each of the inputs. Because we used the potentiometers as variable resistors as opposed to voltage dividers, we had to disconnect one of the terminals. There was one problem with this approach, however; if the potentiometers were set to their minimum values (zero), then the resistance in front of the input values would be zero. According to the gain formula given in circuit two, this would cause an infinite gain. To rectify this dilemma, we included a resistor in addition to the potentiometer in front of the input signals. This way there would always be input resistance even if the potentiometer was turned all the way down. Derivations and Analysis We had to set up a system of two equations; one equation described the gain when both potentiometers were at their maximum resistance (minimum gain), and one equation described the gain when both potentiometers were at their minimum resistance (maximum gain). To simply these equations, it is assumed that the voltage input from the left and right channels is balanced and equal. This means that the entire problem boils down to solving for one of the resistors and then copying it to the other channel. Here are the two equations: Since there were two equations and two variables, the solution set was unique. No other combination of resistors would produce the same result. The total Vout was simply VoutR doubled, because VR and VL are exactly the same. Experimental Results The oscilloscope captures are provided on a separate sheet of paper labeled “OpAmpDesign3.ms12”. The waveform with the peak to peak voltage of .395V represents the output voltage when the potentiometers are at maximum resistance, resulting in minimum gain. The waveform with the peak to peak voltage of 15.8V represents the output voltage when the potentiometers are at minimum resistance, resulting in maximum gain. The real value of the peak to peak voltage was supposed to be .4V at minimum. The percent error was 1.25%. The real value of the peak to peak voltage was supposed to be 16 V at maximum. The percent error was also 1.25%. Results and Conclusions Varying the gain of each separate branch of the inverting input is easy way to alternate between min and max gain. A potentiometer makes varying this gain a simple process because it allows for a variable resistance. By disconnecting one part of the potentiometer and connecting the middle terminal to the rest of the circuit, we could change the resistance on the fly. There are a variety of reasons why the values were not perfect. A big reason stems from the fact that the solution is unique. Since there were two equations and two variables, the resistor values we obtained were unique to this situation. This means that any errors in the two resistors we chose could not be fixed by picking different valued resistors. These two resistors were relatively low, only about 512 ohms. Resistors lower than 10K tend to have a higher error rate than higher ones. Another way to fix a problem such as this would be to use different valued potentiometers. Having the potentiometer as a variable would allow one more degree of freedom, allowing the user to choose EXACTLY what resistor values to insert into the circuit. This would reduce any unwanted errors in the resistor efficiencies. Circuit 4 Design Objective The objective of this circuit was to take a .6Vpp alternating signal and magnify it into a signal that would swing between 0V and 10V. Since the initial swing is -.3V to .3V, a DC offset is required in addition to the normal gain. This op amp circuit is called a level shifting amplifier. Schematic Theory of Operation The idea behind this circuit was to first boost the signal to a 10Vpp alternating signal that swung between -5V and 5V. Since the range of this swing was equal to the range of the target swing (0V to 10V), all that was left to do was to add a DC offset of 5V. Fortunately, we could use the inverting amplifier for the gain because that would keep the swing the same. What we had to keep in mind was that the DC offset would also experience a gain from the two inverting input resistors. We also had to remember that our DC voltage could only come from the power source, so there would have to be resistors at the non-inverting terminal to attenuate this voltage to the appropriate value. Derivations and Analysis To go from .6Vpp to 10Vpp, we would need a gain of -16.66666. This was achieved with a 32k and 2k resistor because the gain of an inverting amplifier is given by the first equation in circuit 1. Since the ratio of R2 to R1 was 16.66666, the noninverting gain was 17.66666. This meant that for a DC offset of 5V, we would need to have a voltage of .283V at the non inverting input. Now the question became, “What resistors do we use at the non inverting input to lower the voltage from 15V to .283V?” Thanks to voltage division, as long as the resistor connected to the source was 52 times greater than the resistor connected to ground, any values could work. We arbitrarily chose R4 = 1k and R3 = 52k. Experimental Results In the oscilloscope capture above, the dark blue waveform represents the output signal. The mean of the signal is around 5V, and the peak to peak voltage is 10V, which means the wave swings between 0 and 10V as expected. The input signal, not shown on the picture, is simply a .6Vpp waveform with a mean of 0V. Unfortunately, our values were not perfect. The mean value was supposed to be 5V, but our value was only 4.82V. The percent error, using the percent error formula from circuit 1, is 3.6%. The peak to peak voltage was only 9.68V instead of 10V, so the percent error is 3.2%, which is not too bad. Results and Conclusions The law of superposition makes this task much easier. The DC offset and the AC voltage are independent of each other, so changing one at a time was the best way to attune the voltage to the required value. Applying a gain to the AC voltage essentially magnified the range of the voltage values. It started from swinging between 300mV and -300mV, but after the gain it went from -5V to 5V. The DC offset essentially translates the waveform up or down (It is almost like the yintercept of a line). We wanted to translate the wave 5 units upward to create a Vout from 0V to 10V. The most important thing to remember was that any DC offset at the non inverting output would experience non-inverting gain. This meant the DC offset was not 5, but rather a lower value. We chose resistors appropriately to produce a lower voltage value. The percent error of the mean value was about 3.6%. This error is almost entirely related to the DC offset. Since the value was too low, the DC offset was not large enough. This could have happened if R4, the resistor from the non inverting input to ground, was too small. This could have also happened if R3, the resistor from the non inverting input to the DC offset source, was too large. The percent error of the Pk-Pk voltage was 3.2%, and the measured value was lower than the expected value. This problem was caused by the AC voltage source and inverting input gain resistors. Since the value was too small, either R2, the resistor from Vout to the inverting input, was too small , or R1, the resistor from the inverting input to the AC voltage source, was too large. Circuit 5 Design Objective In this task, there was an AC voltage that had to be amplified from 200mVpp to 20Vpp. However, there is a catch. This AC voltage also had a slight DC offset that we had to remove. Unfortunately, the only thing we knew about this DC offset was that it was between 2 and 5V. Since the DC offset was unknown, we had to include a potentiometer in the non inverting part of the op amp an use it to nullify the DC offset accordingly. Theory of Operation This problem was very much like the previous one. First we had to choose the appropriate inverting gain resistors such that the gain was 100. The important thing to remember was that the DC offset from the AC voltage source would experience this same gain. This meant that our non inverting input should be able to nullify voltages in the range 200V to 500V. However, the non inverting input itself would experience a gain similar to 100 (the actual gain is 101). This made find the resistor values for R3 and R4 much easier. A potentiometer was connected in series with the other two resistors, and it provided the variable resistance necessary for producing a DC offset swing. Derivations and Analysis The gain of the inverting input had to be 100, so we arbitrarily chose 100k and 1k for R2 and R1 respectively. Using the voltage division equations from circuit 3 and the fact that the voltage at the non inverting input would be magnified by 101, we found the resistor values for 3 and R4 to be 8.93k and 4.4k respectively. Note: The DC offset source in this case was the power supply itself. Schematic Experimental Results The oscilloscope capture for this experiment is provided on a separate sheet of paper labeled “OpAmpDesign5-1.ms12”. The Peak to peak voltage is 19.9V, which is very close to the correct value of 20V. The percent error is a mere 0.5%. Notice that the mean (the two circled arrows) is exactly in the center of the graph (on the horizontal axis). This means that the DC offset was successfully cancelled out by the voltage at the non inverting input. Results/Conclusions A variable level shifting amplifier is great for removing DC noise, especially when the exact amount of DC is unknown. By setting the potentiometer to the correct value, any Dc offset within the range can be nullified. Although our percent error was extremely small, it still was non-zero. There was some error somewhere in the circuit. Since the Vout value was too small, it means that the inverting input was too high. The DC offset from the non inverting input was fine because the mean was at 0. The inverting input gain could be too high if either R2 was too high or R1 was too low. Next time, we should use no resistors lower than 10k, so it would be a good idea to change R2 to 1MOhm and R1 to 10K. Post Lab Questions 1. The easiest thing to do to create a variable gain amplifier would be to connect a potentiometer from R3 to the voltage source. Then two new equations would have to be solved (one at maximum potentiometer resistance and one at minimum resistance) to find the new resistor values such that the non inverting input varies from 4Vpp to 8Vpp. This 4V to 8V would be amplified by the two inverting input resistors to a range of 8V to 16V. Note: Assume the only potentiometer available is 20k. 20(R4/(R3+R4+RPOT)) = 4 And 20(R4/(R4+R3)) = 8 Solving these two equations produces R3 =12k and R4 = 8k. 2. If you did not want to invert the balanced output signal, you would have to connect the left and right channels to the non inverting input and choose resistors in front of them appropriately. The easiest way to go about this would be to first arbitrarily set the two resistors at the top to create a large gain. Let’s make them R2=990k and R1 = 10k. Now the two resistors in front of each the non inverting input voltages have to be chosen such that they attune their respective voltages to .08V. That way, when they experience a gain of 100 from the inverting input resistors, they will both go to 8V and ad to 16Vpp. The two resistor values for each input can be chosen arbitrarily as long as voltage division comes out with .08V. One possible solution could be to place a 6K resistor in front of VR and a 4k to ground, and to place an 84k resistor in front of VL and 16K to ground. 3. When the resistors are at maximum gain, you would need to somehow garner infinite resistance to that the voltage source provides no voltage. 4. The gain of the inverting input and the gain of the non inverting input are closely related by the two resistors R2 and R1. Having a variable signal amplification would allow you to change the inverting input gain, but unfortunately it would change the non inverting gain by a different amount, causing the DC offset to not be as expected. To fix this problem, the third terminal from the potentiometer at R2 would have to be connected to the non inverting input and attenuated properly so the DC offset would not be affected by the altered gain. 5. The problem is that we assumed the DC offset was positive, so after going through the inverting input it would become negative. For this reason, we connected the positive side of the power supply to the non inverting input so that it would cancel the negative DC offset. To fix this problem of negative or positive, we could connect a switch that would change from the positive side of the power supply to the negative side based on the polarity of the dc offset. A user could do this manually, or a comparator could be used to check the polarity and act accordingly.