Skip to content

Electronics

Comparator hysteresis and the Schmitt trigger

A Schmitt trigger is a comparator with hysteresis: instead of one threshold, it has two. The output flips one way when the input passes the upper threshold, and back only when it falls below the lower one. A resistor from the output to the + input sets the gap, and any noise smaller than that gap can no longer make the output chatter.

The chatter problem

A plain comparator flips the moment its input crosses the reference. Real signals wobble. When a room sits right at a thermostat's set point, every tiny wobble crosses the line and the heater clicks on and off, again and again. A slow, noisy light sensor does the same at dusk.

A light switch doesn't chatter: push it gently and nothing happens; push it past the middle and it snaps all the way over, and stays there until you push it well back.

Live experiment

Stop the chatter

A thermostat's comparator watches a noisy sensor as the room cools and warms once. With one threshold, the heater chatters on and off. Slide in a feedback resistor, from 1 MΩ down to 22 kΩ, and watch the band widen until it flips just twice.

Try it yourself: free lesson

“Comparators with hysteresis” is lesson 2 of 6 in Amplifier Peaks, Electronics World 6. Free with an account. Lessons unlock in order, so you’ll do the 36 before it first.

Positive feedback

Add Rf from the output back to the + input, where the reference divider connects. When the output swings high, it pulls the + input up a little; when it swings low, it pulls it down. So the moment the output flips, the threshold jumps away from the input, and the output stays flipped. Feedback that helps the change along is positive feedback.

The reference divider acts like Vth behind Rth = R1 ∥ R2, its Thevenin equivalent. Rth and Rf then form a second divider from the output, which sets the gap between the thresholds, the band:

ΔV ≈ Vswing × Rth over Rth + Rf

Vswing is how far the output jumps when it flips: 5 V for a rail-to-rail output on 0 and 5 V.

A worked example

A rail-to-rail comparator on 5 V, a 10 kΩ / 10 kΩ reference (2.5 V behind Rth = 5 kΩ) and Rf = 100 kΩ:

ΔV = 5 V × 5 kΩ over 105 kΩ ≈ 0.24 V

The thresholds sit at about 2.38 V and 2.62 V. To design a band, turn it round:

Rf = Rth × (Vswing over ΔV − 1)

Make the band wider than the noise, but not wider than the swing your signal really makes, or it never switches at all.

Where you'll meet it

Fridges and heating thermostats switch on and off at different temperatures, so they don't buzz. A car battery charger might start below 12.4 V but stop only at 14.4 V. Microcontroller pins and logic chips like the 74HC14 have Schmitt triggers built in, which helps clean up slow or noisy edges.

Free lesson

Now build it yourself

Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.

Try it yourself: free lesson

“Comparators with hysteresis” is lesson 2 of 6 in Amplifier Peaks, Electronics World 6. Free with an account. Lessons unlock in order, so you’ll do the 36 before it first.

Or start from the very first lesson, no account needed

Practice questions

Three quick questions from the lessons. Pick an answer to check it.

  1. Question 1 of 3Feeding an op-amp's output back to its + input gives…
    Show the answer

    Answer: positive feedback. Back to + is positive feedback: it helps the output along, so it snaps to a limit, as in a Schmitt trigger. Back to − is negative feedback, which holds it steady.

    • Why not “no feedback”? Any path from the output back to an input is feedback. To the + input, it's the kind that helps the change.
    • Why not “negative feedback”? Negative feedback goes back to the − input and holds the output steady, as in a follower or an amplifier.
  2. Question 2 of 3In a Schmitt trigger, positive feedback gives two thresholds. In a latch it gives…
    Show the answer

    Answer: memory. Positive feedback pushes a circuit into one of two stable states and holds it there. In a Schmitt trigger that's the snap between thresholds. In a latch it's memory.

    • Why not “filtering”? Filtering needs parts that depend on frequency, like capacitors. Positive feedback gives two stable states instead.
    • Why not “amplification”? Positive feedback doesn't make a steady, proportional gain. It pushes the circuit to one of two stable states.
  3. Question 3 of 3Two thresholds with a gap between them…
    Show the answer

    Answer: Stop a wobbly reading flipping the output. Hysteresis.

    • Why not “Make it brighter”? Hysteresis decides when the output switches, not how bright anything is.
    • Why not “Count presses”? Two thresholds stop a wobbly reading flipping the output. Counting presses is a different job.
    • Why not “Make it faster”? Hysteresis doesn't speed anything up. It makes the output wait until the input has clearly moved.
Keep practising: free lesson

“Comparators with hysteresis” is lesson 2 of 6 in Amplifier Peaks, Electronics World 6. Free with an account. Lessons unlock in order, so you’ll do the 36 before it first.

Questions people ask

What is a Schmitt trigger?

A comparator with hysteresis: two thresholds instead of one. The output switches one way when the input crosses the upper threshold and back only when it crosses the lower one. Noise smaller than the gap can't make it flip back and forth.

How do you add hysteresis to a comparator?

Add a resistor R_f from the output to the + input, where the reference divider connects. When the output flips, it drags the + input a little with it, moving the threshold away from the input. Bigger R_f, narrower band.

How do I calculate the hysteresis band?

ΔV ≈ V_swing × R_th ÷ (R_th + R_f), where V_swing is how far the output jumps and R_th is the reference divider's resistance, R1 ∥ R2. To design, R_f = R_th × (V_swing ÷ ΔV − 1).

Is hysteresis a time delay?

No. It's two thresholds, not a timer. Hold the input anywhere between them and the output keeps whatever state it was in, however long you wait. That's a kind of memory.

Every topic