The search for a 'comparator op amp' usually stems from a specific bench frustration: you wired up an LM358 or TL072 to compare two voltages, but the output is sluggish, oscillating, or refusing to swing all the way to the positive rail. The hard truth of analog design is that while operational amplifiers and comparators share the same schematic symbol—a triangle with inverting and non-inverting inputs—their internal silicon architectures are fundamentally different. Using a standard op-amp as a comparator is a compromise that often leads to phase inversion, slow recovery from saturation, and destroyed microcontroller GPIO pins.
This guide cuts through the semiconductor theory to give you the exact part numbers, pinouts, and testing procedures you need to design reliable threshold-detection circuits. We will focus on the industry-standard Texas Instruments LM393 dual comparator, mapping out how to bias it, wire it, and verify it with a standard digital multimeter.
The 'Comparator Op Amp' Confusion: Safe Default Part Numbers
Standard op-amps are designed to operate in their linear region with negative feedback. They include internal compensation capacitors to prevent oscillation, which inherently limits their slew rate and causes severe delays when the output saturates against the supply rails. Dedicated comparators, conversely, are designed to operate open-loop. They omit the compensation capacitor, allowing them to switch states in nanoseconds, and typically feature open-collector or open-drain outputs for easy logic-level translation.
Here are the safe, widely available default part numbers you should keep in your component bins, complete with their critical ratings:
| Part Number | Type | Max Supply (VCC) | Output Stage | Response Time | Typical Cost (1k qty) |
|---|---|---|---|---|---|
| LM393 | Dual | 36V (or ±18V) | Open-Collector | 1.3 µs | $0.12 |
| LM311 | Single | 36V | Open-Collector/Emitter | 200 ns | $0.65 |
| TLV3691 | Single | 5.5V | Push-Pull (Rail-to-Rail) | 250 ns | $1.10 |
| MCP6541 | Single | 6.0V | Push-Pull (CMOS) | 4 µs | $0.35 |
Pinout, Symbol, and Operation Regions
On a schematic, a comparator is drawn identically to an op-amp: a triangle with a non-inverting input (+), an inverting input (-), an output, and power rails. However, you will rarely see a feedback resistor drawn between the output and the inverting input in a basic comparator circuit. Instead, you will often see positive feedback (hysteresis) or a pull-up resistor on the output.
The LM393 comes in a standard 8-pin DIP or SOIC package. Here is the exact pinout for the dual comparator:
- Pin 1: Output A (Open-Collector)
- Pin 2: Input A- (Inverting)
- Pin 3: Input A+ (Non-Inverting)
- Pin 4: VEE / GND (Negative Supply)
- Pin 5: Input B+ (Non-Inverting)
- Pin 6: Input B- (Inverting)
- Pin 7: Output B (Open-Collector)
- Pin 8: VCC (Positive Supply)
Understanding the operation regions is critical for troubleshooting. Unlike op-amps, you want to force a comparator into saturation.
| Operation Region | Voltage Diff (IN+ to IN-) | Output State | Typical Output Current | Design Intent |
|---|---|---|---|---|
| Linear | -5mV to +5mV | Unstable / Analog | < 1mA | Avoid. Causes oscillation and slow switching. |
| Positive Saturation | > +20mV | High-Z (Floating) | 0mA (Sinking) | Desired. Output transistor is OFF. Pull-up resistor dictates logic HIGH voltage. |
| Negative Saturation | < -20mV | Low (Sat to GND) | Up to 16mA (Sink) | Desired. Output transistor is ON, pulling the pin to VEE (~0.1V). |
| Overdrive / Damage | > VCC or < VEE | Latch-up / Smoke | N/A | Fatal. Exceeds absolute max input ratings. Use clamping diodes if input exceeds VCC. |
Designing a Reliable 12V Low-Voltage Cutoff Circuit
Let's build a practical application circuit: a 12V lead-acid battery low-voltage alarm that triggers when the battery drops below 11.0V. This circuit uses the LM393, requires no dual-rail power supply, and interfaces safely with a 5V microcontroller or a standard 5V relay module.
Component List and Values
- U1: LM393 Dual Comparator (we will use Channel A)
- R1, R2: 10kΩ 1/4W resistors (Input voltage divider)
- VR1: 10kΩ multi-turn trimpot (Reference voltage setting)
- R3: 4.7kΩ pull-up resistor
- D1: 1N4148 signal diode (Input protection)
- C1: 100nF ceramic capacitor (VCC decoupling)
Wiring Steps and Biasing
- Power the IC: Connect Pin 8 (VCC) to the 12V battery positive. Connect Pin 4 (VEE) to battery ground. Place the 100nF capacitor directly across Pins 8 and 4 to filter high-frequency noise.
- Set the Input (IN+): Wire R1 (10kΩ) from the 12V battery positive to Pin 3 (IN+). Wire R2 (10kΩ) from Pin 3 to ground. This divides the battery voltage exactly in half. At our 11.0V threshold, Pin 3 will see 5.5V.
- Set the Reference (IN-): Connect the outer legs of the 10kΩ trimpot (VR1) between a stable 5V source (like an LM7805 or a microcontroller's 5V pin) and ground. Connect the wiper (middle leg) to Pin 2 (IN-). Note: Never use the unregulated 12V battery to generate your reference voltage, or the threshold will drift as the battery dies.
- Configure the Output: Because the LM393 has an open-collector output, Pin 1 (OUT A) is essentially the collector of an internal NPN transistor. You must connect R3 (4.7kΩ) from Pin 1 to your 5V logic rail. When the comparator triggers, it will sink current to ground; when it releases, the 4.7kΩ resistor pulls the line up to exactly 5V.
- Add Protection: Place the 1N4148 diode in parallel with R2 (cathode pointing up towards Pin 3) to clamp any negative voltage spikes, and add a 10kΩ series resistor between the battery and R1 to limit fault currents.
Failure Modes and Multimeter Testing
Comparators rarely fail gracefully. The most common failure mode on the bench is blowing the output transistor by attempting to sink too much current (exceeding the 16mA limit on the LM393) or applying a voltage to the open-collector output that exceeds the absolute maximum rating (36V). Another common failure is input latch-up caused by driving the inputs above VCC.
Here is how to test a suspected dead LM393 using a standard digital multimeter (like a Fluke 117) without desoldering it from a powered-down board.
Step 1: The Diode Test (Power Off)
Set your multimeter to Diode Test mode. Ensure the circuit is completely de-energized and filter capacitors are discharged.
- VCC to GND Check: Place the red probe on Pin 8 and black on Pin 4. You should read a forward voltage drop (typically 0.6V to 1.2V) due to internal ESD protection diodes. If it reads 0.00V (short) or OL (open), the IC is dead.
- Output Transistor Check: Place the red probe on Pin 4 (GND) and the black probe on Pin 1 (Output). You should read 'OL' (Open Loop) because the internal NPN transistor's collector-base junction is reverse-biased in this direction. Swap the probes (Red on Output, Black on GND). You should read a junction drop of roughly 0.5V to 0.7V. If it reads 0.00V in either direction, the output transistor is shorted.
Step 2: Saturation Voltage Test (Power On)
Power the circuit. Set your multimeter to DC Volts.
- Force the IN+ pin higher than the IN- pin (e.g., IN+ = 3V, IN- = 1V). The output transistor should turn OFF. Measure Pin 1 to GND. It should read exactly the voltage of your pull-up resistor's supply (e.g., 5.00V).
- Force the IN- pin higher than the IN+ pin (e.g., IN+ = 1V, IN- = 3V). The output transistor should turn ON and saturate. Measure Pin 1 to GND. A healthy LM393 will pull this down to between 50mV and 200mV. If it reads 1.5V or higher, the internal transistor is damaged or you are exceeding the 16mA sink limit.
Frequently Asked Questions
Can I just use an LM358 op-amp as a comparator to save board space?
You can, but you will face three distinct penalties. First, the LM358 suffers from 'phase inversion'—if the input common-mode voltage drops too close to the negative rail, the output will inexplicably flip high. Second, the LM358 output cannot swing to the positive rail; it tops out at VCC - 1.5V, which might fail to trigger a 5V CMOS logic gate. Third, if the LM358 saturates, it takes several microseconds to recover from the overdrive condition, causing massive propagation delays in fast-switching PWM or zero-crossing circuits. If you are just turning on an LED when a battery dies, the LM358 is fine. If you are feeding a microcontroller interrupt, use an LM393.
Why does my comparator output oscillate wildly near the threshold voltage?
This is caused by noise on the input signal combined with the comparator's massive open-loop gain (typically 200,000 for the LM393). When the input voltage crosses the threshold, the output switches. However, real-world power supplies and sensor lines have millivolts of high-frequency noise. As the output switches, it can induce a tiny voltage spike back into the input trace via parasitic capacitance, pushing the input back across the threshold and causing a second switch. This creates a burst of high-frequency oscillation. The cure is hysteresis: adding a high-value resistor (e.g., 1MΩ) from the output back to the non-inverting input to create a 'dead band' where the threshold physically moves depending on the output state.
What is the practical difference between open-collector and push-pull outputs?
An open-collector output (like the LM393) is just the collector of an internal NPN transistor. It can pull the line down to ground, but it cannot drive it high. You must provide an external pull-up resistor to your desired logic voltage. This is incredibly useful for level-shifting (e.g., comparing a 12V signal but pulling the output up to 3.3V for an ESP32). A push-pull output (like the TLV3691) contains both a P-channel and N-channel MOSFET. It actively drives the output high to VCC and low to GND without needing a pull-up resistor. Push-pull is faster and draws less static current, but it locks your output logic level to the comparator's VCC supply, making level-shifting impossible without external transistors.






