Opampomancy: Feedback Networks and the Non-Inverting Amplifier

Cross-posted from my blog.

The purpose of this post is to lay out some of the stuff I wish someone had explained to me when I was first learning about electronics. This is a pretty entry-level introduction, intended by me to ‘fill in the gaps’ with regard to basic operating principles. Opamps are not all that complicated, but for many people they appear as a black box. With so many schematics available online, it can be very tempting to simply ‘cut-and-paste’ subcircuits into your own designs without understanding them. This is okay to a point, and useful for learning, but it may come back to bite you later if your design doesn’t work the way you expect it to.

While this is entry level in terms of concept, there is some significant algebra going on here. I’ve tried to explain each step as I go along, but it does assume you have a basic knowledge of algebra. Unfortunately, there’s really no way around it.

First, let’s look at the schematic symbol for an op-amp and identify the pins and their functions.

V+ is the positive supply and V- is the negative supply. Often these will be omitted in diagrams, especially if the opamp is part of a dual or quad package. For most schematics, it is implied that the opamp is connected to such supply rails.

Vin+ is the non-inverting input. Because of the plus sign, you may be tempted to call this the positive input, but that would be something of a misnomer because the signal voltage applied to it can positive or negative with respect to ground.

Vin- is the inverting input. Again, the signal voltage applied here can be positive or negative with respect to ground.

Vout is the voltage output.

There are two concepts which are typically used to describe how opamps function. The first is: the voltage output of the opamp is the voltage difference between the two inputs multiplied by the gain of the device. The gain of the device is often denoted as A, and refers to the open-loop gain of the amp. Further, the voltage difference refers to the difference between the voltage at the non-inverting input (Vin+) and the voltage at the inverting input (Vin-). In other words:

[latex]\begin{equation}V_o = A \cdot (V_{in+} – V_{in-})\end{equation}[/latex]

This voltage difference can be considered the input to the opamp. The order of terms in the above subtraction is where the inputs get their names. To explain, let’s assume that the voltage at Vin+ is X, and the voltage at Vin- is 0 (ground). Thus, Vin would be X – 0, which is just X. However, if Vin+ = 0 and Vin- = X, the input voltage would be -X (negative X), thus its sign would be inverted, hence the term inverting input. This sign inversion would hold true regardless of whether X itself was a positive or negative value (with respect to ground).

So now that we’ve dealt with the Vin terms, let’s talk about A. A, as mentioned above, is the open-loop gain of the opampit is typically very large, on the order or 10,000 or more. This huge gain factor makes an open-loop opamp pretty useless for most applications. There are very few occasions where you would need to multiply a signal 10,000+ times, and even then it would be unwise to do so using an open-loop opamp. The reason is that even though A can be regarded as quite large, it’s very difficult to control exactly how large it will be. This is due to a number of factors, but mostly it’s due to manufacturing variances. The gain of the opamp is directly related to the gains of the individual transistors which make it up. Transistor gain can be difficult to control, particularly in large numbers. While it is possible to create very precise transistors, and thus pretty precise opamps, it’s not at all cheap. Further, it’s completely unnecessary, as we will soon see.

It’s much better to approach opamp design from a different angle. Rather than create a device which has a large but precise gain factor, it’s better to create one with a theoretically infinite gain and provide some other constraint which can be used to control it. This brings us to the second big concept for opamp functionality:

“An opamp tries to keep the voltage across its two inputs at zero.”

In fact this is the fundamental operating principle of all opamps, but when I was first learning about active devices, I always found this statement to be very confusing. The problem is that very few sources go on to explain why this is so. It seems a little counter-intuitive. Amplifiers aren’t supposed to make things smaller (or zero), they’re supposed to make them bigger, so why is the opamp trying to mitigate it’s own inputs, and how the heck does it do that?

I’ll answer the second question first. The how is with a feedback network. The original statement would be more complete if it read:

“An opamp tries to keep the voltage across its two inputs zero by using a feedback network to control one of the inputs with the output.

The construction of the feedback network will determine the extent to which the opamp has to swing the output one direction or another, so that one of the inputs is equal to the other input. The easiest way to explain this is by looking at a simple circuit — the non-inverting amplifier:

In the non-inverting amplifier, the input voltage is applied to the non-inverting (+) input of the amp. The output of the amp is connected, via a feedback resistor, to the inverting (-) input. There are two resistors here which make up the feedback network. The first is the aforementioned feedback resistor (R_feedback or R_f), and the second is a resistor from the inverting input to ground, called R_ground or simply R_g. Let’s ignore the non-inverting input for now and just look at the feedback network — it forms what is known as a voltage divider. Below is an example of a simple voltage divider circuit.

A voltage divider is so named because it provides a fraction of the input voltage as its output. The simplest voltage divider is made with two resistors, R1 and R2. In the figure above, the output voltage (Vout) is equal to the input voltage (Vin) times the ratio of the lower resistance, R2, to the total resistance, R1+R2. The lower point of R2 is tied to ground.

[latex]

\begin{equation}

V_o = V_{in} \cdot \frac{R_2}{R_1+R_2}

\end{equation}

[/latex]

The nice thing about the voltage divider is that it has lots of applications, one of which is in our non-inverting amplifier feedback network. In that case, the input to the voltage divider would be the output of the opamp, and the inverting input of the opamp is the output of the voltage divider. Seems very confusing, I know. Perhaps a diagram will help.

The formula for the voltage divider still applies, and we can substitute the terms from the non-inverting amplifier from above:

[latex]

\begin{equation}

V_{in-} = V_o \cdot \frac{R_g}{R_f+R_g}

\end{equation}

[/latex]

To make things a little clearer, let’s replace the resistor fraction with something less cluttered — the greek letter Beta:

[latex]

\begin{equation}

\beta = \frac{R_g}{R_f+R_g}

\end{equation}

[/latex]

–thus–

[latex]

\begin{equation}

V_{in-} = V_o \cdot \beta

\end{equation}

[/latex]

Ok, now we need to relate this equation to the whole circuit, so that we can come up with the transfer function for the non-inverting amplifier. A transfer function is an equation that describes the output in terms of the input. It’s usually written as follows:

[latex]

\begin{equation}

\frac{output}{input} = transfer function

\end{equation}

[/latex]

In other words, it’s a function that describes the ratio of the output to the input. This is an easy form to understand and use, because to find the value of the output, all we need to do is multiply the transfer function by the input value. Remember that the input to the whole circuit is at the non-inverting input, so we are going to need to include that in our function as well.

NOTE: From this point on, it’s mostly just a lot of algebra — moving terms around between both sides of the equation until we get a nice Vout/Vin transfer function. If you’re thinking of studying electrical engineering, you should know that this stuff is critical. Being able to do algebra like this quickly is something you should make an effort to get really good at, because you will use it all the time. There aren’t really any shortcuts here — you just have to do it.

One of the problems when you’re studying this stuff is that textbook authors tend to ‘skip steps’ when reducing or reconfiguring equations, because they assume some intermediate steps are self-evident. Sometimes they are, particularly if you have a lot of experience working equations, but for n00bs (or sleepy college students), they are not. As such, I’m going to try to show each and every step, and explain what I’m doing, so you can understand it.

Getting back to the problem at hand, we need to create a transfer function for our opamp+feedback network. In order to do that, we will take equation (5) and substitute it into equation (1), replacing Vin- with the voltage divider equation. Doing that, we get:

[latex]

\begin{equation}

V_o = A \cdot \left(V_{in+} – V_o \cdot \beta\right)

\end{equation}

[/latex]

–or–

[latex]

\begin{equation}

V_o = A \cdot V_{in+} – A \cdot V_o \cdot \beta

\end{equation}

[/latex]

The next step is to get both Vo terms over on the same side of the equation, so let’s do it:

[latex]

\begin{equation}

V_o + A \cdot V_o \cdot \beta = A \cdot V_{in+}

\end{equation}

[/latex]

Now we extract the Vo term as a common coefficient of both terms on the left.

[latex]

\begin{equation}

V_o \cdot \left(1 + A \cdot \beta\right) = A \cdot V_{in+}

\end{equation}

[/latex]

Our original mission, of course, was to find the transfer function of Vo/Vin. Vin, in this case, is Vin+, so we want to find Vo/Vin+, so we divide both sides by Vo.

[latex]

\begin{equation}

1 + A \cdot \beta = \frac {(A \cdot V_{in+})}{V_o}

\end{equation}

[/latex]

Now we’ll divide both sides by A:

[latex]

\begin{equation}

\frac{\left(1 + A \cdot \beta\right)}{A} = \frac {V_{in+}}{V_o}

\end{equation}

[/latex]

which becomes:

[latex]

\begin{equation}

\frac{1}{A} + \frac{A \cdot \beta}{A} = \frac {V_{in+}}{V_o}

\end{equation}

[/latex]

Here we can use a little trick to simplify things. Recall that A is very large — theoretically infinite. As such, 1/A is very small, theoretically zero. We can use this to our advantage, because it means we can get rid of the 1/A term by equating it to zero. Further, looking at the second term on the left, the A in the numerator and the denominator cancel out, so we can get rid of them too.

[latex]

\begin{equation}

0 + \frac{A \cdot \beta}{A} = \beta = \frac {V_{in+}}{V_o}

\end{equation}

[/latex]

Oh snap! Look how much simpler that is! Now we can substitute back the resistor fraction for Beta:

[latex]

\begin{equation}

\frac{R_g}{R_f+R_g} = \frac {V_{in+}}{V_o}

\end{equation}

[/latex]

and we invert both sides to get the Vout/Vin form we’re aiming for:

[latex]

\begin{equation}

\frac {V_o}{V_{in+}} = \frac{R_f+R_g}{R_g}

\end{equation}

[/latex]

Rg/Rg = 1, so:

[latex]

\begin{equation}

\frac {V_o}{V_{in+}} = \frac{R_f}{R_g} + 1

\end{equation}

[/latex]

To figure out Vo in terms of Vin, we simply multiply:

[latex]

\begin{equation}

{V_o} = V_{in+} \cdot (\frac{R_f}{R_g} + 1)

\end{equation}

[/latex]

And that’s the equation of a non-inverting amplifier. Now that we know where that formula comes from and how it’s derived, it’s a little easier to understand the concept of a feedback network. In order to create a voltage at Vin- which is equal to the voltage at Vin+, the opamp has to produce an output voltage  which, when attenuated by the Rf/Rg divider, is equal to Vin+. So, if the voltage divider is set up to output 50% of its input, the opamp has to produce a voltage twice as large as the voltage at Vin+ in order to mitigate it. As such, it is indeed acting as an amplifier with a gain of 2. Likewise, other voltage divider values would produce different gains, as expressed in equation 18.

So now that you know how it works, you should build a couple circuits to try it out. Happy amplifying!

About the equations: the equations here are rendered as alpha-channel PNGs with the WP QuickLaTeX plugin. This is a great plugin which renders LaTeX beautifully and even provides equation numbers. If you want something that will allow you to write nice-looking equations on a blog, you should check it out.


Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards

Join Adafruit on Mastodon

Adafruit is on Mastodon, join in! adafruit.com/mastodon

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 36,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


Maker Business — “Packaging” chips in the US

Wearables — Enclosures help fight body humidity in costumes

Electronics — Transformers: More than meets the eye!

Python for Microcontrollers — Python on Microcontrollers Newsletter: Silicon Labs introduces CircuitPython support, and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

Adafruit IoT Monthly — Guardian Robot, Weather-wise Umbrella Stand, and more!

Microsoft MakeCode — MakeCode Thank You!

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — #NewProds 7/19/23 Feat. Adafruit Matrix Portal S3 CircuitPython Powered Internet Display!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



6 Comments

  1. One of the most understandable articles that includes some form of formula I’ve read in a very long time.

    How about something that brings understanding of integrals to the masses.

  2. Thanks, Michael!

    I may do something like that eventually! 🙂

  3. THANK YOU for this! The concept of the op-amp is one of those things that confused me every time I read about it although I believe I had the knowledge to grasp it… just needed it explained step by step like this. Very cool. Basically a component that lets you play choose-your-own-amplifier?

  4. @Eric: pretty much. Another way of saying it (which is common in technical literature) is that the opamp has ‘programmable gain’. That is, you can program the gain by choosing certain resistor values. There are certain limitations in the real world, obviously, but an ideal opamp works exactly as a “choose you own characteristics” device. 🙂

  5. [latex]\begin{equation}V_o = A \cdot (V_{in+} – V_{in-})\end{equation}

    \begin{tikzpicture}
    [+preamble]
    \usepackage{pgfplots}
    \pgfplotsset{compat=newest}
    [/preamble]
    \begin{axis}
    \addplot3[surf,domain=0:360,samples=40] {cos(x)*cos(y)};
    \end{axis}
    \end{tikzpicture}

    [/latex]

  6. After all these years I finally get it! Thanks John.

Sorry, the comment form is closed at this time.