Comparators are simple devices used to differentiate between 2 different signal levels. But a little noise variation on the input signals can cause the comparator to become unstable. The output level may briefly bounce and forth. Adding hysteresis is the easiest way to resolve this problem.
Hysteresis is a form of positive feedback which can create two distinct threshold levels. When designing a comparator circuit with external hysteresis, the amount of hysteresis should be greater than the maximum peak-to-peak noise you expect in the system.
Below example is the typical hysteresis circuit for the TI TLV3201 comparator. The resistor Rh sets the hysteresis level.
- When the output is at a logic high (5V), Rh is in parallel with Rx. This drives more current into Ry, raising the threshold voltage (VH) to 2.7V. The input signal will have to drive above VH=2.7V to cause the output to transition to logic low (0V).
- When the output is at logic low (0V), Rh is in parallel with Ry. This reduces the current into Ry, reducing the threshold voltage to 2.3V. The input signal will have to drive below VL=2.3V to cause the output to transition to logic high (5V)
For more technical information about comparators, please refer to: