Topics covered: Operational amplifier circuits
Instructor: Prof. Anant Agarwal
All right. Good morning. Let's get going. In today's lecture we continue with the operational amplifier, "op amp" for short. And what we are going to do is just build up a bunch of fun building blocks using the op amp.
As a quick review -- To quickly review what we've seen about the op amp -- We represented the op amp as a device that looked like this where the amplifier had an incredibly high gain. So, if I had a small voltage difference here -- I call this v plus and this v minus with respect to ground.
And if I had a small voltage difference then this gain here would multiply the difference by a large number and thereby giving me an output that was on the order of a million times greater than this difference.
And because of that when I use the op amp in a mode like this without any negative feedback the output would usually crank up to the positive rail or the negative rail. We also saw that it had infinite input resistance so that the current flowing in here or here was zero and also had zero output resistance.
This is my ideal op amp where irrespective of what load I connect here the op amp would supply pretty much any current. Now, in practical op amps that's not the case. But suffice it to say that when used as an ideal op amp the output impedance, the output resistance is going to be zero.
The op amp is a huge workhorse of the analog industry. You will see based both on what you've done on Tuesday and Wednesday but also today that it's very, very simple to build circuits using the op amp.
When you use the amplifier, you don't have to worry about things like nonlinear analysis. You don't have to worry about am I really meeting the criteria for saturation limits and so on? To some extent you have to think about that with the op amp, too, because if the output hits the positive rail or negative rail it isn't going to behave like you expect it to.
But fundamentally with this primitive model, this idea model it becomes really simple to build circuits with the op amp. Therefore it has become a key building block for circuits. When circuit designers build analog circuits very often their primitive building blocks are really an amplifier of this sort, an op amp, resistors, capacitors and some of our other primitive building elements.
If you look at the course notes the readings are -- There are a bunch of examples solved in Chapter 16. And you will see that using the op amp it is indeed possible to build current sources that look like more or less ideal current sources.
It is also possible to build voltage sources and so on. It is an incredibly neat building block using which you can do all kinds of cool stuff. In this course you will see a whole bunch of example circuits using the op amp.
In today's lecture you will see things like a subtractor. You will also see integrators and a differentiator. And then in your lab, lab four, you will build a really fun mixed signal circuit involving both digital and analog components.
And you will build what is called a digital to an analog converter using the op amp. And of course I can build all our good-old amplifiers and circuits of that sort. In a later lecture you will also see how we can build filters using an op amp.
This is going to be using the knowledge you learn in terms of connecting resistors, capacitors and inductors together and doing a frequency domain analysis, well we can throw the op amp in there and build filters, too.
This is just to give you a preview of upcoming attractions. For today I am going to focus on these circuits. I won't be covering any new theory or any new set of foundations but pretty much take the simple properties that I have explained to you about the op amp.
And using those simple properties very quickly build up a bunch of circuits that you can use to analyze signals in a variety of ways. Let's start with the following circuit. With op amps I start with this little guy.
And what I am going to do is use two voltage sources, v1, and this is a resistor, not an inductor. And value R1, value R2. So, I have a voltage connected by a divider, voltage divider to the plus input.
And I am going to provide some negative feedback in the following way. This is going to be R2, the same as this one here, a resistor R1. And then a voltage source v2 that I connect out here. So notice that- Oh, and I take the output vOUT out here.
And that vOUT of course is with respect to ground, and R2, v1 and v2 are also connected to ground. What I am going to do is analyze the circuit it two different ways, and as I analyze it describe some other interesting properties to you.
In the last lecture the technique I used to analyze op amps was one in which I replaced the op amp with its ideal model involving a dependent source and so on with a large gain A and showed that. I wrote the expression and then I let A increase to infinity to the limits and got an expression that was independent of A.
And then in recitation yesterday you would have covered another technique which makes it much simpler to analyze op amps. Let me very quickly review that method. We fondly call that technique, there is no formal name for it, but we fondly call that v plus more or less equal to v minus method.
This is also variously called the virtual ground method and so on, but we shall call it the v plus more or less equal to v minus method. The insight here is that whenever I use the op amp in a way in which I am giving it negative feedback, so I am feeding some portion of the output to its negative input.
I am giving it negative feedback. That's one property. Second property is that my inputs, v1 and v2, and my resistance values are chosen such that the output is not in saturation. So, the op amp is not at the plus VS rail or minus VS rail.
Rather it's somewhere in the middle in its active region. When that happens we claim that the v minus and v plus for the op amp are more or less equal. And to give you some intuition as to why that is so, let's say the output is 6 volts and my supply is plus/minus 12.
This is 6 volts and the amplifier is a gain of a million, ten to the six. To sustain 6 volts at the output all I need is a difference of 6 microvolts here. Six divided by ten to the six is the difference between v plus and v minus.
It's very, very, very small. It's so small as to make v plus more or less equal to v minus. All it takes is a very small differential voltage here to give you 6 volts at the output. The key thing to observe is under negative feedback, when the op amp is not in saturation the property that v plus equals v minus holds.
And the way it works is that it's not that it's a magical property. It is simply that when I apply negative feedback the negative feedback is such that it will force this v minus node here to be at more or less the same voltage as v plus.
Remember the when in doubt simply go back and think about the anti lock brakes example we did last time. For example if v plus increases the output will increase and so will the voltage here and tend to make these two equal.
What we can do, being rather tricky here, what we'll do is say look, if we know for a fact that under negative feedback the op amp is going to engineer these two node voltages to be more or less equal then why don't I just use that fact to begin with and analyze my circuit assuming that it's true.
This is just a bit of inverted logic here that says look, the circuit is going to make that happen. If the circuit is going to make that happen to analyze the circuit in its steady state, why don't I just go ahead and assume that to begin with? This again goes back to us wanting to be engineers here and do whatever is simply and find the simplest possible way of getting some place.
I want to use that method, the v plus equals v minus method. Let me just first write down some values that I know about. I know that v plus is simply a voltage divider relation here. That's v1 times R2 divided by R1 plus R2.
And by the v plus equals v minus method I know that this is going to be equal to v minus. And this is going to be true because I am giving you negative feedback here. And we are going to engineer the values of R1, R2, v1 and v2 such that the op amp is not in saturation.
So, we know that. The next thing that we know, let's say this is a current i. This current i flows here. Know that there is no current going in here. Op amp has an infinite input resistance so there is nothing going in there.
There is no current going in there. If there is no current going in here, what must happen to i? Remember, from the foundations of the universe Maxwell's equations and therefore KVL and KCL hold. KVL and KCL simply come straight from nature.
You and I cannot mess with that. Bad things happen to you if you do. So, nature, Maxwell's equations, KVL, KCL. It's simply nature. So, KCL applies here. Current comes in here. Nothing goes there.
Don't argue. The current has to go here, period. No if, ands or buts. There is i coming in here, nothing goes there, so that current must flow here. It has no choice. It's from basic nature. I can write down what my current i is going to look like.
What is i going to look like? Well, I know v2, I know v minus. v minus is the same as v plus. And v plus is the i expression given here. So, I can write i as v2 minus v minus divided by R1. Let me keep track of those two and then go ahead and compute vOUT.
So, my goal in life is compute vOUT as a function of the two input voltages v1 and v2. And just for kicks I have gone ahead and computed some of the intermediate node voltages and currents. How do I write vOUT? What is vOUT? vOUT is simply v minus from KVL.
vOUT is simply v minus minus the drop across this resistor. So, the drop across that resistor is simply iR2. From good-old KVL from the first lecture, a voltage minus the drop across the resistor is equal to vOUT.
Therefore it's simply v minus minus iR2. One thing to be very cautious about, I will tell you right now, is that the output here relates to the inversion of the voltage across this resistor R2. Be very, very careful in that if I have a voltage across this resistor here that impacts vOUT with a minus sign attached to it.
Notice that iR2 is the voltage across R2 and vOUT relates to the negative of that. Be very cautious. That's one of the commonest silly mistakes I have seen people make in solving problems like this.
Let's go ahead. I know v minus and I don't know i. Let me substitute for i for now, and that is v2 minus v minus divided by R1 times R2. Let me go ahead and collect all the v minuses. v minus, I get a one here, minus minus becomes a plus, and so I get R2 divided by R1 out there.
And then I minus v2 R2 divided by R1. That is vOUT. Now let me go ahead and substitute for v minus. And that is simply v1 R2 divided by R1 plus R2. That is v minus. And this character here is simplified to be R1, R1 plus R2 minus v2 R2 divided by R1.
What do we get? I cancel these two suckers out and what I end up with is v1 R2 divided by R1 minus v2 R2 divided by R1, which is simply R2/R1(v1-v2). What is interesting here is that what I have ended up building is a very primitive subtractor.
So, my output relates to v1 minus v2 multiplied by the constant factor given by R2 divided by R1. Again, as I pointed out to you at the beginning of this lecture, no knew foundations today, no new theories, no new disciplines, no new laws.
We are just going to take what you have learned -- Three simple things, infinite gain, infinite input resistance, zero output resistance, plus this new thing v plus equals v minus. And just being armed with those four principles we are just going to charge ahead and analyze a bunch of circuits.
It is purely intellectual and pure applications today. This is one way of doing it. There is another way of solving it. We can solve the circuit. Remember, whenever you see a linear circuit and you see two sources or three sources, just think superposition, right? You see a linear circuit and two or three sources, think superposition.
We should be able to apply superposition to this. The op amp is simply another building block. It's a linear circuit. So, let's see if we get the same answer. Let's try to solve the circuit using superposition and see if we get the same answer.
To do superposition what I am going to do is build two subcircuits. One subcircuit in which v1 is zero, and that subcircuit looks like this. If I set v1 to be zero then I get R1 parallel R2 going to ground.
So, if v1 is set to zero then R1 goes to ground. And I get R1 parallel R2 here. And of course I have v2 as before. And this was R1, this was R2, and let me call that vOUT1. Oh, I'm sorry. Let me call it vOUT2 corresponding to that component of the output that relates to v2 acting alone.
Remember superposition? Build two subcircuits, one that depends on v2 and another one that depends on v1. Let's do the second one, too. Second one is v2 going to zero. Here is my little op amp. And what I will do is simply flip the op amp just to see if you can identify some interesting patterns.
Just flip the op amp around. And this is v1 as before. And recall that v1 was going to the plus node through a resistor R1. And then I had a R2 to ground. And then let me short v2 to ground. And when I short v2 to ground what happens? When I short v2 to ground what happens is that the tail of R1 here goes to ground.
And so it is as if the output is connected to the node v minus through a resistor, so it as if the output v R2 is connected to the minus input through a resistor. We will draw it like this. And the minus input goes through a resistor R1, to ground.
If you thought that patterns were important in the earlier part of the course doing voltage divider patterns and current divider patterns and amplifier pattern, the source follower pattern, op amps is all about patterns.
You should remember two or three simple patterns and be able to write down the expression for those just by observation. So, this is one common pattern that you have seen before in the very first lecture.
And I just wrote it down in that manner. Let me go ahead and solve this circuit. It turns out that this is also a pattern. I will analyze it today but in the future v2 going to this node through R1 and then R2 to the output.
You have probably also seen this in your recitation. This one is called an inverting connection and this one here is called a non-inverting connection. Let's go ahead and do vOUT2. vOUT2 is simply given by, notice that since this is ground, no current flowing here, this voltage is zero.
If this voltage is zero, this voltage is zero by the v plus equals v minus method. If this is zero, the current that goes through here is v2 divided by R1. And that same current must flow through the resistance R2 as well.
If the current v2 divided by R1 flows through this resistor, the drop across this resistor is simply given by, let me hide this for a second, is simply given by v2. So, v2 divided by R1 is the current here.
This is zero. So, the drop across this resistor is v2 R1 multiplied by R2. That's a drop across this resistor. This voltage is simply zero minus a drop across the resistor. So, it's zero minus the drop across the resistor and that gives me v2.
Again, remember this minus sign comes in when I want to convert this to get the output voltage from that. This is a very common pattern. It's called an inverting connection where the output is some factor of the input voltage and the factor is given by R2 divided by R1.
Let's go ahead and analyze this guy now. What is vOUT1 equal to? I should have called this vOUT1 because it relates to v1. vOUT1. There is a v plus here. From our first lecture I know that vOUT1 relates to v plus in the following way.
I know that it is v plus times the sum of the resistances divided by R1. Based on the first lecture this is true. vOUT1 is simply an amplified version of v plus where the amplification factor is given by R1 plus R2 divided by R1.
And I know v plus is simply a voltage divider action here. And I can take a simple voltage divider action here because the current going in is zero. Looking in here this is as if it's an infinite resistance, so it is as if the element simply does not exist.
The voltage here is simply v1 divided by R1 plus R2 multiplied by R2, our voltage divider pattern. So, I get v1 times R2 divided by R1 plus R2 times R1 plus R2 divided by R1. These two cancel out which gives me vOUT1 is simply v1 R2 divided by R1.
To get vOUT I add up the two. vOUT is vOUT1 plus vOUT2, which is my goal. And that is simply v1 R2 by R1 minus v2 R2 by R1. Thankfully what we have here is the same as here. Again, there is really nothing new that I am going to cover today.
Simply apply, apply, apply, four simple principles. Here I have used superposition and I am showing you a circuit. So, it turns out with op amps you should really remember that pattern. You will see it again and again and again.
And each time you see it, it will save you six minutes of having to solve the circuit without knowing the pattern. So, remember this pattern. You can pick up another three or four minutes by remembering this pattern here.
This pattern is simply v2 R2 divided by R1. Imprint those two patterns into your brains. OK, so those are a couple of simple circuits using the op amp. We built a subtractor. The next step, let's go ahead and try to build an integrator.
Using this little building block we can go ahead and try to build a bunch of circuits. We can build filters, A to D converters and so on. Let's build an integrator. Abstractly I need to build this box.
Which when fed a vI, I want that box to integrate and give me a vO which is vI integrated over time. That is what I want to build. How do I go about building it? What I would like to do next is give you some flavor for design.
How do you go about designing things with an op amp? Knowing that you do not know the pattern for this yet, how do you go about designing things? Well, let's start with the following intuition. The intuition that I begin with is that if I have a current i, and remember that capacitors and inductors related to, you saw differentiation and integration happening when we dealt with capacitors and inductors.
So, I think we have to invoke a capacitor here or an inductor. In this example I invoke a capacitor. Notice that if I stick a capacitor in here this current is i, capacitance C, then my voltage vO is given by what? Voltage is simply the integral of the current flowing through it or vice versa i is C dv/dt.
If i is C dv/dt then v is simply one by C integral. If I can pass the current through a capacitor then the voltage across the capacitor must be a current. Notice then that vO is related to i dt. I have some multiplying constants and so on, but fundamentally what I have found is if I can stick a current through a capacitor then the voltage across the capacitor relates to the integral of the current.
OK, that's interesting. So, I have an integral in there. But I have a current. Notice my goal was to integrate a voltage. What I figured out how to do was if I can turn that voltage into a current -- If I can turn that voltage into a proportional current and then pump that current through a capacitor I will get the integration that I want.
How do I convert my vI to i? How do I do that? Well, let's take a stab at it. Here is my vI. Let's take the resistor R. And remember I need to stick the capacitor here. I have some current I here.
I don't know what the current is yet. And I stick a voltage here. And what I am trying to do is trying to see if I stick a voltage and a resistance in series then there is some relationship between the current and this voltage.
Recall that I am trying to make this current be directly proportional to the voltage vI. But it turns out that i here is not equal to vI divided by R. If i was vI divided by R somehow, I am done. If i was vI divided by R, by some magic, then I have converted my voltage to a current, I feed that current through my capacitor and vO is my integral that I am looking for.
But unfortunately i is not equal to vI divided by R. You know that. i relates to vI minus the capacitor voltage divided by R. So, i is not simply vI divided by R for all time but i is really vI minus the capacitor voltage divided by R.
And, in fact, when we did RC circuits you wrote this equation to represent the dynamics of the circuit, RC dvO by dt plus vO equals vI. We wrote down this circuit for a first order RC, wrote this equation for a first order RC circuit.
Now, it does turn out, to wrap up on this wild goose chase that we went on, it does turn out that if this term here is much bigger than that term. If this term is much bigger than that term then I can ignore that term and write down RC dvO by dt more or less equal to vI.
If that were true, this would be true, and then vO would be more or less equal to one by RC integral of vI dt. Again, if this were true. If this were true for all time then vO would be integral of vI dt.
Again, remember this is all a wild goose chase. Just write down WGC there just so you don't get confused. I am on this wild goose hunt here trying to find a way to get a current from a voltage which I can then feed into a capacitor.
This was one thing I knew, but this was not what I want. But it does turn out to be what I want when vO is very, very small. So, I see some glimmer of hope but not quite. It turns that in R and C, if I make R and C very, very big, if I have a huge time constant, with a huge time constant the voltage vO looks like an integral of vI, but only when I have a very huge time constant.
So, I give up on that track. Instead I try something else. Another try. I would like you to notice if you take your op amp, here is your op amp, if you take this op amp and you stick the positive terminal to ground, under reasonable feedback, under reasonable negative feedback what do you notice about the current? If I had a current i flowing here what did you notice? Look at this picture.
I had a current i flowing in here, v2 divided by R1. And because this resistance was infinite all the current went through the upper terminal. So, this is zero volts. And by the v plus equals v minus method this is also more or less equal to zero.
And I have a current i flowing in here, nothing goes here, so then the i must flow up there. So, all I am doing here is causing a reflection of the current from this grounded node. My current is being reflected into, or deflected if you feel like it, the upper edge here after coming in through this edge.
That is interesting. We are just one step away from the key insight. I have an i coming in here, an i going out there. Notice that, as I said before, this is zero volts. How do I get my voltage vI to look like a current, to become proportional to a current? It is simple now.
All I do is put a voltage vI and put a resistor R out there. If I do that, and since this is zero, the current i is given by vI divided by R. I have gotten to where I want to be. So, by using an op amp and using the fact that the minus node here, v minus is at the same potential as v plus when there is negative feedback then I can stick a resistor here.
And because this is zero the current here is simply vI divided by R. I have gotten to the first place. Now all I need to do is simply pump this current through a capacitor and I get the integral of the, the voltage becomes an integral of the current.
That is easy. I stick my capacitor here and I get my answer out there as vO. Notice that when I do this, let's say this is plus/minus VC. This is zero. So, vO is minus VC. Again, I will keep emphasizing it maybe 17 times throughout this course that if this is zero then the output here is related to the negative of this voltage, common, common, common mistake.
I will be very upset after doing all this if I see this mistake happen in any of the future homeworks or finals or whatever. This should not happen. So, vO is a minus sign here VC. And I know that if I have a current i through a capacitor what is VC? If I have current i through a capacitor than this is simply t i dt.
And i by design is -- So, I have my integrator. It is a two-step process. I stuck a resistor here, so the current became equal to vI divided by R. Then I took that current and pumped it through a capacitor through this terminal here, and the voltage across the capacitor for a current i is given by this expression.
This is Capacitors 101. OK Capacitors 101 says that the voltage across the capacitor is simply one by C integral i dt. Another way of looking at it is the voltage across the capacitor is C, I'm sorry, the current through a capacitor is C dv/dt.
This is simply the integral form of that equation. And I am done with my integrator. So, this is another very common building block. Remember this. Most of the circuits we will be seeing with op amps simply involve something here and some there.
And the output in this inverting connection is the output times, if it is a resistance it is simply R2 divided by R1, if it's a capacitor I get the integral form looking like this. Yes. Can someone tell me where the negative sign went? The blackboard ate it up.
Good catch. After all that lecture about watching the negative sign. After this little bit of faux pas here, now I will be doubly mad if you guys make that mistake. All right. Now that we have built the integrator, I could give this out as a homework problem.
And you should be able to design a differentiator based on what you've learned here. You now have the tools to go and do some design like this, but we don't have any more homeworks left so I guess I will go ahead and solve this for you right here and do the design for you.
The building block that we need looks like this, d/dt here. Let me take a vI and stick a vI in there. That's what I want to build. And what I built here is that different integrator box. And what I would like to do now is build a differentiator box.
How do I go about doing it? I will go really slow here so you will have some time to think about it for yourselves and see if you folks are crack op amp circuit designers already, if you have the right instincts here.
Again, when you see differentiation integration think capacitors or inductors, it doesn't matter. In fact, as a homework exercise, you may want to go back and see how you can get a similar effect using inductors.
Can you play with inductors and get a similar effect? So, inductors are devices that are a dual of the capacitor. Whatever we will do with capacitors, there must be a corresponding way with inductors.
You can try it out in your spare time. Let's go back to this one here. I will stick with the capacitor way of looking at things. I need a differentiation now. Remember this. If I have a vI and I stick this across a capacitor, I have a current C and some voltage vc across the capacitor, what does i relate to? i is simply C dv/dt and vc in this case is simply C dvI/dt.
If I can stick a voltage across a capacitor, if my input voltage is stuck across a capacitor then the resulting current relates to dvI/dt. Here we have the opposite problem. By doing this simple trick, I can obtain a current that has the right form.
Now what I need to do is somehow convert that current into a voltage because the abstraction that I need is a voltage to voltage. The next step, what I need to do is somehow convert a current to a voltage.
How do I go about doing that? Again, remember for the op amp, if I have a current i flowing here then by the reflection property i gets pushed up into this edge, provided that the whole circuit is working with descent negative feedback.
Given this trick what I can do is say look, suppose I did this. Remember, my goal here is how do I convert a current to a voltage? I have a current i coming in here, and I can turn that into a voltage because I know the current must come out here, I know this current must come out there.
All I have to do is stick a resistor in there. If I stick a resistor in there what is vO equal to? vO is simply iR, right? That's right. vO, I get i here, so i pumps through here. Remember, what comes in here must get reflected up because the current going in here is zero.
All the i must come out here. So, that i must pump through this resistor. The drop across this resistor is iR. That's the voltage drop across that resistor. And since this at a virtual ground the output here is simply zero minus this drop which is minus iR.
So, I have gotten to where I want to be. I have my current i being converted to a voltage. I have taken my current, and I have been able to convert that into a voltage by sticking a resistor in here.
As a final step, I simply need to produce the current. And that is pretty easy to do. Abstractly what I need to do, again, this is design here so we will talk about abstract stuff. If I had a voltage vI, I need to produce a current which relates to C dvI/dt.
And I know I can do that by simply doing this. By doing this I know my i is C dvI, correct? If I can get this effect, I put this in quotes because that's my pattern. I am looking for a pattern, where a voltage vI is directly applied across a capacitor.
And when that happens the current relates to C dv/dt. Let's go back to our op amp pattern here, op amp circuit. So far I have achieved -- I just repeated this out there. And so somehow I need to take this pattern here and learn from that pattern and apply the pattern here.
So, what I can do is, this is a ground node, correct? Now, the poor little capacitor, what does it care, whether it's a ground node or a virtual ground node? As long as it's a zero volt node down here what does it care? What I am going to do is stick this point, not here but into a virtual ground node.
I am going to grab that point, take it here and stick it here. The poor little capacitor doesn't know the difference. I have really suckered the little beast. This is vI. Remember this. My i through the capacitor is proportional to C dv/dt.
Instead what I have done is taken this guy and stuck it here to get something like this. Just remember these four or five little tricks. And you apply them in op amp circuits again and again and again and again.
So, this is vI, this is my virtual ground. As far as this poor little capacitor is concerned, it is chugging along merrily thinking that it is connected to ground. Little does it know it is only a virtual ground, all right? But the current i here is simply C dvI/dt.
And that current, the C dvI/dt, that current flows through here and gives me vO as iR. So, vO is simply minus R. Let me substitute for i there, C dvI/dt. OK, so notice then that my vO is now proportional to dvI/dt.
So, vO is some RC time constant times dvI/dt. Therefore, I have my differentiator circuit. Remember this as a closing thought. Remember this v plus more or less equal to v minus trick. And to the extent possible simply use that trick to analyze op amp circuits under feedback and not in saturation.
Just remember these two. Very quickly for the demo, I have a square wave input here to the op amp, that's my vI to the integrator. And this is the output vO. The integral of a square wave is a triangular wave, as you can see.
And we will do the same thing for a differentiator. And for the differentiator, I input the square wave to this differentiator circuit. And I get this, wherever there is a sharp rise, I get this huge negative spike and a positive spike because of the minus sign.
So, this is the differentiator circuit. Then I feed this into the op amp. OK. Thank you.