18
\$\begingroup\$

What is the difference between a differential op amp and a comparator? I know a comparator can only give me two values (the supply values).

The differential op amp amplifies the difference between the inputs...but should a comparator not do the same then? What is the specific difference?

\$\endgroup\$
  • \$\begingroup\$ Texas Instruments had an appnote on that, but I can't find it anymore. The title was something along the lines of "Op-amps and comparators: don't confuse them". \$\endgroup\$ – Renan Jun 16 '13 at 20:44
  • \$\begingroup\$ It was SLOA067, but they've removed it from their site. The Internet has long[er] memory though. bytebucket.org/intelligentagent/replicape/raw/… \$\endgroup\$ – Fizz Oct 15 '15 at 20:03
  • \$\begingroup\$ See also Null's answer below and my comment below that. \$\endgroup\$ – Fizz Oct 15 '15 at 20:24
20
\$\begingroup\$

As a first approximation, there isn't a difference. A similar question might be "what's the difference between a DC motor and a generator?" Either will function in either capacity, but each is optimized to maximize certain qualities at the expense of others, according to the intended application.

Let's compare the internal schematic for a common op-amp, TL072, and a common comparator, LM339:

TL072

TL072 schematic

LM339

LM339 schematic

Things in common:

  1. differential pair input
  2. very high gain

Differences:

  1. The TL072 uses JFETs for the input. This is because JFETs provide extremely high input impedance, which is desirable for an op-amp. Most op-amp analysis assumes that the bias currents (the currents moving through the inputs) are zero, but this is only true to the extent that the input impedance is infinite. For a comparator, you do want high input impedance to avoid loading the source excessively, but it's not so important that input impedance is very high.

  2. The LM339 has an open collector output. For a comparator, this is good, because it allows it to interface with any number of output voltages through a pull-up resistor, or trivially implement a wired-or bus. You wouldn't want this for an op-amp, because usually, you want an op-amp to be as good at sourcing current as sinking it, so that your output waveform is symmetrical. Notice the NPN-PNP push-pull pair output of TL072.

  3. The LM339 can pull the output as low as 0.2V or as high as \$V_{cc}\$, by virtue of its open-collector output. TL072 specifies an output voltage swing of \$\pm 10V\$ when \$Vcc = 15V\$ when the load is less than \$2k\Omega\$.

An experienced IC designer could probably point out more differences, from the schematic alone. I'm not one of those, but I can see the differences in the datasheets. For example, I don't see a common-mode or power-supply rejection ratio, harmonic distortion, or noise figure specified at all for LM339. These could be measured for a comparator, and you will find them in every op-amp datasheet, but for a comparator application, these parameters aren't especially relevant, so they aren't specified, and if they were, would likely be very poor.

So, in every case, you could use an op-amp as a comparator, or a comparator as an op-amp, if your requirements are not very demanding. Given the difference in how the parts are specified, it may not be possible to know from the specifications how it will even perform.

\$\endgroup\$
  • \$\begingroup\$ I am kinda having a hard time imagining Lm339 as a differential Op.amp.. The open collector output only allows me 2 values either high or low.. \$\endgroup\$ – user25282 Jun 16 '13 at 21:38
  • \$\begingroup\$ @user25282 the open collector output has nothing to do with it. The elementary class A common emitter amplifier is just like an open collector output, but the transistor is operating in the active region. This isn't a desired mode of operation, which is why the gain is so high: to reduce the possibility that the inputs will result in this situation. So, you will need negative feedback to make it work. The same is true of an op-amp. \$\endgroup\$ – Phil Frost Jun 17 '13 at 1:32
  • 1
    \$\begingroup\$ @user25282 - Am LM339 and LM324 are very similar devices thyat AFAIK came from the same designers originally at about the same time (long long ago) but the 1st is a comparator and the 2nd is an opamp. Look in early Lm339 ap-notes and you will find ccts for use as a low bandwidth opamp. The comparator is optimised to switch cleanly and may have less attention paid to linearity and stability under linear conditions. \$\endgroup\$ – Russell McMahon Jun 17 '13 at 1:39
  • 1
    \$\begingroup\$ @user25282 in fact, check out the LM339 datasheet I linked; figure 33 has a VCO with a triangle-wave output. Proof that you can have outputs other than high or low from the LM339. \$\endgroup\$ – Phil Frost Jun 17 '13 at 2:37
  • 1
    \$\begingroup\$ @sandos If it's a comparator with an open-collector output, then it's the opposite: it's good at pulling the gate down to ground, but pulling it up to Vcc requires going through the impedance of a pull-up resistor. An op-amp might be better, but not all op-amps are good at driving capacitve loads. But really the best solution for driving a MOSFET gate is a MOSFET gate driver IC. \$\endgroup\$ – Phil Frost Mar 11 '16 at 14:58
6
\$\begingroup\$

They are same if you operate the Differential amplifier in Saturation.. then it performs the function of Comparator.

But basically, the Differential Amplifier is an Amplifier which takes it to ANALOG DOMAIN

A comparator gives the comparison of Input Voltage against a Reference Voltage and gives either of the supply Vdd or Vss, this binary behavior takes it into DIGITAL DOMAIN .

\$\endgroup\$
  • 3
    \$\begingroup\$ Conceptually the same but not always interchangable as the comparator is optimized differently. \$\endgroup\$ – Scott Seidman Jun 16 '13 at 18:17
  • \$\begingroup\$ so... How does a comparator output only give out Vcc+ and Vcc- \$\endgroup\$ – user25282 Jun 16 '13 at 18:34
  • 1
    \$\begingroup\$ A comparator is optimized to recover fast from saturation of the output stage, which is good for speed. Most comparators have an open collector or open drain output stage, this eases building window comparators or easy OR'ing. \$\endgroup\$ – jippie Jun 16 '13 at 18:42
  • \$\begingroup\$ @user25282 +Vcc and -Vcc come into question if we are making a comparator using an amplifier (operational). When you make the gain very high (usually by using op-amp in open loop) the amplifier will quickly go into saturation even for the least of voltage-difference. \$\endgroup\$ – vvy Jun 16 '13 at 18:50
  • \$\begingroup\$ @vvy i see your point.. Since Aol is very high small changes will make it go to saturation.. but what about differential op. amp cirquitry.. Is it controlled by the resistors, it must be.. \$\endgroup\$ – user25282 Jun 16 '13 at 23:03
6
\$\begingroup\$

TI Application Report Op Amp and Comparators -- Don't Confuse Them!1 provides an informative comparison of op amps vs. comparators. Summarizing the points highlighted in the report:

  1. Comparators' outputs are sometimes an open collector/drain for digital operation. Multiple comparators' outputs can be tied together in order to form a NAND gate: enter image description here

    However, an op amp's output is always analog, intended for linear operation.

  2. Comparators are generally operated with an open loop, whereas op amps are generally operated with a closed loop. A comparator can be used with a closed loop to add hysteresis, though: enter image description here

    The hysteresis voltage is $$V_H = \frac{R_P}{R_P + R_H}$$

  3. An op amp can be used as a comparator when configured for an open loop, but this is not recommended:

    An op amp, being intended for closed-loop operation, is optimized for closed-loop applications. The results when an op amp is used open loop are unpredictable. No semiconductor manufacturer, including Texas Instruments, can or will assure the operation of an op amp used in an open-loop application. The analog output transistors used in op amps are designed for the output of analog waveforms, and therefore have large linear regions. The transistors will spend an inordinate amount of time in the linear region before saturation, making the rise and fall times lengthy.

    ...

    The design of an op-amp output stage is bad news for the designer who needs a comparator with fast response time. The transistors used for op-amp output stages are not switching transistors. They are linear devices, designed to output accurate representation of analog waveforms. When saturated, they may not only consume more power than expected, but they may also latch up. Recovery time may be very unpredictable. One batch of devices may recover in microseconds, another batch in 10’s of milliseconds. Recovery time is not specified, because it cannot be tested. Depending on the device, it may not recover at all. Runaway destruction of the output transistors is a distinct possibility in some rail-to-rail devices.

    "Op Amp and Comparators -- Don’t Confuse Them!", Bruce Carter, pp. 7-8

Overall, op amps are recommended for linear operation and comparators for voltage comparison. It is possible to use certain op amps as comparators with an open loop configuration, but performance in such a mode will be poor and/or unpredictable compared to a comparator. And some op amps may be destroyed when used in such a configuration.


1 Strangely, the document (literature ID SLOA067) cannot be found at the normal literature link (http://www-s.ti.com/sc/techlit/sloa067) nor by searching for the title or literature ID at TI's website, so I've linked to a copy of the document from another site.

\$\endgroup\$
1
\$\begingroup\$

In english:

A comparator returns a boolean/digital value: 0 if input A is higher than input B, 1 otherwise.

A differential op-amp outputs an analogue value: the difference between the inputs, multiplied by an op-amp-specific multiplier (the amplification).

In mathy:

A differential op-amp is like this function:

$$f(i_1, i_2) = | i_1 - i_2 | \cdot m$$

Where \$f\$ is the output function, \$i_1\$ and \$i_2\$ the outputs, and \$m\$ a op-amp specific multiplier.

A comparator is more like this:

$$f(i_1,i_2)=\begin{cases} 0, & i_1 < i_2, \\ 1, & i_1 \ge i_2 \end{cases}$$

\$\endgroup\$
  • \$\begingroup\$ Ahh... Comparator have always one input which is grounded.. So.. Aol(c-0) = +Vss AOl(-c-0)= -Vss \$\endgroup\$ – user25282 Jun 16 '13 at 18:37
  • 2
    \$\begingroup\$ @user25282 - There is NO reason what so ever to require that one input of a comparator be grounded. The inputs to the comparator will be usable at connections to voltage levels across the range of the Input Common Mode Voltage as specified in the data sheet. As a matter of point, comparators will often have their more negative power pins hooked to GND and if an input is then also connected to GND the comparator becomes next to useless for its "comparison" functionality. \$\endgroup\$ – Michael Karas Jun 16 '13 at 22:47
1
\$\begingroup\$

For practical systems design, you can use an op amp as a comparator if you don't need very high performance. However, since comparators tend to be designed to go into digital logic, it is easier to find logic compatible comparators (with an output of 0 or 5V, for example). Also, some op amps do weird things when they are allowed to saturate, since they are designed to be used in closed loop configurations. For example, they may be slow to recover, which is undesirable for most comparator applications.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.