Learn

The non-inverting amplifier: gain from two resistors

Sign up freeor see every lesson
  • 192parts on the bench
  • 25boards running now
  • 1.00xreal time, on every board
Non-inverting amplifierlive0.000 s 0.00x
Click to open it in the editor
A 1 kHz sine into a gain-of-3 op-amp: Rf = 20 k, Rg = 10 k. Open the Scope tab to compare in and out.

Give an op-amp negative feedback, a path from its output back to its inverting input, and its enormous gain stops being a problem and starts being a tool. The op-amp drives its output to whatever voltage makes the two inputs equal. If the inverting input only sees a fraction of the output, the output has to be larger than the input by the inverse of that fraction. That is a non-inverting amplifier, and its gain is set by two resistors and nothing else.

In the circuit above, the signal generator puts a 1 kHz sine on IN+, 0.5 V either side of 0.8 V. The output goes back to IN- through Rf, 20 k, and IN- goes to ground through Rg, 10 k. The scope shows the input on channel 1 and the output on channel 2.

Press Run and open the Scope tab. The output is the same sine, the right way up, three times as tall: 0.9 V to 3.9 V.

Where the gain of 3 comes from

Two rules are enough to analyze almost any op-amp circuit with negative feedback. The inputs draw no current. And the output does whatever it takes to make the two inputs the same voltage.

Rf and Rg are a voltage divider from the output to ground, and IN- sits at the middle of it: Vout x Rg / (Rf + Rg), which is Vout / 3 here. The op-amp makes that equal to IN+, so Vout / 3 = Vin, and Vout = 3 x Vin. In general the gain is (Rf + Rg) / Rg, which is usually written 1 + Rf / Rg. With the input at 0.3 V the output is 0.9 V, and with it at 1.3 V the output is 3.9 V; the engine gives 0.901 V and 3.899 V.

The gain is never less than one. With Rf shorted out, or Rg left off, the output simply follows the input: a buffer, which is how you take a voltage from something that cannot supply any current, like the RC filter on the PWM page, and give it to something that needs some.

Turn it up until it clips

Open the circuit in the editor and set the generator’s amplitude to 1 V, so the input swings from -0.2 V to 1.8 V. Three times that wants the output to go from -0.6 V to 5.4 V. The op-amp runs from a single 5 V supply, so it cannot go below 0 V or above 5 V, and on the scope the tops and bottoms of the blue trace are sliced flat, at 0 V and at 4.98 V. That flattening is clipping, and in audio it is the harsh sound of an amplifier pushed too far.

This is why the input sits on an offset of 0.8 V. On a single supply the output can only swing between the rails, so an amplifier for a signal that goes positive and negative has to be biased to the middle, or given a negative supply. The op-amp’s negative property in the properties panel gives it one, and with it set to 5 the output can swing down to -5 V.

The inverting amplifier, for comparison

Put the signal into IN- through a resistor instead, with IN+ held at a fixed voltage, and you have an inverting amplifier: gain -Rf / Rin, upside down, and able to have a gain below one. The gallery’s op-amp low pass is one of those, with a gain of 10 and a capacitor across Rf that makes the gain fall away above 2 kHz. It shows the single-supply trick too, with IN+ held at half the rail.

What a real op-amp adds

A real op-amp differs from the ideal one in ways worth knowing before you build, and Mokxi’s op-amp models the three that matter most here. Its gain falls with frequency, and the gain-bandwidth product on its datasheet is the limit: a 741 at 1 MHz can give a gain of 3 up to about 330 kHz and no further. Many cannot swing to their rails, so on 5 V a 741 only reaches 1.5 V to 3.5 V. And a few millivolts of input offset get multiplied by the gain along with the signal. Set the op-amp’s model to 741 and its offset to 5 mV and watch all three.

Common mistakes

Swapping Rf and Rg, which gives a gain of 1.5 instead of 3. Connecting the feedback to IN+, which turns the amplifier into a latch that sits at one rail. Forgetting the bias on a single supply and wondering why half of every wave has vanished. And resistor values that are too small, which load the output, or too large, which pick up noise and let the op-amp’s input currents matter; 1 k to 100 k is the comfortable range.

Questions

What is the gain of a non-inverting amplifier?

1 + Rf / Rg, where Rf goes from the output to the inverting input and Rg from the inverting input to ground. 20 k and 10 k give a gain of 3. It can never be less than 1.

Why is my op-amp output clipping?

Because the gain times the input asks for more than the supply can give. On a single 5 V supply the output cannot go below 0 V or above 5 V, and many op-amps stop a volt or more short of each rail. Reduce the gain or the input, or bias the input to the middle of the supply.

What is the difference between inverting and non-inverting amplifiers?

A non-inverting amplifier takes the signal on IN+, keeps it the right way up, has a gain of 1 + Rf / Rg and draws no current from the source. An inverting one takes the signal through a resistor into IN-, turns it upside down, has a gain of -Rf / Rin, and loads the source with Rin.

Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.