Comparator
Zero crossing detector, voltage level comparison.
A comparator checks which of two voltages is larger and outputs a digital high or low to indicate the result. The LM393 is used in battery chargers, zero-crossing detectors, and motor speed controllers to trigger switching at a set threshold.
Core Concept
A comparator is essentially an op-amp operated in open loop. Without negative feedback, the gain is extremely high (100,000 or more). Even a 1 mV difference between the two inputs drives the output all the way to the supply rail. The output is binary: it represents a logic 0 or logic 1.
The threshold voltage is applied to the reference input (V-). When Vin > Vref, Vout goes high. When Vin < Vref, Vout goes low. Dedicated comparators like the LM393 are faster than op-amps used open-loop because their output stage is designed for rail-to-rail switching rather than linear operation.
The LM393 has an open-collector output. A pull-up resistor (4.7 kΩ typical) to the supply is required to obtain a high output. This also lets the output voltage level be set independently of the supply, which is useful for interfacing with 3.3V logic from a 5V supply.
Key Equations
The output decision rule is simple:
If (V+ - V-) > 0, then Vout = VOH (logic high, close to VCC)
If (V+ - V-) < 0, then Vout = VOL (logic low, close to 0V or GND)
For a resistor divider reference:
Vref = VCC * R2 / (R1 + R2)
Propagation delay for the LM393 is typically 1.3 µs. The LM339 contains four comparators in one package. Response time for the faster LM311 is about 200 ns.
Output voltage with open collector and pull-up resistor Rp:
VOH = VCC - Isink * Rp (must stay above logic threshold)
Given:
VCC = 5V
R1 = 10 kΩ (top resistor in divider)
R2 = 10 kΩ (bottom resistor in divider)
Pull-up resistor Rp = 4.7 kΩ
Vin = 3.2V applied to non-inverting input (V+)
Why this formula:
Vref from voltage divider, then compare with Vin
Formula:
Vref = VCC * R2 / (R1 + R2)
Substitution:
Vref = 5 * 10,000 / (10,000 + 10,000)
Calculation:
Vref = 5 * 10,000 / 20,000
= 5 * 0.5
= 2.5 V
Since Vin = 3.2V > Vref = 2.5V,
V+ > V-, so output goes HIGH (VOH ≈ VCC = 5V)
Final Answer:
Vref = 2.5V, Vout = HIGH (≈5V)Exam Tip: GATE asks why a comparator is not a good linear amplifier. The answer: the open-loop gain is so high that any nonzero input difference immediately saturates the output. Also remember the LM393 has an open-collector output, so it always needs a pull-up resistor. Students confuse comparator transfer characteristics with op-amp saturation; the key difference is that comparators are designed to switch fast, not to limit linearly.
Key Properties
- LM393 is a dual, open-collector comparator operating from 2V to 36V supply.
- LM339 contains four comparators in a single 14-pin DIP package.
- Propagation delay for LM393 is 1.3 µs; LM311 is faster at 200 ns.
- Open-collector output requires a pull-up resistor (typically 4.7 kΩ) to the logic supply.
- Input offset voltage is typically 2 mV for LM393, limiting the minimum detectable difference.
- The output swings from near 0V (logic low) to VCC via pull-up (logic high).
- Adding hysteresis (positive feedback) converts the comparator into a Schmitt trigger and prevents output chatter near the threshold.
Quick Revision
- Comparator = op-amp in open loop for voltage comparison.
- V+ > V- means Vout = HIGH; V+ < V- means Vout = LOW.
- LM393 open-collector output needs a pull-up resistor.
- LM339 = quad comparator, LM311 = high-speed single comparator.
- Vref set by resistor divider: Vref = VCC * R2/(R1+R2).
- Propagation delay limits switching speed in time-critical applications.
- Adding positive feedback gives hysteresis and eliminates chatter near threshold.
- Exam trap: Students use the inverting op-amp gain formula for a comparator. A comparator has no feedback and no linear gain. The only answer for output is VOH or VOL, never an intermediate voltage in normal operation.
Comparator Applications
Verify concepts related to zero crossing detectors and voltage comparison.
Q1.When an operational amplifier is utilized as an open-loop comparator, what determines the state of the output voltage?
Related Articles
Difference Amplifier
Differential input, CMRR improvement, bridge amplifier.
4 min read
Instrumentation Amplifier
Three op-amp design, high CMRR, adjustable gain.
4 min read
Non-Inverting Amplifier
Gain = 1 + Rf/Ri, high input impedance.
4 min read
Summing Amplifier
Weighted summer, audio mixer, DAC application.
12 min read
Ideal Op-Amp
Infinite gain, infinite input impedance, zero output impedance.
8 min read