Comparators
A comparator is an electronic circuit which takes two inputs, and outputs a signal which depends on which input has a higher voltage. One input is called the non-inverting input and the other input the inverting input. The output is 1
(HIGH
) if the non-inverting input voltage is higher than the inverting input, the output is 0
(LOW
) is the opposite is true.
This is the schematic symbol for a comparator, which is the same as the op-amp.
Comparators are commonly used as building-blocks in larger circuits. Comparators are a core component in voltage supervisor ICs.
Comparators vs. Op-Amps
So what are the differences between comparators and op-amps?
- Comparators are optimised for fast slew rate and propagation time.
- Op-amp’s are designed to have negative feedback to reduce the gain. Comparators can go unstable when negative feedback is added.
Op-amps can be used as low-performance comparators, but comparators cannot usually be used as low-performance op-amps (they are typically unstable under negative feedback).
Gain
Comparators have a very high open-loop gain.
Types
There are push-pull and open-drain comparators.
Voltage References
Usually you want some kind of stable voltage reference to feed into one of the comparators input pin, the other pin being fed the signal you want to compare to the reference. Some comparators come with built-in voltage references, which can be directly hooked up to the input pin of your choosing.
Hysteresis
Hysteresis is essentially caused by positive feedback. Many comparators have a small, built in hysteresis (internal hysteresis). External hysteresis can be added if additional noise is to be expected, or to stop the output from switching so quickly (e.g. thermostat controls).
The following diagram shows how hysteresis effects the outputs state changes (from low to high and back again) in regards to the input, for a non-inverting comparator configuration.
Push-Pull Output Comparators
Non-Inverting Configuration
The following diagram shows a non-inverting comparator with hystersis resistors added.
Firstly, determine the amount of hysteresis you want (). Then use the following equation to work out the ratio between the feedback and input resistor.
Next, you need to determine an appropriate value for one of them, and then calculate the other resistance value. One way to determine is to set a quiescent current limit, say 100uA.
Inverting Configuration
Nothing here yet…
Open-Drain Output Comparators
Open-drain output comparators require an extra pull-up resistor on the output (when compared to push-pull output comparators) to enable hysteresis. This resistor, along with the feedback resistor, will create a voltage divider and introduce some error when the output is high. To keep this error small, it is recommended that .
PCB Surface Leakage
When keeping the input bias current low is important, sometimes you have to consider the effects of PCB surface leakage. The resistance between two PCB traces in close proximity is about 1012 in low humidity conditions. If the two comparators inputs have a 5V difference, this surface leakage allows 5pA to flow, which can be much more than the input bias current of some comparators (e.g. 1pA). Guard rings can be added to prevent leakage currents.