This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can an operational amplifier be used as a comparator?

Other Parts Discussed in Thread: LM339, LM358, LM324, LP324

Hi,

As you know,sometimes we use an operational amplifier as a comparator.

Can we always use it like this? What problems will we meet in different applications?

Thanks!

  • Hi,
    You can use an op amp as a comparator. But , it is advisable that you don't.

    It is so because they are designed differently. Comparators are designed to be used in open loops, can switch fast even when overdriven to saturation. Op amps are designed to be used in closed loops, when overdriven to saturation it can take a comparatively long time to come out of saturation. Hence, don't use op amps as comparators for high speed applications.

    Also, op amps may not be designed to withstand high differential input voltage, as they are typically used with negative feedback which tends to reduce the differential input voltage.
  • No, Not for high speed applications.
  • Thanks  for jumping in their to help! Much appreciated :)

  • Also see Bruce Trumps blog:

    e2e.ti.com/.../op-amps-used-as-comparators-is-it-okay

    In general, we try to discourage the practice, but if you have an unused op-amp channel and the application is simple, it is usually okay. Verify that the differential input range is wide enough. This is usually stated in the Abs Max table. If it says somewhere between ±0.3V to ±2V, then it has clamps.

    Op-amps will also be slower than a comparator of equal supply current, since comparators do not contain the internal compensation that a op-amp has. There may also be saturation recovery time, too, since the op-amp input stage is not designed for large differential voltages.

    Another warning is that the op-amp has a "linear" output, meaning the op amp output is designed to go anywhere between "0" and "1". As the input voltage difference gets close to the offset voltage, the op-amp output can "wander" somewhere between 1 and 0. The op amp output does not have the "snap" that comparator outputs have (1 or 0).

    If you do use an op-amp as a comparator, it would be a good idea to add hysteresis (positive feedback). See AN-74 for more info.

    Regards,
  • Dear all,

    Thanks very much.

  • If you compare the LM358 (opamp) and LM339 (comparator) internal schematics you will see they are essentially the same, with a few minor tweaks, (like the pullup output stage is missing in the 339)
    I use a LM324 to make a latching window comparator, but you do need to be a bit careful (it's also very slow).
    Also note that almost all of the (CMOS) 5v opamps have back to back diodes across the input, so you need to use series resistors on the inputs to use them as comparators (or use a high impedance reference source, like a pair of 10k resistors to split the 5v rail) If you share the same reference between multiple <opamps pretending to be comparators> then odd things will happen as the inputs to one opamp will drag the other inputs around.
    Note that it is very difficult to find 15v comparators with push-pull outputs.
    You should try to avoid rail-rail inputs with dual or quad <opamps pretending to be comparators> as they usually have a common biasing stage, and you can mess up the bias on the other channels.
    There are some benefits to using <opamps pretending to be comparators> , for example if using a LP324 to drive the gate of a MOSFET, the inherent slewrate limit of the opamp soft-switches the MOSFET and minimises EMI.
    Also note that (RS232, RS422 etc) line drivers and receivers can be used as (low accuracy) comparators.
  • Thanks  for the additional input! Greatly appreciated.