Electronic comparator (source code)

= Electronic comparator

An <electronic comparator> is an <electrical circuit> that converts the ordering of two input <electric potential differences> into an output state. For the usual non-inverting convention, the output is high when $V_+>V_-$ and low when $V_+<V_-$. Unlike a linear <amplifier>, an <electronic comparator> deliberately makes a threshold decision; its output does not report how large the input difference is. A sensor signal can therefore become a pulse marking the instant it crosses a reference.

Real threshold decisions have an <input offset voltage> and a finite <propagation delay>. The permitted input range and the output drive also matter: an open-drain output needs a pull-up <resistor>, whereas a push-pull output drives both states. The manufacturer’s inverting example explicitly includes the pull-up <resistor> and explains how <input offset voltage>, <resistor> tolerances and internal <hysteresis> affect the thresholds.<Inverting Comparator With Hysteresis Circuit by Texas Instruments>[SNOA997A, p. 1, Design Description and Design Notes; p. 5, output types]{ref}

With a single threshold, a slowly varying input plus electrical noise can cause repeated transitions. A <Schmitt trigger> adds <hysteresis>: the threshold depends on the existing output state. For an illustrative non-inverting design, suppose the output switches high on a rise through $2.55\,\mathrm V$ and low on a fall through $2.45\,\mathrm V$. At $2.50\,\mathrm V$, either output is possible, depending on the preceding input. The $0.10\,\mathrm V$ interval is deliberate memory of the last state, rather than an ambiguous instantaneous comparison. Positive feedback can produce this behavior; the cited design derives the two thresholds from the feedback <resistor> network.<Inverting Comparator With Hysteresis Circuit by Texas Instruments>[pp. 2–3, separate high-output and low-output threshold equations]{ref}

A useful bench demonstration applies a slow triangular input with a small superposed ripple and displays both input and output on an <oscilloscope>. Record the rising and falling switching levels separately. Repeated transitions near one level demonstrate noise sensitivity; distinct rising and falling levels demonstrate <hysteresis>. The time between an input crossing and the output transition measures <propagation delay>, a different quantity from the separation between the two thresholds.