Op-amp Comparator
A comparator, in electronics, is a circuit configuration that compares two voltages (or currents) and indicates which one is larger. Thus, the inputs to a comparator should be different in nature. Comparators can be easily configured using op-amps, since the op-amps have high gain and balanced difference inputs.
Theoretically, an op-amp in open-loop configuration (no feedback) can be used as a comparator. When the input voltage at the non-inverting terminal V+ is greater than the voltage at the inverting input terminal V–, the output of the op-amp saturates at its positive extreme. When the non-inverting input voltage drops below the inverting input voltage, the op-amp output switches to its negative saturation level. Comparator circuits are most widely used in analog-to-digital converters (ADCs) and in oscillators.
Op-amp Inverting Comparator
In an inverting comparator, the input voltage Vin is applied to the inverting input terminal of the op-amp and the non-inverting input terminal is connected to reference voltage, through resistors R1 and R2. As long as the input voltage Vin is lesser than the reference voltage Vref, the output of the op-amp remains positively saturated. When Vin goes above the reference voltage, the output of the op-amp switches to its negative saturation level and remains negatively saturated as long as Vin is less than Vref. The circuit of a comparator using op-amp is shown in the figure below
By choosing the values of resistors R1 and R2, the reference voltage Vref can be adjusted and comparator can be used to compare input voltage with the corresponding reference voltage.
Op-amp Non-Inverting Comparator
In the case of an op-amp non-inverting comparator, the input voltage Vin is applied to the non-inverting input terminal and the reference voltage, Vref, is connected to the inverting input terminal. When the input voltage Vin is greater than the reference voltage Vref, the op-amp output is positively saturated. In practice, the difference (Vin-Vref) will be a positive value. Since there is no feedback to the op-amp input, the open-loop gain of the op-amp will be infinity. Hence the output will swing to its maximum possible value, +Vsat. When the input voltage falls below the reference voltage, the output switches to its negative saturation voltage.