Op-Amps and Comparators Guide: Circuits, Gain, Feedback, and Practical Applications
What Is an Operational Amplifier?
An operational amplifier (op-amp) is a high-gain differential voltage amplifier with two inputs (inverting and non-inverting), one output, and typically two power supply connections. It's arguably the most versatile analog component ever created — with external passive components, a single op-amp can function as an amplifier, filter, oscillator, comparator, integrator, differentiator, voltage follower, mathematical operation block, and much more. The ideal op-amp has infinite gain, infinite input impedance, zero output impedance, and infinite bandwidth. Real op-amps approach these ideals with trade-offs between speed, precision, power consumption, and cost.
Key Parameters
| Parameter | Ideal | Typical Real | What It Means |
|---|---|---|---|
| Open-loop gain (Aol) | ∞ | 100k to 10M (100-140dB) | Gain without feedback |
| Input impedance | ∞ | 1MΩ to 10TΩ | Current drawn from inputs |
| Output impedance | 0 | 0.1Ω to 100Ω | Ability to drive loads |
| Bandwidth (GBW) | ∞ | 10kHz to 1GHz | Frequency range for useful gain |
| Slew rate | ∞ | 0.1V/μs to 5000V/μs | Maximum rate of output change |
| Input offset voltage | 0V | 1μV to 10mV | Error voltage with inputs shorted |
| Input bias current | 0A | 1fA to 1μA | DC current flowing into inputs |
| CMRR | ∞ | 60-140dB | Rejection of common-mode signals |
| PSRR | ∞ | 60-120dB | Rejection of power supply noise |
| Noise voltage | 0 | 3nV/√Hz to 50nV/√Hz | Intrinsic voltage noise |
Golden Rules (for Negative Feedback Circuits)
- Rule 1: The op-amp output does whatever is necessary to make the voltage difference between the inputs zero.
- Rule 2: No current flows into either input (infinite input impedance).
These two rules, combined with Ohm's Law, let you analyze any negative feedback op-amp circuit in seconds.
Basic Op-Amp Circuits
1. Voltage Follower / Buffer (Unity Gain)
Output connected directly to inverting input (-) Input signal to non-inverting input (+)
Gain = 1 — output exactly follows input. Used when you need to isolate a signal source from a load (impedance transformation). The op-amp provides the current, not the source.
2. Non-Inverting Amplifier
Vin → (+) input Rf from output to (-) input Rin from (-) input to GND
Gain = 1 + (Rf ÷ Rin)
Input impedance is extremely high (op-amp input). Output is in phase with input. Gain is always ≥ 1.
Example: Rf = 10kΩ, Rin = 1kΩ → Gain = 11. A 100mV input produces 1.1V output.
3. Inverting Amplifier
Vin → Rin → (-) input Rf from output to (-) input (+) input to GND (or reference)
Gain = - (Rf ÷ Rin)
Output is inverted (180° phase shift). Input impedance = Rin (not as high as non-inverting). Virtual ground at (-) input.
Example: Rf = 100kΩ, Rin = 10kΩ → Gain = -10. A 200mV input produces -2V output.
4. Summing Amplifier
Multiple inputs through R1, R2, R3 → (-) input Rf from output to (-) input (+) input to GND
Vout = -Rf × (Vin1/R1 + Vin2/R2 + Vin3/R3)
If all input resistors equal R and Rf = R: Vout = -(Vin1 + Vin2 + Vin3). A true analog adder.
5. Difference Amplifier (Subtractor)
Vin1 → R1 → (-) input, Rf from output to (-) Vin2 → R2 → (+) input, R3 from (+) to GND
Vout = (Vin2 - Vin1) × (Rf/R1) when R1=R2 and R3=Rf
Used for differential signal recovery, bridge sensor amplifiers, removing common-mode noise.
6. Instrumentation Amplifier
A precision difference amplifier made of 3 op-amps:
Two op-amps buffer and amplify each input, third amplifies the difference
Gain set by one resistor: Gain = 1 + (2×Rg_internal/Rg_external)
Extremely high CMRR, precise gain setting, buffered inputs. Used for strain gauges, ECG, thermocouples.
IC options: INA128, INA129, AD620, AD8221 — all-in-one instrumentation amps.
7. Integrator
Vin → R → (-) input Cf from output to (-) input (+) input to GND
Vout = - (1/RC) ∫Vin dt (output is the integral of input over time)
A square wave input produces a triangle wave output. Used in analog computers, function generators, PID controllers.
8. Differentiator
Vin → C → (-) input Rf from output to (-) input (+) input to GND
Vout = -RC × dVin/dt (output is proportional to rate of change of input)
A triangle wave input produces a square wave output. Rarely used in practice due to noise amplification.
9. Active Low-Pass Filter (Sallen-Key)
Non-inverting configuration with RC network Cutoff: fc = 1 ÷ (2πRC)
Butterworth, Chebyshev, or Bessel responses depending on component values. Used in: audio crossovers, anti-aliasing, signal conditioning.
10. Active High-Pass Filter
Swap R and C positions from the low-pass filter. Attenuates low frequencies, passes high frequencies. Used to remove DC offset, block rumble.
11. Schmitt Trigger (Comparator with Hysteresis)
Positive feedback from output to (+) input Reference on (-) input (or vice versa)
Creates two switching thresholds — upper and lower — preventing noise-induced chatter. Used for: clean digital signals from noisy analog, switch debouncing, oscillator circuits.
12. Wien Bridge Oscillator
Generates sine waves without input:
Frequency: f = 1 ÷ (2πRC) Requires gain of exactly 3 (non-inverting with Rf = 2×Rin)
Used in: audio signal generators, function generators.
13. Precision Rectifier
Rectifies signals below a diode's forward voltage (0.6V):
Op-amp + diode in feedback: output = |Vin| (full-wave) or negative half only
Used in: audio VU meters, AC voltmeters, AM demodulators, RMS converters.
14. Current-to-Voltage Converter (Transimpedance Amplifier)
Current input to (-) input Rf from output to (-) input (+) input to reference
Vout = Iin × Rf
Used for: photodiode amplification, current measurement, ion detector readout.
15. Voltage-to-Current Converter (Howland Current Pump)
Delivers constant current to load regardless of load resistance
Used for: 4-20mA current loops, LED current drivers, sensor excitation.
Power Supply Connections
| Configuration | V+ | V- | Output Range | Use |
|---|---|---|---|---|
| Dual supply | +5V to +15V | -5V to -15V | Full rail-to-rail | Audio, precision circuits |
| Single supply | +5V to +30V | GND | GND to V+ (or near it) | Battery-powered, digital systems |
| Rail-to-rail output | VCC | GND | 50mV from each rail | Maximum dynamic range |
| Rail-to-rail input | VCC | GND | Inputs can reach rails | Single supply with varying inputs |
Single supply note: When using a single supply, bias the (+) input at VCC/2 (via voltage divider) to center the output at mid-rail. This gives maximum output swing for AC signals.
Popular Op-Amp Part Numbers
General Purpose (Cheap, Available)
| Part | GBW | Slew Rate | Vos | Rail-to-Rail? | Price | Use |
|---|---|---|---|---|---|---|
| LM358 / LM324 | 1MHz | 0.5V/μs | 2-7mV | Output to GND only | $0.05 | Basic, single supply, low frequency |
| TL072 / TL082 | 3MHz | 13V/μs | 3-15mV | No | $0.10 | Audio, general purpose, low noise |
| NE5532 | 10MHz | 9V/μs | 0.5-5mV | No | $0.20 | Audio (the standard), low noise |
| LM386 | — | — | — | — | $0.50 | Audio power amp (not an op-amp but related) |
Precision / Low Offset
| Part | GBW | Vos | Drift | Use |
|---|---|---|---|---|
| OP07 | 0.6MHz | 75μV | Low | Precision DC, instrumentation |
| OPA227 / OPA228 | 8MHz | 75μV | Very low | Precision, audio, low noise |
| ADA4522 | 3MHz | 5μV | Ultra low | Zero drift, precision |
| LTC2050 | 3MHz | 1μV | Near zero | Chopper stabilized, ultimate precision |
Rail-to-Rail (Single Supply)
| Part | GBW | Input | Output | Use |
|---|---|---|---|---|
| MCP6001/2/4 | 1MHz | Rail-to-rail | Rail-to-rail | Low cost, 5V/3.3V systems |
| OPA344 | 1MHz | Rail-to-rail | Rail-to-rail | Micro-power, battery |
| OPA365 | 50MHz | Rail-to-rail | Rail-to-rail | Fast, 5V precision |
| OPA171 | 3MHz | Rail-to-rail | Rail-to-rail | 36V capable, e-trim |
High Speed
| Part | GBW | Slew Rate | Use |
|---|---|---|---|
| LM7171 | 200MHz | 4100V/μs | Video, high-speed signal |
| OPA695 | 1700MHz | 4300V/μs | RF, IF, video |
| THS3091 | 235MHz | 7300V/μs | High output current, fast |
| ADA4899 | 600MHz | 1000V/μs | Ultra low distortion, ADC driver |
Low Power / Battery
| Part | Supply Current | GBW | Use |
|---|---|---|---|
| OPA379 | 2.5μA | 90kHz | Ultra low power |
| LPV511 | 0.5μA | 8kHz | Extreme low power |
| TLV9001 | 60μA | 1MHz | Low power, 1.8V capable |
Comparators vs. Op-Amps
Comparators and op-amps look similar but are designed for different jobs:
| Feature | Op-Amp | Comparator |
|---|---|---|
| Designed for | Analog amplification with feedback | Digital switching (high/low output) |
| Speed | Slower (compensated for stability) | Faster (no compensation) |
| Output stage | Linear (analog voltage output) | Open-collector or push-pull (digital) |
| Using op-amp as comparator | Slow, may oscillate, works in a pinch | Not recommended for production |
| Using comparator as op-amp | Not possible (unstable, no linear region) | Designed for this only |
Popular Comparators
| Part | Response Time | Features |
|---|---|---|
| LM393 / LM339 | 1.3μs | Dual/quad, open-collector, cheap ($0.05) |
| TLV3501 | 4.5ns | Ultra fast, push-pull output |
| LT1719 | 4ns | Very fast, low power |
| MAX999 | 3ns | Low dispersion, latch enable |
| TL431 | Slow (op-amp-like) | Adjustable shunt reference/comparator, $0.03 |
Practical Tips
- Decouple power pins: 100nF ceramic cap from V+ to V- (or to GND for dual supply), placed right at the IC pins
- Watch for oscillation: If an op-amp circuit oscillates, add a small capacitor (10-100pF) in parallel with Rf, or add a compensation network
- Single supply biasing: For AC signals, create a virtual ground at VCC/2 using a voltage divider and buffer (or just large resistors)
- Input protection: Add clamping diodes to protect op-amp inputs from overvoltage, especially with long cables
- Output current limit: Standard op-amps drive 20-40mA max. For more current, add a push-pull output stage or use a power op-amp
- Unity gain stable: Most op-amps are stable at unity gain. Check datasheet if using gain < 5 — some require minimum gain
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Output stuck at one rail | No feedback, wrong polarity, input beyond rails | Check wiring; add negative feedback; verify input range |
| Oscillation / ringing | Too much gain at high frequency, capacitive load, poor layout | Add compensation cap; isolate capacitive load with resistor; add decoupling |
| Output offset voltage | Input offset voltage × gain; bias current through unequal resistors | Match input resistances; use chopper or precision op-amp |
| Limited output swing | Not rail-to-rail op-amp; load too heavy | Use rail-to-rail op-amp; reduce load or add buffer |
| Noisy output | High source resistance; wrong op-amp for application; poor layout | Reduce source R; use low-noise op-amp; shield inputs; filter supply |
| Slow response | Slew rate limiting; bandwidth too low for signal | Choose faster op-amp; reduce signal amplitude; increase gain bandwidth |