Practical applications

Applications of Comparators in Analog Circuits

See how comparators are used in window detectors, zero-crossing detectors, PWM generation, and ADC front ends, with real IC examples and circuit descriptions.

Visual

Signal Source(Sensor / AC)ReferenceResistor DividerComparatorLM393Logic Output(MCU GPIO)HysteresisFeedback R_f

Concept overview

A comparator is a high-gain differential amplifier optimised for open-loop operation. It produces a digital output high or low depending on which input is greater. Unlike an op-amp, a comparator is designed for fast overdrive recovery, rail-to-rail output swing, and compatibility with logic levels. Key specifications are propagation delay, input offset voltage, hysteresis, and output structure. Most comparators have an open-collector or open-drain output that requires an external pull-up resistor to the logic supply, allowing wired-AND configurations and level shifting to different voltage domains.

Real-world applications

Zero-Crossing Detection in TRIAC Dimmer Circuits
Building Automation
Lutron dimmers use an LM393 comparator to detect the 50 Hz AC mains zero crossing. The comparator input is a resistor-divided and clamped version of the mains waveform. The output pulse triggers a microcontroller interrupt that then fires the TRIAC gate after a programmable delay, controlling the conduction angle and therefore the load power without large dissipative elements.
Over-Voltage Protection in USB-C PD Controllers
Consumer Electronics
The Texas Instruments TUSB422 USB-C PD controller uses an internal comparator to monitor the VBUS rail against a 22 V threshold. If an attached charger negotiates 20 V but the bus rises above 22 V due to a fault, the comparator output immediately drives the discharge FET to clamp the bus before the downstream device is damaged. Response time is under 1 microsecond.
PWM Generation in Motor Control
Industrial Motor Control
In the STMicroelectronics L6234 three-phase motor driver, an internal comparator compares the control voltage from a DSP against an internally generated sawtooth ramp at 50 kHz. The comparator output directly drives the gate logic, creating a pulse-width modulated signal whose duty cycle is proportional to the control input, converting an analog torque demand into a digital switching pattern.
Flash ADC Input Stage in Oscilloscopes
Test and Measurement
High-speed oscilloscopes such as the Rohde and Schwarz RTO2000 use flash ADC front ends containing 255 comparators in parallel, each with a different reference voltage set by a resistor ladder. All 255 comparators sample the input simultaneously, and the thermometer code output is decoded to an 8-bit binary result within one clock cycle at 10 GSPS.

How it works in practice

In a basic comparator circuit, the non-inverting input receives the signal being monitored and the inverting input is connected to a reference voltage set by a resistor divider. When V_plus exceeds V_minus by more than the input offset voltage, the output switches to high. With an open-collector output and a pull-up resistor to 3.3 V, the output is compatible with a microcontroller GPIO input. Hysteresis is added by feeding a fraction of the output back to the non-inverting input through a resistor, creating a Schmitt trigger. If R_f connects output to V_plus and R_in connects source to V_plus, the positive feedback shifts the switching threshold upward when output is high and downward when output is low. The hysteresis band = V_supply * R_in / (R_in + R_f). This prevents multiple output transitions when a slowly moving or noisy signal crosses the threshold.

Examples

Setting Hysteresis on an LM393
An LM393 monitors a thermistor voltage. R_in = 10 kohm connects the thermistor divider output to V_plus. R_f = 1 Mohm connects the open-collector output, pulled to 5 V, back to V_plus. Hysteresis band = 5 V * 10k / (10k + 1000k) = 5 V * 0.0099 = 49.5 mV. The comparator trips at threshold + 25 mV on rising signal and at threshold minus 25 mV on falling signal. This 49.5 mV dead band prevents relay chatter when the thermistor voltage hovers near the trip point due to thermal noise.
Window Comparator for Battery Voltage Monitoring
Two LM393 units share the battery input. The upper comparator has V_ref_high = 4.2 V on its inverting input. The lower comparator has V_ref_low = 3.0 V on its non-inverting input. Both open-collector outputs are wired together with one pull-up resistor. The combined output is high only when the battery voltage is within the window 3.0 V to 4.2 V. Outside this range, one comparator pulls the output low, signalling a fault to the microcontroller without any logic gate.

Future scope

Continuous-time comparators in high-speed ADCs are being replaced by dynamic latch comparators that only draw current during the sampling instant, reducing power by a factor of ten compared to static designs. At 5 nm CMOS, dynamic comparators achieve 10 GSPS with input-referred noise below 200 uV RMS. Research into time-mode comparators that encode analog values as pulse widths rather than voltage levels is being pursued for sub-threshold operation in implantable biosensors where supply voltage is constrained to 0.3 V.