Lecture 19 Op Amps Mark Horowitz Stanford University horowitz@ee.stanford.edu Copyright © 2016 by Mark Horowitz M. Horowitz E40M Lecture 19 1 Midterm 40 120.00% 35 Frequency 100.00% Cumulative % 30 80.00% Frequency 25 20 60.00% 15 40.00% 10 20.00% 5 0 0.00% 5 40 45 50 55 60 65 70 75 80 85 90 95 More Bin M. Horowitz E40M Lecture 19 2 Reading A&L: Chapter 15, pp. 863-866. Reader, Chapter 8 which will be out soon • • • Noninverting Amp – http://www.electronics-tutorials.ws/opamp/opamp_3.html Inverting Amp – http://www.electronics-tutorials.ws/opamp/opamp_2.html Summing Amp – http://www.electronics-tutorials.ws/opamp/opamp_4.html M. Horowitz E40M Lecture 19 3 Roadmap To measure our heart’s electrical signal, we need to measure small voltages. We introduce a new component, an Op Amp, that can amplify small signals and make them much larger. The problem with an op-amp is that the gain is too large, around a million. Fortunately we can use feedback around this component to build an amplifier with the gain that we need. In this lecture we will go over the basics of op-amp circuits. In the next lecture we will show how to combine impedance ideas with op amps to create filters that have a peak gain greater than one. M. Horowitz E40M Lecture 19 4 Learning Objectives • Understand what an op amp is: – The inputs take no current – The output is 106 times larger than the difference in input • The “golden rules” of op amps – Input current is 0; Vin- = Vin+ • Be able to use feedback to control the gain of the op amp – For inverting and non-inverting amplifiers M. Horowitz E40M Lecture 19 5 PREVIOUSLY IN E40M M. Horowitz E40M Lecture 19 6 Bode Plot • Plot of Vout/Vin – Where both axis use logarithmic scales – Y is in dB – X is in log(F) • Easy to estimate shape, since every region is a straight line – k – slope = 0 – k*F - slope = 1 – k/F - slope =-1 – k/F2 - slope = -2 M. Horowitz E40M Lecture 19 7 Example Bode Plot 10 100 1 10 0.1 1 0.01 0.001 0.1 0.0001 0.01 0.00001 1 M. Horowitz 100 10000 1 1000000 E40M Lecture 19 100 10000 8 Frequency Domain Analysis • Analyze the circuit by what it does to each sinewave – What is the output/input ratio for each frequency sinewave • This is called the transfer function: 𝑉𝑜𝑢𝑡 (𝐹) 𝐻 𝐹 = 𝑉𝑖𝑛 (𝐹) • Notice that this is a property of only the circuit, and not the input M. Horowitz E40M Lecture 19 9 Want to Measure our Heart’s Electrical Signal M. Horowitz E40M Lecture 19 10 OP AMPS M. Horowitz E40M Lecture 19 11 Op Amp • Is a common building block – It is a high-gain amplifier • Output voltage is – A (V+ - V-) – Gain, A, is 10K to a 1M • Output voltage can be + or – – Often runs from +Vdd and -Vdd supply – Huh? M. Horowitz E40M Lecture 19 12 Op-Amp Power Supply • Up to now we had one supply voltage, Vdd – All voltages were between Vdd and Gnd – Generally measured relative to Gnd • So all voltages were positive. • A sinewave goes positive and negative – And most input signals do that too • It is convenient to have a reference where – The output can be positive and negative – Can do that by changing what we call the reference M. Horowitz E40M Lecture 19 13 Moving the Reference Vdd = 2.5 V Vdd = 5 V + + - + - vout - + vout + 2.5 V - - The voltages are all the same, only the reference voltage has moved M. Horowitz E40M Lecture 19 14 Op Amp Behavior • Relationship between output voltage and input voltage: 𝒗𝒐 = 𝑨 𝑽𝒊𝒏+ − 𝑽𝒊𝒏− = 𝑨 𝒗𝒑 − 𝒗𝒏 – A is the op-amp gain (or open-loop gain), and is 10K-1M • The input currents are generally small So ip ≈ 0 and in ≈ 0. M. Horowitz E40M Lecture 19 15 Since the Output Swing is Limited • Inside the op-amp are transistors – Which drive the output voltage • Using energy from the power supplies – If the input difference is too large, the output “saturates” M. Horowitz E40M Lecture 19 16 What Does This Do? vout Vdd = 5 V 5 + 4 vin + - + + - vout 2.5 V 2 1 - M. Horowitz 3 E40M Lecture 19 1 2 3 5 4 17 Same Circuit Different Reference vout Vdd = 2.5 V + vin + - 2 + + - vout 1 0 -1 2.5 V -2 - M. Horowitz E40M Lecture 19 -2 -1 0 2 1 18 How To Get A Useful Amplifier • The gain of the op amp is to high to make a good amplifier – We need to do something to make it useful • We will use analog feedback to fix this problem – Feedback makes the input the error between the value of the output, and the value you want the output to have. • Let’s see how to do this M. Horowitz E40M Lecture 19 19 Connect Vout to Vin- vout A(Vin Vin ) A(vin vout ) Vdd = 2.5 V + vin + - + -Vdd = -2.5 V vout - M. Horowitz E40M Lecture 19 20 What Is Going On • We solved the equation to find the answer – But how does the op-amp get this answer? • Think about what happens when the input increases in voltage – From 0V to 0.1V – Initially the output can’t change • There is capacitance at every node – The op-amp thinks it needs to create a huge output voltage • So it drives current into the output • Which charges the capacitor • Causing the output to increase – This then decreases the input difference M. Horowitz E40M Lecture 19 21 Feedback in an Op-amp • As the output rises – The input difference decreases – So A * DVin also decreases • The system is stable when – A * DVin is exactly Vout • If A is large (like a million) for any Vout – Say in the range +/- 10V – DVin will be very, very small – Can approximate that by saying DVin will be driven to 0 – 𝑽𝒊𝒏+ ≈ 𝑽𝒊𝒏− M. Horowitz E40M Lecture 19 22 BUT • This is only true if you connect the output feedback – To the negative terminal of the amplifier • What happens if you connect it to the positive terminal? M. Horowitz E40M Lecture 19 23 Ideal Op Amp Model (when using negative feedback) The Two Golden Rules for circuits with ideal op-amps* No voltage difference between op-amp input terminals No current into op-amp inputs * when used in negative feedback amplifiers M. Horowitz E40M Lecture 19 24 USEFUL OP AMPS CIRCUITS M. Horowitz E40M Lecture 19 25 Approach To Solve All Op-amp Circuits • First check to make sure the feedback is negative – If not stop! • Find the output voltage that will make the input difference 0 – Assume Vin- is equal to Vin+ • Find Vout such that KCL holds – Solve for Vin- as a function of Vout, Vin- =kVout • Then set Vout = Vin+/k • Both methods always work, but usually one is easier – When in doubt, use the first one M. Horowitz E40M Lecture 19 26 Non-inverting Amplifier At node vn M. Horowitz E40M Lecture 19 27 Inverting Amplifier vn = vp = 0 M. Horowitz E40M Lecture 19 28 Summing Amplifier KCL at the summing point (or summing node): Output voltage is a scaled sum of the input voltages: M. Horowitz E40M Lecture 19 29 Current-to-Voltage Converter KCL at the vn node: M. Horowitz E40M Lecture 19 30 DIFFERENTIAL AMPLIFIERS M. Horowitz E40M Lecture 19 31 What Happens If We: • Take an inverting amplifier and drive the other input? v1 v2 • Not quite what we want. M. Horowitz E40M Lecture 19 32 Differential Amplifier 1.0 M. Horowitz E40M Lecture 19 33 Learning Objectives • Understand what an op amp is: – The inputs take no current – The output is 106 times larger than the difference in input • The “golden rules” of op amps – Input current is 0; Vin- = Vin+ • Be able to use feedback to control the gain of the op amp – For inverting and non-inverting amplifiers M. Horowitz E40M Lecture 19 34