Circuit 3D

Op amp

An op amp, or operational amplifier, is a chip that amplifies the difference between its two inputs by a huge gain, often 100,000 or more. With negative feedback from its output back to its inverting input, two resistors set a precise gain instead: in a non-inverting amplifier, 10 kΩ and 1 kΩ give 1 + 10 ÷ 1 = 11.

Gain = 1 + Rf ÷ Rg

where Rf runs from the output back to the − input and Rg from that input to ground; the output can’t go beyond its supply rails.

With no feedback at all, it acts as a comparator, swinging its output to one rail or the other.

What is an operational amplifier (op amp)?

An op amp is an integrated amplifier with two inputs, + (non-inverting) and − (inverting), and one output, which amplifies the difference between the inputs many thousands of times.

That raw gain is too large and too variable to use directly, so circuits feed some of the output back. In Figure 1, two resistors set a non-inverting amplifier’s gain, and the output follows the input until it meets the rail.

+ − Rf Rg 500 mV +12 V rail 2.85 V out

Rf = 47 kΩ, 500 mV in: gain = 1 + 47 kΩ ÷ 10 kΩ = 5.7, so Vout = 500 mV × 5.7 = 2.85 V, in step with the input.

Figure 1. A non-inverting amplifier: the input on +, and Rf from the output back to −, with Rg = 10 kΩ from − to ground. An ideal op amp on ±12 V.

How does an op amp work?

An op amp works, with negative feedback, by driving its output to whatever voltage makes its two inputs equal, while drawing almost no current into them.

Those two golden rules solve most op amp circuits. In the non-inverting amplifier, the output rises until the divider of Rf and Rg brings the − input up to match +, which is why the gain is 1 + Rf ÷ Rg. That negative feedback trades raw gain for precision.

What is an inverting amplifier?

An inverting amplifier is an op amp with the input fed through Rin to the − input and Rf from the output back to it, for a gain of −Rf ÷ Rin, upside down.

The + input sits at ground, so the feedback holds the − input there too, a virtual ground. Push the input too far and the output meets its supply rails and clips, as Figure 2 shows.

+12 V −12 V

1 V peak in: gain = −47 kΩ ÷ 10 kΩ = −4.7, so the output peaks at 4.7 V, upside down: high where the input is low.

Figure 2. An inverting amplifier with Rin = 10 kΩ and Rf = 47 kΩ on ±12 V: the input sine, pale, and the output, bold.

What is an op amp comparator?

An op amp comparator is an op amp with no feedback: its huge gain sends the output to the top rail when + is above −, and to the bottom rail when it is below.

Comparators turn a slowly changing signal, such as a light sensor’s divider, into a clean on or off. Dedicated comparator chips switch faster and cleaner than op amps. Figure 3 compares an input with 2.5 V.

+ − 2.6 V 2.5 V HIGH 5 V

2.6 V on +: above the 2.5 V on −, so the huge open-loop gain drives the output to the top rail, 5 V, even though the difference is only 100 mV.

Figure 3. An op amp with no feedback, on 0 V and 5 V, comparing an input on + with 2.5 V on −.

What is a voltage follower?

A voltage follower is an op amp with its output wired straight to its − input: its gain is 1, so the output copies the input, but it can supply far more current.

That makes it a buffer. A voltage divider sags under a load; put a follower after it and the load draws from the op amp instead, leaving the divider’s voltage untouched.

Which op amp should you use?

For hobby work, the best op amps are the LM358 on a single 3 to 32 V supply, the TL072 for audio, and rail-to-rail parts such as the MCP6002 on 3.3 V or 5 V.

Older op amps such as the 741 were made for a split supply and stop a volt or two short of each rail. Check the supply range, how close the output gets to the rails, and the bandwidth you need. Its internal amplifying parts are transistors.

How do you calculate an op amp’s gain?

To calculate an op amp’s gain, use 1 + Rf ÷ Rg for a non-inverting amplifier and −Rf ÷ Rin for an inverting one, then check the output stays within the rails.

Example 1: a non-inverting gain

A non-inverting amplifier has Rf = 47 kΩ and Rg = 1 kΩ. What is its gain, and its output for 0.1 V in?

Given
a non-inverting amplifier with Rf = 47 kΩ and Rg = 1 kΩ, fed 0.1 V
Find
its gain and output
Solution
Gain = 1 + Rf ÷ Rg = 1 + 47 kΩ ÷ 1 kΩ = 48Vout = 0.1 V × 48 = 4.8 V
Answer
Gain 48; 4.8 V out

Example 2: an inverting output

An inverting amplifier on ±12 V has Rin = 10 kΩ and Rf = 47 kΩ. What does it output for 500 mV in?

Given
an inverting amplifier with Rin = 10 kΩ and Rf = 47 kΩ on ±12 V, fed 500 mV
Find
its output
Solution
Gain = −Rf ÷ Rin = −47 kΩ ÷ 10 kΩ = −4.7Vout = 500 mV × −4.7 = −2.35 V
Answer
Vout = −2.35 V

Summary

Key equations

  • Gain = 1 + Rf ÷ Rg non-inverting
  • Gain = −Rf ÷ Rin inverting
  • Vout = gain × Vin within the rails

Key terms

Feedback
Output fed back to the − input.
Rails
The supply voltages it can’t pass.
Clipping
The output flattened at a rail.
Follower
A gain-of-1 buffer.

Practice problems

  1. What is a non-inverting amplifier’s gain with Rf = 90 kΩ and Rg = 10 kΩ?

  2. An inverting amplifier has Rf = 47 kΩ and Rin = 10 kΩ. What comes out for 0.5 V in?

  3. With negative feedback, what do an ideal op amp’s inputs do?

  4. What does an op amp with no feedback act as?

  5. A gain-of-10 amplifier on ±12 V gets 2 V in. What comes out?

FAQ

What is an op amp used for?

Amplifying small signals from sensors and microphones, filtering, buffering dividers, comparing voltages, and doing maths on signals, such as adding them.

What are the golden rules of op amps?

With negative feedback, the output does whatever makes the two inputs equal, and the inputs draw no current. They hold for an ideal op amp and very nearly for real ones.

What is the difference between inverting and non-inverting?

A non-inverting amplifier’s output follows the input, with gain 1 + Rf ÷ Rg; an inverting one’s is flipped, with gain −Rf ÷ Rin.

What is a rail-to-rail op amp?

One whose output, and often inputs, reach close to both supply rails, which matters on low supplies such as 3.3 V.

Can an op amp run from a single supply?

Yes. Many, such as the LM358, work from a single positive supply, usually with the signal biased to around half the supply.

Why doesn’t my op amp output reach the supply?

Many op amps stop a volt or two short of each rail. Use a rail-to-rail part, or a higher supply.

Is an op amp the same as a comparator?

An op amp without feedback works as a comparator, but a dedicated comparator chip switches faster and drives logic more cleanly.

What is a non-inverting amplifier?

An op amp circuit that feeds the signal to the + input and part of the output back to the − input, for a gain of 1 + Rf ÷ Rg with no inversion: 10 kΩ and 1 kΩ give 11.

What is a Schmitt trigger?

A comparator with positive feedback, so it switches at two thresholds, a higher one as the input rises and a lower one as it falls; the gap stops a noisy input from making the output chatter.

What is a differential amplifier?

An op amp circuit that amplifies the difference between two inputs and ignores what they share; with four equal resistors its output is V2 − V1.