EN

Schmitt trigger and hysteresis

Rising and falling thresholds so that a slow or noisy signal does not make the output oscillate

Calculator

Comparator with hysteresis
V
V
V
kΩ
% of VCC

Hysteresis loop

Slow noisy signal

A comparator or op amp with rail-to-rail output (0 V and VCC) is assumed. With an open-collector comparator such as the LM393, the output pull-up resistor adds to the feedback resistor; choose it at least ten times smaller. E24 series resistors.

The problem: a single threshold

A simple comparator changes its output every time the input crosses a threshold. If the signal rises slowly or carries noise, near the threshold it crosses it several times in a row and the output gives a burst of pulses instead of a single change. A thermostat would switch the relay on and off endlessly; a counter would count false pulses. The simulation shows it with the red trace.

The solution: hysteresis

A Schmitt trigger has two thresholds: the output changes when the input rises above the upper one (VT+) and does not change back until it falls below the lower one (VT−). The difference between them is the hysteresis. As long as the noise is smaller than the hysteresis, the output changes only once. It is achieved with positive feedback: a resistor from the output to the + input shifts the threshold in the direction that reinforces the change.

\[ V_{T+} = V_{ref}\left(1 + \frac{R_1}{R_2}\right) \]
\[ V_{T-} = V_{T+} - V_{CC}\,\frac{R_1}{R_2} \]
\[ \Delta V = V_{T+} - V_{T-} = V_{CC}\,\frac{R_1}{R_2} \]

These are the equations of the non-inverting configuration with output from 0 to VCC. In the inverting one, the input goes to the − pin and the thresholds are set by a divider on the + pin with a third resistor from the output; the calculator solves both configurations.

How much hysteresis

Integrated Schmitt triggers

It does not always need to be built: the 74HC14 (six inverters) and the 74HC132 (four NANDs) have built-in hysteresis. At 5 V they switch at roughly 2.7 V rising and 1.6 V falling, although exact values vary between manufacturers. With a resistor and a capacitor, a 74HC14 inverter also makes a very simple oscillator and a good push-button debouncer. Almost all digital inputs of modern microcontrollers also have a small Schmitt trigger.

Related: 555 timer (it uses two comparators with thresholds at 1/3 and 2/3), push-button debouncing, 24 V inputs to a microcontroller and reading NTC sensors.