Op-Amp Comparator Calculator
Determine output state and voltage for push-pull and open-collector comparator configurations.
Component Values
Results
Vout = HIGH when V+ > V−
Op-Amp Comparator Fundamentals
A comparator is an op-amp used in open-loop mode (no negative feedback). When V+ > V−, the output saturates to its positive rail (HIGH). When V+ < V−, the output saturates to its negative rail (LOW). The transition is very fast because there is no feedback to slow it down.
Push-pull comparators actively drive both HIGH and LOW output states. This makes them fast and easy to use but limits their flexibility. Open-collector (or open-drain) outputs only pull LOW actively; for HIGH, an external pull-up resistor is required. Open-collector outputs allow wired-AND connections and voltage translation between different supply levels.
Unlike op-amps, dedicated comparators like the LM393 and LM339 are optimized for fast switching and have output stages designed for saturation recovery. Using a general op-amp as a comparator works but may result in slower transitions, especially on the rising edge.
Comparator Rule
Vout = HIGH if V+ > V−
Vout = LOW if V+ < V−Key Points
- Vout = HIGH when V+ > V−, Vout = LOW when V+ < V−
- Open-collector: requires external pull-up resistor for HIGH state
- Add hysteresis (positive feedback) to avoid chattering on slow/noisy inputs
- Dedicated comparators (LM393) are faster than op-amps in open-loop
Applications
- Battery under/over voltage detection
- Zero-crossing detection
- Analog-to-digital conversion (flash ADC)
- Level shifting between voltage domains
Practical Examples
LM393 monitors a 12 V battery with a 10.5 V threshold using a resistor divider. Output goes LOW when battery drops below threshold.
Vref = 5 V × R2/(R1+R2) → choose R1=6.8kΩ, R2=4.7kΩ → Vref = 2.04 V → scale: 10.5 V
Adding positive feedback to an LM393 comparator with Vref = 3 V and Vcc = 5 V to get ±25 mV hysteresis.
R_hyst = (Vcc × R_in) / Vhyst = (5 × 10 kΩ) / 0.05 = 1 MΩ feedback resistor
Did you know? Dedicated comparators like the LM393 have open-collector outputs, allowing direct logic-level interfacing and wired-AND configurations. Using a general-purpose op-amp as a comparator works but is slower — op-amps are not designed to recover from output saturation quickly.