Stop comparator chatter by designing two switching thresholds

A slowly changing sensor signal can cross the same comparator threshold several times because of noise. The output then produces several transitions where the application expected one. This is especially noticeable when the input pauses close to the switching point.

Hysteresis gives the circuit two thresholds: one for a rising input and another for a falling input. Between them, the output retains its previous state. TI’s inverting-comparator design guide describes this approach using positive feedback.

Start with the desired behaviour

Before selecting resistors, write down what should happen in each direction. In this illustrative example:

  • A rising input should switch the output from HIGH to LOW near 2.7 V.
  • A falling input should switch it from LOW to HIGH near 2.3 V.
  • Small input changes between those levels should leave the existing state unchanged.

This is an inverting comparator: the signal enters the minus input. A stable reference and positive feedback from the output set the voltage at the plus input.

Calculate the threshold in both output states

Use a resistor Rref from a low-impedance reference to the plus input and a resistor Rfb from the output to that same node. Neglecting input current, the threshold follows from the two resistor currents:

Vthreshold = (Vref × Rfb + Vout × Rref) / (Rref + Rfb)

For a worked example, choose Vref = 2.5 V, Rref = 100 kΩ and Rfb = 1 MΩ. Assume an ideal push-pull output with HIGH = 5 V and LOW = 0 V.

Existing ouput state Threshold at the plus input Next transition
HIGH, 5 V (2.5 * 1000 + 5 * 100) / 1100 = 2.727 V Rising input above this level drives output LOW
LOW, 0 V (2.5 * 1000 + 0 * 100) / 1100 = 2.273 V Falling input below this level drives output HIGH

The calculated hysteresis width is approximately 455 mV. The feedback changes the threshold immediately after each transition, so a small reversal in the input no longer crosses the switching level again.

These are ideal calculations, not measured results or resistor values taken from a team board.

Replace ideal assumptions with datasheet limits

Use the actual output-high and output-low voltages at the relevant load, then account for reference accuracy, resistor tolerances, input offset and bias current. Check the comparator’s permitted input common-mode range. An open-drain output needs a pull-up; its interaction with the feedback network must be included rather than assuming the unloaded pull-up voltage. TI discusses output-stage effects in Comparators - what’s all the chatter?.

Select the hysteresis width from the noise and threshold-accuracy requirements. Excessive hysteresis can make the circuit miss a legitimate change. If the input starts inside the hysteresis band, do not assume a defined initial output unless the selected device or additional circuitry guarantees it.

Check layout and test both directions

Keep the threshold node and feedback connection compact, provide supply decoupling as specified, and keep unrelated switching signals away from the threshold input. Avoid casually adding a capacitor at the positive-feedback node: delaying its voltage change can undermine the intended behaviour. TI’s comparator-chatter guidance discusses this pitfall.

Apply a slow rising and falling ramp and record both switching voltages. Repeat near the thresholds with a controlled small disturbance, and check startup at inputs below, above and inside the band. Compare those observations with the tolerance range calculated for the design.

The useful habit: specify, calculate and test both switching thresholds. A single nominal trip voltage does not describe a circuit with hysteresis.