Be careful when using op amps as a comparator

Article By : Bob Witte

There are many articles about non-linear op amps being used as a comparator, but IC vendors caution against this design approach.

In previous articles—Common op-amp circuits, Op amps do integration, and The practical op-amp differentiator is quite versatile—we looked at some classic op amp circuits. These circuits used negative feedback, which normally keeps the op amp operating in the linear region.

However, op amps can also be used as comparators, which causes them to operate non-linearly. The inputs are driven hard and the output voltage slams to the power supply rail. As we will see, this may not always be a good design approach.

Going non-linear

In a linear application, the ideal op-amp assumptions apply: infinite gain and bandwidth, zero output impedance, infinite input impedance and zero volts between the inputs. Op amps can also be used in a non-linear fashion, with some special care and handling.

A common configuration is just using the op amp open loop—without feedback—and letting its high gain produce comparator operation. Without negative feedback, the two inputs will not necessarily remain at the same voltage, so the fourth ideal op amp assumption is not valid.

Figure 1 shows an op amp configured in open loop. When VIN is greater than zero, the output voltage goes high and is limited somewhere around the positive supply voltage. When the input voltage goes negative, the op amp output swings negative, again limited near the negative supply voltage. Here, we assume the op amps are powered with the conventional positive and negative supply voltages.

Figure 1 The op amp is used as a comparator with zero threshold voltage.

The above comparator circuit operates around zero volts. Figure 2 adds a resistive divider to the circuit to set the voltage at the inverting input, providing a means to control the reference voltage for the comparator, VREF.

Figure 2 An op amp comparator with a resistive divider sets the threshold voltage.

Figure 3 shows another common design technique that adds hysteresis to the comparator. In this case, the input voltage drives the inverting input of the op amp and VREF connects to the noninverting input. The R1 R2 resistive divider produces VREF from output, VOUT. When VIN falls below VREF, the output voltage goes high, causing VREF to shift to a higher voltage.

Figure 3 Op amp comparator circuit adds hysteresis via positive feedback.

Similarly, when VIN transitions to be higher than VREF, VOUT changes to the maximum negative output voltage, pulling VREF lower. This hysteresis effect keeps any noise present on the input signal from reversing the comparator operation while transitioning past VREF.

The multi-vibrator circuit in Figure 4 uses the R1 R2 hysteresis circuit from Figure 3 plus an RC timing circuit to produce a square wave output. Actually, it’s not a comparator circuit; instead, it operates the op amp as a comparator to create the desired output waveform. Assume VOUT starts out as a high voltage such that it charges C via R3. The capacitor voltage will increase while being consistent with the time constant R3 C.

Figure 4 The multi-vibrator circuit adds an RC timing circuit to produce a square wave output.

When the capacitor voltage becomes larger than VREF, the output voltage will swing to the negative supply voltage. This causes the capacitor voltage to be driven negative, again consistent with the time constant R3 C. The R1 R2 divider provides some hysteresis on the non-inverting input so that the op amp transitions cleanly. See Reference 4 for the details on how the component values determine the multi-vibrator frequency.

But there are issues

There are many articles on the web about non-linear op amp circuits like these. However, when I checked the IC vendor websites, I noticed they strongly caution against using op amps as comparators [Reference 1 and Reference 2]. The main issues cited are:

  1. Some op amps have clamping diodes on the inputs which limit the maximum voltage between the two inputs. This can probably be handled with careful design or by choosing another op amp device.
  2. Comparator applications drive the op amp into saturation. Recovery from saturation can be slow and is generally not specified.
  3. The output voltage of most op amps can swing close to the positive and negative supply voltages. This may or may not be specified and it may not be well controlled.
  4. The switching time of an op amp tends to be slow as compared to a “real comparator” designed for that specific application.
  5. The output of the op amp is not usually set up to drive digital logic, so additional circuitry may be required to adapt it.

The main argument for using an op amp as a comparator occurs when there is a leftover amplifier in a multiple op-amp device. After all, it’s just sitting there, free of cost, waiting to be used. If you decide to pursue this path, then some careful study of the datasheet along with evaluation of the actual circuit performance is in order. Make sure that the op amp circuit has quite a bit of margin built-in.

These considerations of non-linear op amp operation may also help us understand some of the problems that can occur in linear applications. Are there situations when the output of the op amp gets driven to the rails? If so, how long will it take to recover? And does that matter in the performance of the circuit?

That’s why IC vendors recommend that you use a real comparator instead of an op amp. After all, a comparator is designed to be a comparator. It has specified switching characteristics and output drive, usually set up to drive logic devices. There are many economical devices to choose from.

This article was originally published on EDN.

Bob Witte is president of Signal Blue LLC, a technology consulting company.


  1. Op Amps used as Comparators—is it okay?” Bruce Trump, Texas Instruments, March 2012
  2. Using Op Amps as Comparators,” James Bryant, Analog Devices, Application Note AN-849, 2011
  3. Should I use an op amp as a comparator?” Janet Heath, Analog IC Tips, November 2016
  4. Op-amp Multivibrator,” Electronics Tutorials
  5. Handbook of Operational Amplifier Applications, Bruce Carter and Thomas R. Brown, Texas Instruments, Sept 2016
  6. Op Amps for Everyone, Ron Mancini, editor, August 2002

Related articles:

Leave a comment