How does an op amp work? How do I use an op amp

These are questions that I have asked at two periods in my life. The first time was in my introductory circuits class and around that time I really didn’t care (beer was a priority). The second time was when I dove headfirst back into analog electronics for my new job and had to re-teach myself a lot of things. I really appreciate the opportunity I had to re-learn everything because the second time around, I think I got it right.

OK, so let’s start simple. What is an op amp? Whoa, loaded question. For our purposes here (and just for now), let’s say it’s just a symbol.

Figure 1: Just a symbol folks, nothing to see here

To keep things basic, the A & B points are the input, the C point is the output.This symbol is an IDEAL op-amp, meaning it is impossible to construct one and really the expectations for the op amp are unrealistic. But this is the internet and we can do what we want on the internet, so we’ll just use the IDEAL op-amp for now.

Figure 2: Inverting Ideal Op-amp
Figure 2: Inverting Ideal Op-amp

OK, so now you know what the symbol is, but what does it mean? Well, the idea is you put two electrical signals into the inputs then the output changes accordingly. It takes the difference between the inputs and amplifies it, hence operational amplifier, or op amp. You may have noticed that input A has a minus symbol and input B has a plus symbol. So let’s say that the input to the minus, or INVERTING, input is 1 (for simplicity’s sake…this site is about analog so that value could be ANYWHERE from 0 to 1 or higher! Just thought I’d mention that). The input to the plus, or NON-INVERTING, input is 0. Now the op-amp is in an unbalanced state. The device is designed so that when this happens, the output goes as negative as it can. For the ideal case, we say this is negative infinity, but that’s not really possible. More on that later.

Figure 3: Non-inverting Ideal Op-amp
Figure 3: Non-inverting Ideal Op-amp

Conversely, in figure 3, if we put a one on the non-inverting and a zero on the inverting input, the op amp output would go high, infinity for our purposes here. The important thing to know is this:

The op-amp always “wants” both inputs (inverting and non-inverting) to be the same value. If they are not, the same value, the op amp output will go positive or negative, depending on which input is higher than the other.
(Throughout this article I will continue to anthropomorphize op amps…best to get used to it now)

Alright, so how do we use this in circuits? If we wanted to find out if two signals were different, we could tie the signals to the inputs of the op amp, but then the output would go to infinity. This would not do us any good. The answer to this and many other questions in the universe is feedback. We are going to take the output and tie it back to the inverting input. Now the circuit looks like this:

Figure 4: A buffer
Figure 4: A buffer

First, we assume that the circuit has all points start at zero (point A being the most important). Next, we put a value of 1 (like the picture in figure 2) at the “B” non-inverting input. “WHOA,” says the op amp, “THIS AIN’T RIGHT!” So now the op amp puts its output to as high as it can, as fast as it can. This feeds back from the output (“C”) to the inverting input (“A”). So as the output moves closer to 1, the op amp is happier and backs off the output. When the input at A is the same as at B, the op amp is happy and stays there (but maintains the output of 1). The key here is that the op amp moves as fast as possible to get both inputs to be the same.

Why would someone use a buffer? Well that brings us to the next point about op amps, specifically ideal op amps:

Ideal op amps have infinite impedance (resistance) at their inputs. This means that no current will flow into the op amp.

A common use for a buffer is to supply current to another stage of a design, where the buffer acts as a gateway. So when the buffer “sees” a voltage at the input (“B”), it will output the voltage at “C”, but will also drive that voltage with current (as much as you want for an ideal op amp). This would be useful if you have a weak signal at the input, but want to let some other part of a circuit know about it. Perhaps you have a small sensor that is outputting a small voltage, but then you want to send the voltage over a long wire. The resistance in the wire will probably consume any current the sensor is outputting, so if you put that signal through a buffer, the buffer will supply the necessary current to get the signal to its destination (the other end of the wire).

What if the signal coming from the sensor is too small though? What if we want to make it bigger? This is when we turn the op amp into an amplifier, using resistors. One of the more common ways of doing so is using the inverting input, shown below:

Figure 5: Inverting op-amp
Figure 5: Inverting op-amp

Let’s go over what we know about this circuit. We know that the op amp wants both inputs to be the same. We also know that the non-inverting input is zero (because it’s connected to ground) and so the op amp will want the inverting input to be equal to zero (sometimes known as a “virtual ground”).Ā  In fact, since the op amp has feedback through the top resistor (squiggly line if you didn’t know), then the (ideal) op amp will output just about any current and voltage in order to get the inverting input to be equal to zero.

So now our situation. A dashing young engineer hooks up a voltage source to the point “IN” set to 1 volt. This creates a voltage at the inverting input. “WHOA” says the op amp, and then it begins to output a voltage to make the inverting input point equal to zero. Since the input is 1 volt the op amp decides it better do the opposite in order to make the inverting input match the non-inverting input of zero. As fast as it can (infinitely fast for an ideal op amp), it outputs -1 volt. The inputs are both zero and everything is right in the op amp’s world. What about current though? We remember that current cannot flow into the op amp at the inverting input, so any current will be flowing through both resistors. If we have 1 volt at the input and a 1 ohm resistor at the input, then we will have 1 amp of current flowing (according to Ohm’s law V=IR). So when the op amp outputs -1 volt across the top resistor, there is a -1 amp going through it (assuming it is a 1 ohm resistor). The currents cancel each other out at the inverting input and the voltage then equals zero. The place where the currents meet is sometimes called the “summing node”. This is a useful representation when dealing with currents as opposed to voltages.

For the last part of this thought exercise, let’s look at a situation where the resistors at the input and at the top of the circuit are not the same. Similarly to above, the same dashing young engineer puts 1 volt at the “In” node. The resistor is still 1 ohm, so there is 1 A of current flowing through to the summing node. The op amp once again sees this 1 volt and once again says “WHOA, I’m unhappy about this” and starts outputting the highest voltage it can. However, in this situation, the top resistor is now 4 ohms. In order to create the -1 amp that is required to cancel the 1 amp going through the input resistor, the op amp must output -4 volts (remember V=IR).Ā  We see that for an inverting op amp configuration, the ratio of the resistance of the top resistor to the bottom resistor determines the gain, or a multiplication factor from the input to the output. Also notice that the output is negative for a positive input, confirming that this is an inverting amplifier.

That’s the basics of it. Check back here for more about op amps, because there is a lot more to be said. Future posts might include other op amp configurations, design considerations and even the dreaded “REAL WORLD”, where the ideal op amp no longer exist.

[xyz_lbx_default_code]

How does an op amp work? How do I use an op amp? — Part 1
Tagged on:                     

80 thoughts on “How does an op amp work? How do I use an op amp? — Part 1

  • August 2, 2008 at 11:45 pm
    Permalink

    So why does it have to be a dashing young engineer? Couldn’t it be an old, grumpy engineer or a ravishing goddess?

    BTW, I didn’t realize you work for Keithley. You rock. šŸ™‚

    • November 1, 2013 at 8:14 am
      Permalink

      cool

  • August 6, 2008 at 9:20 am
    Permalink

    Just a quick question about the inverting and non-inverting inputs of an op amp…
    In the buffer example if the + and – were swapped (ie out connected to + and B connected to -) would it perform exactly the same?
    The same goes for inverting and non-inverting amplifier circuits.

    In every example ever, the are always connected in the above way. I guess that might just be convention, but it should still function exactly the same if + and – are switched around right…?

    • September 30, 2013 at 11:44 pm
      Permalink

      No it wouldn’t. In that case the output would saturate.

  • August 6, 2008 at 11:23 am
    Permalink

    Hey John,

    That’s a great question. I guess I should have been a little more clear on the idea of feedback. There are two types of feedback, positive and negative. Negative feedback will help to control systems, while positive feedback will often put systems out of balance (think Jimi Hendrix wailing on his guitar…that’s the amplifier positively feeding back to his guitar pickups). In the situation of the buffer explained above, it is negative feedback (see http://en.wikipedia.org/wiki/Negative_feedback).

    Think about it like this. In figure 4, you see the input to the buffer is the positive (non-inverting input) and the feedback is the inverting input. Say those are switched. Now you put 1 volt on the input (inverting). The op amp will want to output -1. This will then feed back to the non-inverting input and the op amp will see a 2 volt difference between the inputs (1 at the inverting minus a -1 at the non-inverting). The op amp wants to see no difference so it “pushes” even harder. Eventually this situation will spin out of control and the op amp will be outputting minus infinity (for an ideal op amp).

    The connections definitely matter and I will try to discuss that further in future posts.

    Hope that helps!

    ~Chris

  • Pingback: Replacing capacitors on my Wurlitzer 200A electric piano | Chris Gammell's Analog Life

  • Pingback: How an op amp works -- Part 2 | Chris Gammell's Analog Life

  • August 13, 2008 at 5:42 am
    Permalink

    I want the difference between +ve & -ve feedback of op-amp.

    • November 16, 2012 at 9:47 pm
      Permalink

      i dont understand your question…isn’t the difference going to be what ever your input voltage is….as in what ever your voltage source is?

  • August 13, 2008 at 8:34 am
    Permalink

    Well I always wanted others to do my homework when I Googled on the subject too, but it didn’t always work out :-). Check my contact page and shoot me an email if you still can’t figure out your problem.

  • Pingback: Stealing stars and leaving the Barons in the dust | Chris Gammell's Analog Life

  • Pingback: A quarter century retrospective | Chris Gammell's Analog Life

  • Pingback: To break or not to break | Chris Gammell's Analog Life

  • October 1, 2008 at 9:16 am
    Permalink

    Thanks for explaining op-amps, I have a question on how the op-amp creates the voltage and current needed to amplify the input? Is it from the DC voltage that powers the op-amp?

    Thanks,
    Mike

  • October 1, 2008 at 9:28 am
    Permalink

    If I only went to your 2nd part of your tutorial before I asked question about the power needed..

    Mike

  • Pingback: Standing up while working | Chris Gammell's Analog Life

  • Pingback: How to get a job as a new electrical engineer grad | Chris Gammell's Analog Life

  • October 14, 2008 at 4:47 am
    Permalink

    Thank you Dan, I fixed it in the text. Good catch (and interesting metaphor)!

    • December 11, 2011 at 10:10 am
      Permalink

      hi chris , I want to ask you something , I have designed an Op Amp circuit using LM741, i need to write a report for my tutor about what if you implement the circuit in real life , what would happen ?

      THanks alot

  • October 14, 2008 at 8:24 am
    Permalink

    In the text under figure 4, you state:

    This feeds back from the output (ā€Cā€) to the non-inverting input (ā€Aā€).

    I think input A is the inverting input on that figure.

    Just trying to clarify in case someone comes along & is confused when the carpet doesn’t match the drapes.

    • July 15, 2010 at 7:23 pm
      Permalink

      what is the meaning of inverting and non-inverting input?

  • October 26, 2008 at 12:22 am
    Permalink

    Nice! I’m studying for an exam paper which is all about op amps etc. and i find it so difficult to understand (so does everyone in my class), but after reading this, i finally get the basics of an op amp! The rest of this paper is starting to make sense now! lol. Thank heaps Chris! Great site!

  • January 19, 2009 at 10:31 pm
    Permalink

    Hi I am a new engineer working in a Japanese electronics company. I am glad I found your site. It is really insightful šŸ™‚

  • Pingback: Switching Regulators and Switching Noise | Chris Gammell's Analog Life

  • Pingback: When to Try Something vs When to Study Something | Chris Gammell's Analog Life

  • August 27, 2009 at 5:40 pm
    Permalink

    Good stuff – I work in the power field of EE and am constantly amazed at how much non-power information I have forgotten!

  • November 24, 2009 at 9:30 am
    Permalink

    Thanks mike! You have no idea how much this meant to me when I’m doing my panic revision =) All the best!

  • Pingback: Spec Sheet Dive: An Intro | Electricio.us

  • February 20, 2010 at 12:11 am
    Permalink

    i think that we r not cleare understanding yet now about op-amp working

  • March 20, 2010 at 11:25 am
    Permalink

    thank you for explaining about negative feedback

  • Pingback: On The Importance of Prototyping | Chris Gammell's Analog Life

  • May 29, 2010 at 9:41 am
    Permalink

    HELLO rockers!!!!!!its jst d superb way of practical kind of explanation CHRIS…i m jst passsed out & belive me never did i got op-amo so well…tht made me hate ANALOG…….

  • Pingback: Where Are All The (Electrical) Engineer Sites? | Chris Gammell's Analog Life

  • Pingback: Part Review: LM741 | Chris Gammell's Analog Life

  • July 22, 2010 at 12:21 pm
    Permalink

    this has fried my brain yes… now i gotta ask in my logic and using fig4 when input b is 1 and input a is 0 then the op amp makes its output infinity. now that makes input a to go infinite which is bigger than 1 volt causing the op amps output to go to negative infinity and so on… does it quickly level out because i have no idea how this works. you see the book im reading is for brains that dont seek full explenations

  • Pingback: Part Review: LT4180 | Chris Gammell's Analog Life

  • October 22, 2010 at 2:57 pm
    Permalink

    can I use opamp741 instead of 333171?

  • Pingback: What Is A Power Budget? | Chris Gammell's Analog Life

  • November 14, 2010 at 9:17 am
    Permalink

    i agree but not satisfid with u and ur all question

    why amphlipher shift phase by 180 degree anglee

  • December 7, 2010 at 2:40 pm
    Permalink

    Thanks for this explanation. was searching for this type of explanation on op-amps from 5 days. and finally your site gave me goose bumps. am so damn happy šŸ™‚ šŸ™‚ U ROCK
    one more request, would be happy if you could post about input and output impedance.and how they are necessary, and how are they found in different configurations of transistors.
    thanx again

  • December 17, 2010 at 3:55 am
    Permalink

    Why inverting mode of operation in OPAMPs is mostly used in circuit design?

  • January 21, 2011 at 5:34 pm
    Permalink

    OOMIGOSH! Not the dreaded “REAL WORLD”! Please No….PLEASE!!!!!

  • February 22, 2011 at 6:23 pm
    Permalink

    thanx man

  • February 22, 2011 at 6:27 pm
    Permalink

    can you explain something about lcd programing on MC?????

  • Pingback: The Role Of Vendors | Engineer Blogs

  • Pingback: understanding operational amplifier

  • Pingback: Weekend Journal: A New Way To Consume Engineering Information | Engineer Blogs

  • April 4, 2012 at 8:42 pm
    Permalink

    can you please tell me.what is the use of op-amp in low pass and high pass filter if the combination of RC perform the filtering action?

  • April 13, 2012 at 4:50 am
    Permalink

    thank you ,,,what of application of op amp

  • June 22, 2012 at 10:10 am
    Permalink

    Finally some clear explanation. YouTube vids wasn't helping me at all with their boring voices šŸ˜€ This was much better

  • January 19, 2013 at 8:38 am
    Permalink

    Hi Chris! Thank you a bunch for this article, it has helped me get a much better understanding of the ideal op amp.. I know the ideal op amp is a fictional thing, but you need to crawl before you can walk šŸ™‚

  • March 24, 2013 at 11:31 am
    Permalink

    Hey there Chris,

    I was reading your article and I was wondering why does the following happen: “So when the op amp outputs -1 volt across the top resistor, there is a -1 amp going through it (assuming it is a 1 ohm resistor). ” how does the op amp produce an output of -1 volts ?

    And what did you mean by the non inverting input of the op-amp cannot have any current flowing in the flowing: “We remember that current cannot flow into the op amp at the inverting input, so any current will be flowing through both resistors. ”

    Thank you ,
    Rasna

  • March 26, 2013 at 1:44 pm
    Permalink

    WHAT DO THE STATEMENT (HIGH OPEN LOOP GAIN ACTUALLY MEAN

  • April 4, 2013 at 9:53 am
    Permalink

    I’m a little new to some of these electronic components and I never understood Op-Amps until now. Basically what I got from this article is that it takes two current sources at the two pins and gives off one current source at the third pin and the third current source is the difference between the first two. Am I understanding it correctly?

  • May 6, 2013 at 6:52 pm
    Permalink

    Great post! It’s currently helping me understand the class I’m taking.

  • May 15, 2013 at 4:34 am
    Permalink

    Great Intro text.
    I’d like to thank you (being Greek) for the “anthropomorphize” word you used, although “a dashing YOUNG engineer”. Keep up the good work.

    Nikos

  • June 13, 2013 at 10:00 am
    Permalink

    What makes an op-amp amplify? How does it achieve the gain of 10 exp5? Is it from power considerations meaning that the output current diminishes 10 exp 5 times?

  • July 17, 2013 at 11:52 am
    Permalink

    hey chris, this is really awesome way of explaining…. its been more than 1 year, i couldn’t find the exact working of opamps but u made it much much easier… thanx alot. is there any other things regarding these devices u’ve xplained over here. plz just let me know i’m curious to see them all.

  • October 21, 2013 at 10:48 am
    Permalink

    Great! thanks for the wonderful explanation šŸ™‚

  • November 15, 2013 at 7:41 am
    Permalink

    Thanks dude!!! helps a lot!

  • November 20, 2013 at 4:02 am
    Permalink

    Thats a concept well explained. Thanks!

  • Pingback: what is amplifier | erenokur

  • Pingback: On Education | Chris Gammell's Analog Life

  • January 11, 2014 at 4:02 pm
    Permalink

    This is one of the best explanations of basic op amp theory I have read. Thank you. I am beginning to get it.

  • April 6, 2014 at 7:06 pm
    Permalink

    Really an clear and thorough explanation, you should open the next Khan Academy!

  • May 18, 2014 at 2:47 pm
    Permalink

    what if the opamp does not have resistor?
    only capacitor and transistor
    how to calculate the gain?

  • July 1, 2014 at 4:33 pm
    Permalink

    Thank you, doing homework for my son! I am point him to your website. Very clear.

  • August 14, 2014 at 2:09 am
    Permalink

    And to think that I came here to copy everything so as to please my lecturer.Thanks a lot man,I finally got to understand this,and please my lecturer at the same time šŸ™‚

  • October 13, 2014 at 2:00 am
    Permalink

    What are advantages of Non-Inverting Amplifier?

  • October 13, 2014 at 10:04 am
    Permalink

    I bow before you. Thank you so much

  • February 4, 2015 at 1:27 am
    Permalink

    Really usefull post.I need part 3 and part 4.Where i can get it?

  • May 31, 2015 at 9:17 pm
    Permalink

    Thanks for this tutorial – this made op-amps much easier to understand than when I looked at different sources.

  • June 25, 2015 at 10:56 am
    Permalink

    I’m a fan of the reaction that the opamps have to the voltage. I feel that I’m going to be very disappointed someday when I get a chance to just fiddle around with them and it’s silent.

  • September 1, 2015 at 6:01 pm
    Permalink

    Finally an explanation that makes sense

  • February 6, 2016 at 9:39 pm
    Permalink

    You should teach because this tutorial is excellent.

  • March 27, 2016 at 1:25 am
    Permalink

    Thanks Chris. A great article written with a sense of humor. Enjoyed it.

  • April 27, 2016 at 12:05 am
    Permalink

    hi there,
    there were good points here that were really usful. certainly the “buffer” section.
    thanks a lot,
    ome

  • August 11, 2016 at 9:43 pm
    Permalink

    I don’t know if it’s the 4 weeks I already spent studying opamps but you’re explanation is great! Highly recommended for anyone trying to understand opamps!

  • August 29, 2016 at 6:33 am
    Permalink

    Thanks for the article but it is very complicated to read for a noob!

  • September 28, 2016 at 10:20 am
    Permalink

    Why we go for opamp if we have transistor

Comments are closed.