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
ParameterIdealTypical RealWhat It Means Open-loop gain (Aol)∞100k to 10M (100-140dB)Gain without feedback Input impedance∞1MΩ to 10TΩCurrent drawn from inputs Output impedance00.1Ω to 100ΩAbility to drive loads Bandwidth (GBW)∞10kHz to 1GHzFrequency range for useful gain Slew rate∞0.1V/μs to 5000V/μsMaximum rate of output change Input offset voltage0V1μV to 10mVError voltage with inputs shorted Input bias current0A1fA to 1μADC current flowing into inputs CMRR∞60-140dBRejection of common-mode signals PSRR∞60-120dBRejection of power supply noise Noise voltage03nV/√Hz to 50nV/√HzIntrinsic voltage noiseGolden 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 GNDGain = 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 GNDVout = -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 GNDVout = (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 differenceGain 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 GNDVout = - (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 GNDVout = -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 onlyUsed 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 referenceVout = 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 resistanceUsed for: 4-20mA current loops, LED current drivers, sensor excitation.
Power Supply Connections
ConfigurationV+V-Output RangeUse Dual supply+5V to +15V-5V to -15VFull rail-to-railAudio, precision circuits Single supply+5V to +30VGNDGND to V+ (or near it)Battery-powered, digital systems Rail-to-rail outputVCCGND50mV from each railMaximum dynamic range Rail-to-rail inputVCCGNDInputs can reach railsSingle supply with varying inputsSingle 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)
PartGBWSlew RateVosRail-to-Rail?PriceUse LM358 / LM3241MHz0.5V/μs2-7mVOutput to GND only$0.05Basic, single supply, low frequency TL072 / TL0823MHz13V/μs3-15mVNo$0.10Audio, general purpose, low noise NE553210MHz9V/μs0.5-5mVNo$0.20Audio (the standard), low noise LM386————$0.50Audio power amp (not an op-amp but related)Precision / Low Offset
PartGBWVosDriftUse OP070.6MHz75μVLowPrecision DC, instrumentation OPA227 / OPA2288MHz75μVVery lowPrecision, audio, low noise ADA45223MHz5μVUltra lowZero drift, precision LTC20503MHz1μVNear zeroChopper stabilized, ultimate precisionRail-to-Rail (Single Supply)
PartGBWInputOutputUse MCP6001/2/41MHzRail-to-railRail-to-railLow cost, 5V/3.3V systems OPA3441MHzRail-to-railRail-to-railMicro-power, battery OPA36550MHzRail-to-railRail-to-railFast, 5V precision OPA1713MHzRail-to-railRail-to-rail36V capable, e-trimHigh Speed
PartGBWSlew RateUse LM7171200MHz4100V/μsVideo, high-speed signal OPA6951700MHz4300V/μsRF, IF, video THS3091235MHz7300V/μsHigh output current, fast ADA4899600MHz1000V/μsUltra low distortion, ADC driverLow Power / Battery
PartSupply CurrentGBWUse OPA3792.5μA90kHzUltra low power LPV5110.5μA8kHzExtreme low power TLV900160μA1MHzLow power, 1.8V capableComparators vs. Op-Amps
Comparators and op-amps look similar but are designed for different jobs:
FeatureOp-AmpComparator Designed forAnalog amplification with feedbackDigital switching (high/low output) SpeedSlower (compensated for stability)Faster (no compensation) Output stageLinear (analog voltage output)Open-collector or push-pull (digital) Using op-amp as comparatorSlow, may oscillate, works in a pinchNot recommended for production Using comparator as op-ampNot possible (unstable, no linear region)Designed for this onlyPopular Comparators
PartResponse TimeFeatures LM393 / LM3391.3μsDual/quad, open-collector, cheap ($0.05) TLV35014.5nsUltra fast, push-pull output LT17194nsVery fast, low power MAX9993nsLow dispersion, latch enable TL431Slow (op-amp-like)Adjustable shunt reference/comparator, $0.03Practical 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