The Ideal Op-Amp: Inverting, Non-Inverting and Follower
A load cell gives , a microcontroller's ADC wants about , 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 , on 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 and the inverting input , one output, and two supply pins that are often left off schematics:
, the open-loop DC gain, is typically to ( to ). The output can only swing between the supply rails, and usually stops a volt or so short of them. So with supplies and , a difference of only 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.
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:
- No current flows into either input.
- : the output adjusts until the input difference is (practically) zero.
Rule 2 is a consequence, not a property: , which is microvolts when 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 : a virtual ground. The input current is therefore , and by rule 1 all of it flows on through :
The source sees exactly , because its far end is held at ground. That makes the input resistance easy to set but also low: a input loads a high-impedance sensor.
Non-inverting amplifier and follower
The input drives directly; and form a divider from the output back to . Rule 2 says the divider output equals :
With and removed you get the voltage follower, : 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 for the feedback fraction. Solving the circuits with instead of rule 2 gives
The relative gain error is about . The quantity 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 by (Negative Feedback).
Worked example
Given: an inverting amplifier with , , supplies, an op-amp with and ; input DC.
Find: the ideal and real gain, , the voltage at the inverting input and the closed-loop output resistance.
Solve:
Check: the gain error is , far below the 1 % tolerance of ordinary resistors, so the resistors set the accuracy, not the op-amp. The "virtual ground" is above ground: small, not zero. is well inside the rails.
In Python: how much open-loop gain is enough?
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 would be useless for a gain of 10 (a 10 % error); at the error has dropped to the level, and every extra factor of ten in 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 into gives , C1 sets a dominant pole (so ), and E1 buffers the output. Gain-Bandwidth and Slew Rate builds it element by element. An op analysis solves both amplifiers for .
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 .
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 from the difference between the grounded input and node n. That is the ideal model with finite (no supply rails: the lab never clips). Change and watch follow while stays at microvolts.
At the defaults the lab shows , and 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, , , peak at , ) the output is a clean peak sine in antiphase. Raise to : the ideal output would be peak, but with of headroom the simulated peak stops at and the status reads "clipping at the rails". Switch to non-inverting with for a gain of .
Guided lab: gain of -10 and +10
Hand calculation. Inverting: , . Non-inverting with (or E24, ): . Maximum undistorted output about for a general-purpose op-amp on , so keep the input under 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 ceramic capacitor from each supply pin to ground right at the chip, and a split bench supply with the current limit set to about per channel. Drive peak at from a function generator and view input and output on a two-channel scope. Expect peak (two 1 % resistors) inverted for the inverting circuit, in phase for the non-inverting one. A DMM on the inverting input reads (the is below most meters' resolution). Raise the input until the output flattens; note the clipping levels, typically to inside the rails unless the op-amp is rail-to-rail (Real Op-Amps: DC Errors).
Hazards and safe setup. 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 , 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 ; 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
- Design an inverting amplifier with and using E24 values.
- A non-inverting amplifier has , and . What is the gain, and its error?
- A follower drives a load from a sensor with source resistance at . What does the load see with and without the follower?
Answer
- with both in E24 and : , gives (0.1 % high). , gives .
- , , an error of .
- Without: . With the follower: , because the follower draws no current from the sensor.
Test yourself
An inverting amplifier has and . Its ideal gain and input resistance are…
- and
- and
- and infinite
- and
The rule holds when…
- always, for any op-amp circuit
- the op-amp has negative feedback and its output is not saturated
- the op-amp is used open-loop
- the inputs are connected together
With , the gain error of a non-inverting amplifier with is about…
Why is a voltage follower useful although its gain is 1?
- It doubles the bandwidth
- It draws no input current and drives loads from a low output resistance
- It removes the DC offset
- It inverts the signal