Assignment 8 Analyzing Operational Amplifiers in MATLAB and PSpice


 Garry Porter
 8 months ago
 Views:
Transcription
1 ECEL 301 ECE Laboratory I Dr. A. Fontecchio Assignment 8 Analyzing Operational Amplifiers in MATLAB and PSpice Goal Characterize critical parameters of the inverting or noninverting opampbased amplifiers. Measure the slew rate of two opamps and determine which is higher. Along the way we will learn new techniques and commands in PSpice and MATLAB. PreLab Reading ECEL 301 Week 8 Lecture Notes Textbook pp , Parts Required 500 Ω, 2 kω, 10 kω resistors 5 pf, 100 pf capacitor ua741 or LM741 opamp TLC081A opamp Software Required Cadence PSpice/Probe MATLAB Get Waveform Data and Get Screen Image macros for Excel and Word Introduction The operational amplifier (opamp) is an analog integrated circuit that gets it name from it s usefulness in performing mathematical operations. The opamp can be used in circuits that add, subtract, integrate or differentiate analog signals (voltages or currents). It forms the basis for the analog computer. Because of the opamp s flexibility and low cost, it is an indispensable tool in the analog circuit designer s toolbox. Digital designers can use it to interface to the analog world. Some common opamp applications are given in Table 1. 1
2 In this experiment you will have to opportunity to simulate opamp circuits in PSpice, make measurements on a simple opamp circuit, and analyze real and simulated data in MATLAB. Table 1. Common Opamp Applications Integrator Oscillator Filter Buffer Amplifier Differentiator AnalogtoDigital Converter Sweep Generator DC Amplifier Function Generator Summing Amplifier Common Amplifier Configurations The Inverting Amplifier Figure 1. Inverting Amplifier Closed Loop Gain A v = R F R The gain of the inverting amplifier (Figure 1) is fixed by external components only, not by any property of the opamp itself. Equation 1.1 was derived in our Week 8 lecture notes. The voltage transfer curve for this amplifier is shown in Figure 2, where ±Vcc are the positive and negative power supply voltages, respectively. 2
3 Vout  +Vcc Vin  Vcc Figure 2. Voltage Transfer Curve for the Inverting Amplifier The NonInverting Amplifier Figure 3. NonInverting Amplifier Closed Loop Gain A v = R1+ RF R1 = 1+ RF R1 1.2 The closed loop gain of this amplifier (Figure 3) is at least one, and is always positive. The voltage transfer curve of the noninverting amplifier is given in Figure 4. 3
4  +Vcc Vout Vin  Vcc Figure 4. Voltage Transfer Curve for the NonInverting Amplifier The Voltage Follower Figure 5. Unity Gain Amplifier also known as the Voltage Follower The voltage follower (Figure 5) is a special case of the noninverting amplifier with R1 an open circuit and RF a short circuit. The magnitude of Vout equals Vin, but this circuit is still useful where the high input impedance or low output impedance of the operational amplifier is needed. 4
5 Opamp Limitations Offset Voltage Due to manufacturing and design limitations, the opamp may produce a small, nonzero output voltage when the input is grounded. In devices like the ua741 the offset can be reduced or eliminated by using a potentiometer between the offset adj pins (pins 1 & 5), as in Figure 6. Figure 6. Potentiometer Added to an Inverting Amplifier to Null Offset Voltage Slew Rate Slew rate describes the maximum possible rate of change of the opamp s output voltage (Equ 1.3). A slew rate slower than the rate of change of the input will cause distortion. We can test the slew rate by using a large, fastchanging signal at the input, such as a square pulse (Figure 7). SR = dv out dt max 1.3 5
6 V in V V out V t Slope=SR Figure 7. Pulse Response of a Voltage Follower Our goal is to extract the slope of Vout in the transition region from a set of experimental data. The textbook has code for doing this analysis in Example 6.3. The code can be downloaded from the course web site in the Week 8 materials. You are not responsible for the full power bandwidth portion of the author s code, and it should be deleted. The author s Example 6.3 code is based on the diff function. Y = diff(x) calculates differences between adjacent elements of X. If X is a vector, then diff(x) returns a vector, one element shorter than X, of differences between adjacent elements: [X(2)X(1) X(3)X(2)... X(n)X(n1)]. The slope is calculated as dvo = diff(vo)./diff(t);, or in words, the difference between adjacent yvalues is divided pointbypoint (note./) by the difference between xvalues. The slew rate is the maximum value of vector dvo. Due to the nature of the data returned by the oscilloscope, this method is not effective, and the slew rate will have to be calculated by other means. Tasks Simulate an inverting amplifier or noninverting amplifier based on the ua741chip in PSpice o Save V out vs V in data to a file Run the analysis of Example 6.1 on the simulated data Make slew rate measurements on two opamps (ua741 and TLC081A) Modify the analysis of Example 6.3, and run on each set of slew rate data t 6
7 Procedure Build a PSpice schematic for either the inverting or noninverting amplifier based on the ua741 opamp. o The ua741 part is in the OPAMP library o Choose R1 and RF to produce a gain magnitude A v between 2 and 5. All resistor values should be at least 1 kω. o Add power supplies to the opamp as shown in Figure 8. Let Vcc = ±15 V. Use the VCC_BAR device (PWR tool) at each point where power is needed and rename the device as needed. All instances with the same name are assumed to be connected. o Sweep the input voltage from Vcc to Vcc+ o Plot the voltage transfer curve o Save the plotted data to a text file. These results will be analyzed in MATLAB. Figure 8. Inverting Amplifier in PSpice with Power Supplies Run the analysis of Example 6.1 on both sets of simulated data o The example code can be downloaded from the course web site s Week 8 materials o The code may need to be modified to suit your data file o The outcome of the analysis should be a voltage transfer curve for the simulated circuit, and the following quantities Maximum Output Voltage Minimum Output Voltage Gain Minimum Input Voltage for Linear Amplification Maximum Input Voltage for Linear Amplification Make slew rate measurements on two opamps (ua741 and TLC081A). The schematics are given in Figure 9a and 9b. Connect power to pins 4 7
8 and 7 as appropriate for your opamp. The ua741 needs +15 V on pin 7 and 15 V on pin 4. The TLC081A uses +12 V on pin 7 and pin 4 is grounded. The experimental setup is shown in Figure 10. o Apply a step voltage Vin to input 0 Vin 5 V This will require that you adjust the offset voltage on the waveform generator. o Pick a square wave frequency f = 100 Hz, 1 khz, 10 khz, or 100 khz o Set the scope to trigger on the rising edge of Vin. Adjust the scope timescale until a response like that in Figure 11 is seen. o Capture the data Open Microsoft Excel Locate the Get Waveform Data macro icon near the top right of the screen. Click the icon and choose the number of points to be saved and where the data will go. o Disable the power supply outputs. Switch opamps and adjust the protoboard for the different component and power supply requirements. Enable the supply and repeat the SR measurement at the same input frequency. o Feel free to take data at the other three frequencies. Investigate the behavior of the voltage follower at low and high frequencies. Record your observations. Figure 9a. Voltage Follower for Slew Rate measurement ua741 8
9 Figure 9b. Voltage Follower for Slew Rate measurement TLC081A DC Supply Ch1 Ch2 Ch3 Computer, Macros Waveform Generator Output Vcc+ Vcc Vin Vout GND AMP GND ChA1 Scope ChA2 Figure 10. Equipment for Slew Rate Measurement 9
10 Figure 11. Step Response of a ua741based Voltage Follower. Channel A1 is input and A2 is output. Input frequency = 100 Hz, 0 V Vin 1 V, Rout = 2 kω, Cout = 100 pf, Vcc = ±15 V. Analyze the slew rate data in MATLAB o Write the MATLAB code that will calculate the slew rate o Use this code to analyze all of your measurements Deliverables Put the following deliverables into our standard lab report format, in the proper places Inverting or noninverting amp schematic Analysis of the amp o Voltage transfer curve o Numerical results o MATLAB code in an appendix Slew rate measurements on both opamp models Analysis of the slew rate data o Make sure you explain your approach to finding the SR o Slew rate for both opamps o MATLAB code in an appendix (no WebCT submission) Conclusions o Comparison of inv/noninv amplifier performance to theory and your expectations o Comparison of the measured ua741 and TLC081A slew rate results to the SR published on device datasheets 10
11 Make good use of figures and tables in your presentation. References PSpice and MATLAB for Electronics, J.O. Attia, CRC Press, MATLAB internal documentation Microelectronic Circuits, 4th ed., Sedra and Smith, Oxford University Press, TLC080, TLC081, TLC082, TLC083, TLC084, TLC085, TLC08xA Family of WideBandwidth HighOutputDrive Single Supply Operational Amplifiers, SLOS254D, June 1999, Revised February 2004, Texas Instruments Datasheet. UA741, ua741y GeneralPurpose Operational Amplifiers, SLOS094B, November 1970, Revised September 2000, Texas Instruments Datasheet. 11