In electronics, a comparator is a device which compares two voltages or currents and switches its output to indicate which is larger. More generally, the term is also used to refer to a device that compares two items of data. Output voltage will “switch” whenever the input voltage (at the inverting input) reaches the reference voltage Vref (at the non-inverting input). It is very useful for comparing signals and working with sensors
Simple comparator shown below:

Note that R2 and R1 form a voltage divider. Use a potentiometer in place of R2 for an adjustable reference voltage.
Comparator cicuits can be built with opamps, but there are also comparator ICs with large slew rates and short propagation delays – good for high speed switching.
A dedicated voltage comparator will generally be faster than a general-purpose op-amp pressed into service as a comparator. A dedicated voltage comparator may also contain additional features such as an accurate, internal voltage reference, an adjustable hysteresis and a clock gated input.
Tags: comparator, comparator tutorial, Electronics, lm339 circuits, voltage comparator, voltage comparator circuit, voltage comparator schematic, voltage comparator tutorial, why not just use comparator instead of opamp


