Skip to content

Comparators

What It Does

Comparators compare two input voltages to see which one is higher, or lower.

Basic comparator

A comparator compares the voltages on its inputs and depending on which line is higher it will go to one of the power voltages (V- or V+). You can use op-amps as comparators or dedicated comparator-IC's for this.

Formula

  • Vout = V+ when Vin > |Vref|
  • Vout = V- when Vin < |Vref|
  • This building block compares the input signal with 0V (Vref = 0V).
  • Notice I powered an op-amp with +12V and -12V (edit component in simulation), and thus the Vout signal will also go to one of these values.
  • If the input signal > 0V the output = +12V.
  • If the input signal < 0V the output - 12V.

Inverting comparator

This configuration has inverted output logic.

Formula

  • Vout = V+ when Vin < |Vref|
  • Vout = V- when Vin > |Vref|
  • This building block compares the input signal with 0V.
  • Notice I powered the op-amp with +12V and -12V.
  • If the input signal < 0V the output = +12V.
  • If the input signal > 0V the output - 12V.

Variable comparator

Previous examples compared the signal with a fixed reference (0V), but you can have any voltage level, even variable ones.

What if the two input levels are the same?

If the input levels are the same, small amounts of noise can change the output level rapidly. See for a solution: Schmitt Triggers.