TExcelTAD
Home › Analog Electronics: Diodes, Transistors & Op-Amps › The Ideal Op-Amp: Inverting, Non-Inverting and Follower

The Ideal Op-Amp: Inverting, Non-Inverting and Follower

A load cell gives 10 mV10\ \text{mV}, a microcontroller's ADC wants about 1 V1\ \text{V}, and the gain must be right to 0.1 % on every board, at every temperature. The amplifiers of the transistor sections can give a gain of 100, but that gain depends on β\beta, on gmg_m and therefore on temperature and on the individual part. The operational amplifier solves this with one idea: build an amplifier with an enormous, sloppy gain, then throw most of it away with negative feedback through two resistors. The closed-loop gain then depends only on the resistor ratio. This lesson introduces the op-amp, the ideal model with its two "golden rules", and the three circuits you will use most: the inverting amplifier, the non-inverting amplifier and the voltage follower.

The device and its supplies

An op-amp is a differential amplifier (The Differential Pair) followed by a high-gain stage and an output stage (Output Stages), all on one chip. Its symbol is a triangle with two inputs, the non-inverting input v+v_+ and the inverting input v−v_-, one output, and two supply pins that are often left off schematics:

vout=A0 (v+−v−),VEE<vout<VCCv_\text{out} = A_0 \,(v_+ - v_-), \qquad V_{EE} < v_\text{out} < V_{CC}

A0A_0, the open-loop DC gain, is typically 10510^5 to 10610^6 (100100 to 120 dB120\ \text{dB}). The output can only swing between the supply rails, and usually stops a volt or so short of them. So with ±12 V\pm 12\ \text{V} supplies and A0=105A_0 = 10^5, a difference of only 120 μV120\ \mu\text{V} between the inputs already drives the output to the rail. Used open-loop, an op-amp is a comparator (Comparators and Schmitt Triggers), not a linear amplifier.

Other ideal properties: infinite input resistance (no current flows into either input), zero output resistance, infinite bandwidth. The real limits come later; the point of this lesson is how far the ideal model takes you.

inverting: G = -Rf/R1 = -10 non-inverting: G = 1 + Rf/R1 = 10 - + +12 V -12 V vin R1 10 kOhm Rf 100 kOhm out i virtual ground + - +12 V -12 V vin R1 10 kOhm Rf 90 kOhm out

The golden rules

When the output is connected back to the inverting input through a network (negative feedback), and the output is not clipping, the op-amp does whatever it must to keep its inputs equal:

  1. No current flows into either input.
  2. v+=v−v_+ = v_-: the output adjusts until the input difference is (practically) zero.

Rule 2 is a consequence, not a property: v+−v−=vout/A0v_+ - v_- = v_\text{out}/A_0, which is microvolts when A0A_0 is huge. It holds only while feedback is negative and the output is inside its swing. With positive feedback, or with the output clipped, the inputs are free to differ.

Inverting amplifier

The non-inverting input is grounded, so by rule 2 the inverting input sits at 0 V0\ \text{V}: a virtual ground. The input current is therefore i=vin/R1i = v_\text{in}/R_1, and by rule 1 all of it flows on through RfR_f:

i=vinR1=0−voutRf⇒G=voutvin=−RfR1,Rin=R1i = \frac{v_\text{in}}{R_1} = \frac{0 - v_\text{out}}{R_f} \quad\Rightarrow\quad G = \frac{v_\text{out}}{v_\text{in}} = -\frac{R_f}{R_1}, \qquad R_\text{in} = R_1

The source sees exactly R1R_1, because its far end is held at ground. That makes the input resistance easy to set but also low: a 10 kΩ10\ \text{k}\Omega input loads a high-impedance sensor.

Non-inverting amplifier and follower

The input drives v+v_+ directly; RfR_f and R1R_1 form a divider from the output back to v−v_-. Rule 2 says the divider output equals vinv_\text{in}:

vin=vout R1R1+Rf⇒G=1+RfR1,Rin→∞v_\text{in} = v_\text{out}\,\frac{R_1}{R_1 + R_f} \quad\Rightarrow\quad G = 1 + \frac{R_f}{R_1}, \qquad R_\text{in} \to \infty

With Rf=0R_f = 0 and R1R_1 removed you get the voltage follower, G=1G = 1: no voltage gain, but an input that draws no current and an output that can drive a load. It is the cure for the loaded divider and the loaded RC filter of First-Order Filters.

Finite open-loop gain

Write β=R1/(R1+Rf)\beta = R_1/(R_1 + R_f) for the feedback fraction. Solving the circuits with vout=A0(v+−v−)v_\text{out} = A_0 (v_+ - v_-) instead of rule 2 gives

Gnon-inv=1/β1+1/(A0β),Ginv=−Rf/R11+1/(A0β)G_\text{non-inv} = \frac{1/\beta}{1 + 1/(A_0 \beta)}, \qquad G_\text{inv} = \frac{-R_f/R_1}{1 + 1/(A_0 \beta)}

The relative gain error is about 1/(A0β)1/(A_0\beta). The quantity 1/β=1+Rf/R11/\beta = 1 + R_f/R_1 is the noise gain: it is the non-inverting gain, and for the inverting circuit it is one more than the magnitude of the signal gain. It sets the error, the bandwidth (Gain-Bandwidth and Slew Rate) and the stability of both configurations. Negative feedback also divides the op-amp's own output resistance ror_o by 1+A0β1 + A_0\beta (Negative Feedback).

Worked example

Given: an inverting amplifier with R1=10 kΩR_1 = 10\ \text{k}\Omega, Rf=100 kΩR_f = 100\ \text{k}\Omega, ±12 V\pm 12\ \text{V} supplies, an op-amp with A0=105A_0 = 10^5 and ro=100 Ωr_o = 100\ \Omega; input vin=0.5 Vv_\text{in} = 0.5\ \text{V} DC.

Find: the ideal and real gain, voutv_\text{out}, the voltage at the inverting input and the closed-loop output resistance.

Solve:

Gideal=−100 kΩ10 kΩ=−10,β=10110=0.0909G=−101+11/105=−9.9989,vout=−9.9989⋅0.5 V=−4.9995 Vv−=−voutA0=4.9995 V105=50.0 μVRout=ro1+A0β=100 Ω1+9091=11.0 mΩ\begin{aligned} G_\text{ideal} &= -\frac{100\ \text{k}\Omega}{10\ \text{k}\Omega} = -10, \qquad \beta = \frac{10}{110} = 0.0909 \\ G &= \frac{-10}{1 + 11/10^5} = -9.9989, \qquad v_\text{out} = -9.9989 \cdot 0.5\ \text{V} = -4.9995\ \text{V} \\ v_- &= -\frac{v_\text{out}}{A_0} = \frac{4.9995\ \text{V}}{10^5} = 50.0\ \mu\text{V} \\ R_\text{out} &= \frac{r_o}{1 + A_0\beta} = \frac{100\ \Omega}{1 + 9091} = 11.0\ \text{m}\Omega \end{aligned}

Check: the gain error is 0.011 %0.011\ \%, far below the 1 % tolerance of ordinary resistors, so the resistors set the accuracy, not the op-amp. The "virtual ground" is 50 μV50\ \mu\text{V} above ground: small, not zero. ∣vout∣=5 V\lvert v_\text{out} \rvert = 5\ \text{V} is well inside the ±12 V\pm 12\ \text{V} rails.

In Python: how much open-loop gain is enough?

python · try it yourself
R1, Rf = 10e3, 100e3
beta = R1 / (R1 + Rf)
print("   A0      G_inv     err %    G_noninv(Rf=90k)  err %")
for A0 in [1e2, 1e3, 1e4, 1e5, 1e6]:
    g_inv = -(Rf / R1) / (1 + 1 / (A0 * beta))
    b2 = 10e3 / (10e3 + 90e3)
    g_ni = (1 / b2) / (1 + 1 / (A0 * b2))
    print(f"{A0:7.0e} {g_inv:9.4f} {100*(abs(g_inv) - 10)/10:8.3f}"
          f" {g_ni:12.4f} {100*(g_ni - 10)/10:12.3f}")

A0, ro = 1e5, 100.0
print(f"v- at vin = 0.5 V: {0.5 * 10 / (1 + 1/(A0*beta)) / A0 * 1e6:.1f} uV")
print(f"R_out closed loop: {ro / (1 + A0 * beta) * 1e3:.1f} mOhm")
   A0      G_inv     err %    G_noninv(Rf=90k)  err %
  1e+02   -9.0090   -9.910       9.0909       -9.091
  1e+03   -9.8912   -1.088       9.9010       -0.990
  1e+04   -9.9890   -0.110       9.9900       -0.100
  1e+05   -9.9989   -0.011       9.9990       -0.010
  1e+06   -9.9999   -0.001       9.9999       -0.001
v- at vin = 0.5 V: 50.0 uV
R_out closed loop: 11.0 mOhm

An op-amp with A0=100A_0 = 100 would be useless for a gain of 10 (a 10 % error); at 10510^5 the error has dropped to the 10−410^{-4} level, and every extra factor of ten in A0A_0 buys another decade of accuracy.

Cross-check with SPICE

The deck uses the op-amp macro-model written for this course: a transconductance G1 of 1 mS1\ \text{mS} into 100 MΩ100\ \text{M}\Omega gives A0=105A_0 = 10^5, C1 sets a 10 Hz10\ \text{Hz} dominant pole (so GBW=1 MHz\text{GBW} = 1\ \text{MHz}), and E1 buffers the output. Gain-Bandwidth and Slew Rate builds it element by element. An op analysis solves both amplifiers for vin=0.5 Vv_\text{in} = 0.5\ \text{V}.

bash · try it yourself
cat > amps.cir <<'EOF'
* inverting (gain -10) and non-inverting (gain 10) amplifiers
.subckt OA inp inn out
G1 0 n1 inp inn 1m
R1 n1 0 100meg
C1 n1 0 159.2p
E1 out 0 n1 0 1
.ends
Vin in 0 0.5
* inverting
R1 in ni 10k
Rf ni outi 100k
X1 0 ni outi OA
* non-inverting
R2 nn 0 10k
Rf2 outn nn 90k
X2 in nn outn OA
.control
op
print v(outi) v(ni) v(outn)
.endc
.end
EOF
ngspice -b amps.cir 2>&1 | grep -E '^v\('
v(outi) = -4.99945e+00
v(ni) = 4.999450e-05
v(outn) = 4.999500e+00

Both outputs agree with the finite-gain formulas, and the inverting input sits at about +50 μV+50\ \mu\text{V}.

Interactive: the virtual ground in a netlist

The ee-netlist lab has no op-amp element, so the op-amp is written as a voltage-controlled voltage source E1 out 0 0 n 100k: gain 10510^5 from the difference between the grounded ++ input and node n. That is the ideal model with finite A0A_0 (no supply rails: the lab never clips). Change RfR_f and watch V(out)V(\text{out}) follow −Rf/R1-R_f/R_1 while V(n)V(n) stays at microvolts.

node voltages (to ground 0)in500.0 mVn49.99 uVout-4.999 VnetlistVin in 0 0.5R1 in n 10kRf n out 100kE1 out 0 0 n 100kelement currents (node 1 to node 2 through it)Vinin>0-50.0 uAR1in>n50.0 uARfn>out50.0 uAE1out>050.0 uA

At the defaults the lab shows V(out)=−4.999 VV(\text{out}) = -4.999\ \text{V}, V(n)=49.99 μVV(n) = 49.99\ \mu\text{V} and 50.00 μA50.00\ \mu\text{A} through both resistors.

The ee-op-amp lab adds what the netlist leaves out: supply rails, output headroom, gain-bandwidth and slew rate. At its defaults (inverting, Rin=10 kΩR_\text{in} = 10\ \text{k}\Omega, Rf=100 kΩR_f = 100\ \text{k}\Omega, 0.5 V0.5\ \text{V} peak at 1 kHz1\ \text{kHz}, ±12 V\pm 12\ \text{V}) the output is a clean 5.000 V5.000\ \text{V} peak sine in antiphase. Raise VinV_\text{in} to 1.5 V1.5\ \text{V}: the ideal output would be 15 V15\ \text{V} peak, but with 1 V1\ \text{V} of headroom the simulated peak stops at 11.00 V11.00\ \text{V} and the status reads "clipping at the rails". Switch to non-inverting with Rf=90 kΩR_f = 90\ \text{k}\Omega for a gain of +10+10.

-+voutRfRinvinlinear (ideal gain)ideal gain-10.00 V/VfCL (-3 dB)90.9 kHz|A(f)| linear9.999 V/Vout pk wanted5.00 Vrail limit+/-11.00 V2 pi f Vpk needs0.031 V/usSR available0.50 V/ussupply+/-12.0 V-100100T/2T3T/22TVf = 1.00 kHz+VS-VSvinvoutideal gain x vin

Guided lab: gain of -10 and +10

Hand calculation. Inverting: G=−10G = -10, Rin=10 kΩR_\text{in} = 10\ \text{k}\Omega. Non-inverting with Rf=90 kΩR_f = 90\ \text{k}\Omega (or 91 kΩ91\ \text{k}\Omega E24, G=10.1G = 10.1): G=10G = 10. Maximum undistorted output about ±10.5 V\pm 10.5\ \text{V} for a general-purpose op-amp on ±12 V\pm 12\ \text{V}, so keep the input under 1 V1\ \text{V} peak.

Simulation. The Python table, the SPICE op run and the two labs above.

What you would measure. Use a general-purpose dual op-amp on a breadboard with 1 % resistors, a 100 nF100\ \text{nF} ceramic capacitor from each supply pin to ground right at the chip, and a ±12 V\pm 12\ \text{V} split bench supply with the current limit set to about 50 mA50\ \text{mA} per channel. Drive 0.5 V0.5\ \text{V} peak at 1 kHz1\ \text{kHz} from a function generator and view input and output on a two-channel scope. Expect 5.0 V5.0\ \text{V} peak ±2 %\pm 2\ \% (two 1 % resistors) inverted for the inverting circuit, in phase for the non-inverting one. A DMM on the inverting input reads 0.000 V0.000\ \text{V} (the 50 μV50\ \mu\text{V} is below most meters' resolution). Raise the input until the output flattens; note the clipping levels, typically 11 to 1.5 V1.5\ \text{V} inside the rails unless the op-amp is rail-to-rail (Real Op-Amps: DC Errors).

Hazards and safe setup. ±12 V\pm 12\ \text{V} from a current-limited bench supply only. Wire with the supply off; check the supply polarity twice, because reversed supplies destroy an op-amp in milliseconds. Never drive an input beyond the supply rails (keep the generator below the rails, and power the op-amp before the signal).

Pitfalls

  • Using the golden rules without negative feedback. Swap the inputs of the inverting amplifier and the "same" equations predict G=−10G = -10, but the circuit latches to a rail.
  • No DC path for the input. A non-inverting input fed through a capacitor floats: the tiny bias current charges it until the output saturates. Add a resistor to ground.
  • Forgetting the supplies. The schematic shows none, but the output cannot leave the range set by them, and the input range is limited too.
  • Expecting high input resistance from the inverting amplifier. It is R1R_1; for a high-impedance sensor use the non-inverting circuit or a follower first.
  • Missing decoupling capacitors. Without them long supply wires can make the amplifier oscillate.

Practice

  1. Design an inverting amplifier with G=−4.7G = -4.7 and Rin≥20 kΩR_\text{in} \ge 20\ \text{k}\Omega using E24 values.
  2. A non-inverting amplifier has R1=1 kΩR_1 = 1\ \text{k}\Omega, Rf=99 kΩR_f = 99\ \text{k}\Omega and A0=104A_0 = 10^4. What is the gain, and its error?
  3. A follower drives a 1 kΩ1\ \text{k}\Omega load from a sensor with 100 kΩ100\ \text{k}\Omega source resistance at 2 V2\ \text{V}. What does the load see with and without the follower?
Answer
  1. Rf/R1=4.7R_f/R_1 = 4.7 with both in E24 and R1≥20 kΩR_1 \ge 20\ \text{k}\Omega: R1=51 kΩR_1 = 51\ \text{k}\Omega, Rf=240 kΩR_f = 240\ \text{k}\Omega gives G=−4.706G = -4.706 (0.1 % high). R1=47 kΩR_1 = 47\ \text{k}\Omega, Rf=220 kΩR_f = 220\ \text{k}\Omega gives −4.681-4.681.
  2. 1/β=1001/\beta = 100, G=100/(1+100/104)=99.0G = 100/(1 + 100/10^4) = 99.0, an error of −0.99 %-0.99\ \%.
  3. Without: 2⋅1/101=19.8 mV2 \cdot 1/101 = 19.8\ \text{mV}. With the follower: 2.00 V2.00\ \text{V}, because the follower draws no current from the sensor.

Test yourself

An inverting amplifier has R1=4.7 kΩR_1 = 4.7\ \text{k}\Omega and Rf=47 kΩR_f = 47\ \text{k}\Omega. Its ideal gain and input resistance are…

  1. +11+11 and 4.7 kΩ4.7\ \text{k}\Omega
  2. −10-10 and 4.7 kΩ4.7\ \text{k}\Omega
  3. −10-10 and infinite
  4. −11-11 and 47 kΩ47\ \text{k}\Omega

The rule v+=v−v_+ = v_- holds when…

  1. always, for any op-amp circuit
  2. the op-amp has negative feedback and its output is not saturated
  3. the op-amp is used open-loop
  4. the inputs are connected together

With A0=104A_0 = 10^4, the gain error of a non-inverting amplifier with G=1+Rf/R1=100G = 1 + R_f/R_1 = 100 is about…

  1. 0.01 %0.01\ \%
  2. 0.1 %0.1\ \%
  3. 1 %1\ \%
  4. 10 %10\ \%

Why is a voltage follower useful although its gain is 1?

  1. It doubles the bandwidth
  2. It draws no input current and drives loads from a low output resistance
  3. It removes the DC offset
  4. It inverts the signal