Design a non-inverting Schmitt trigger that uses positive feedback to obtain two switching thresholds (hysteresis). Adjust the resistors R1 and R2 and the saturation voltage to see the upper and lower thresholds, hysteresis width and noise margin update in real time, and find a comparator circuit that won't false-trigger on noise.
Parameters
Input resistor R1
kΩ
Resistor in series with the non-inverting input
Feedback resistor R2
kΩ
Positive-feedback resistor from output to the + input
Output saturation voltage ±V
V
Voltage the output saturates at when HIGH/LOW (±symmetric)
Input voltage V_in
V
Voltage currently applied to the circuit input
Results
—
Upper threshold V_TH+ (V)
—
Lower threshold V_TH− (V)
—
Hysteresis width (V)
—
Feedback ratio β = R1/R2
—
Noise margin (V)
—
Current output state
—
Noisy input and clean output — animation
Left: a noisy input waveform crossing the two thresholds. Right: the clean square-wave output that switches only at the thresholds. A single-threshold comparator would chatter here.
Upper and lower thresholds of a non-inverting Schmitt trigger. V_sat: output saturation voltage, R1: input resistor, R2: feedback resistor. The feedback ratio β = R1/R2 sets both thresholds.
The hysteresis width V_H is the upper threshold minus the lower threshold. The noise margin is half of it, V_H/2, and noise smaller than that cannot cause a false transition.
What is the Schmitt Trigger Simulator?
🙋
A "Schmitt trigger" is a kind of comparator, right? What makes it different from an ordinary comparator?
🎓
Good question. An ordinary comparator has just one threshold. The moment the input crosses that single point — from above to below, or below to above — the output flips. The idea is simple, but in real circuits it misbehaves badly.
🙋
Wait — what's wrong with having only one threshold?
🎓
It becomes a problem when the input carries noise or moves slowly. As the input drifts gradually past the threshold, the tiny wiggles of noise carry it back and forth across that one point many times. The output then "chatters" — what should be one clean switch becomes a burst of unwanted pulses. A light/dark sensor clicking on and off endlessly during dawn or dusk is the classic example.
🙋
I see. So how does a Schmitt trigger fix that?
🎓
It adds positive feedback. Feeding part of the output back to the non-inverting input makes the threshold itself depend on the current output state. So instead of one threshold there are two: to switch the output up the input must exceed the higher threshold V_TH+, and to switch it down it must fall below the lower threshold V_TH−. The gap between them is the hysteresis. Raise R1 with the slider on the left and you'll see the two thresholds spread wide apart.
🙋
Why does having two thresholds make it immune to noise?
🎓
Once it has switched, the input must travel all the way back to the other, more distant threshold before it can switch again. So any noise whose amplitude is smaller than the hysteresis width simply cannot cause a false transition. That "largest noise that cannot cause a false transition" is the noise margin, and it equals exactly half the hysteresis width. As a bonus, a slow, sloppy input edge also gets sharpened into a crisp, clean digital edge. That is why Schmitt triggers turn up everywhere — signal conditioning of sensor outputs, switch debouncing, the input stage of logic ICs, and relaxation oscillators.
Frequently Asked Questions
An ordinary comparator has a single threshold and its output switches the instant the input crosses that one point. If the input carries noise or moves slowly, it wanders back and forth across that threshold and the output chatters, producing a burst of unwanted pulses. A Schmitt trigger adds positive feedback to give it two thresholds: a higher one the input must exceed to switch the output up, and a lower one it must fall below to switch back down. The gap between them is the hysteresis, and any noise smaller than that width cannot cause a false transition.
For a non-inverting Schmitt trigger with input resistor R1 to the + terminal and feedback resistor R2 from the output, the upper threshold is V_TH+ = V_sat*(R1/R2) and the lower threshold is V_TH- = -V_sat*(R1/R2), where V_sat is the output saturation voltage. The hysteresis width is V_TH+ minus V_TH-, equal to 2*V_sat*(R1/R2). The larger the feedback ratio beta = R1/R2, the wider the two thresholds spread apart and the more noise-immune the circuit becomes.
Make the hysteresis width comfortably larger than the peak-to-peak amplitude of the noise expected on the input. As a rule of thumb, setting the hysteresis to two or three times the noise amplitude eliminates almost all false transitions. The noise margin is half the hysteresis width and represents the largest noise amplitude that cannot cause a false transition. However, too wide a band makes the circuit ignore genuine small-amplitude signals, so keep the width below the minimum amplitude of the signal you need to detect.
As noise-immune comparators they are widely used for threshold detection on sensor signals (light/dark sensors, temperature switches and the like). They also serve as signal conditioners that square up slow, sloppy edges into crisp digital edges, as switch debouncers, as the input stage of logic families (such as the 74HC14), and as the timing element of relaxation oscillators combined with an RC network. In every case the hysteresis prevents the false switching that a single-threshold device would suffer.
Real-World Applications
Threshold detection on sensor signals: Light/dark sensors (CdS cells or illuminance ICs), thermostats and proximity sensors convert an analog quantity that has crossed some level into a digital output. These signals change inherently slowly and carry noise, so a single-threshold comparator makes the output jitter wildly near the boundary. Adding hysteresis with a Schmitt trigger keeps a lamp from flickering on and off during the dim light of dawn or dusk — once it switches, it stays put.
Waveform shaping of slow, slew-limited signals: A signal that has travelled down a long cable, or one rounded off by a filter, has gentle rising and falling edges. Fed directly into a logic IC, it dwells near the threshold for too long, causing malfunction or shoot-through current. Passed through a Schmitt trigger, the gentle edges are reshaped into a crisp, clean square wave so the downstream digital circuit operates reliably. Schmitt-input inverters such as the 74HC14 are the standard part for this job.
Debouncing mechanical switches (chatter removal): Push-buttons and relay contacts bounce — at the moment of contact the metal rebounds and makes and breaks repeatedly for a few milliseconds. An RC filter slows the bounce down, and feeding its output through a Schmitt trigger turns one press into one clean edge. This is a common arrangement ahead of a microcontroller interrupt input or a counter.
Relaxation oscillators: If the output of a Schmitt trigger charges and discharges a capacitor through a resistor, and that capacitor voltage is fed back to the input, the capacitor voltage shuttles endlessly between the two thresholds and the circuit self-oscillates. The oscillation frequency is set by R, C and the hysteresis width, making it a widely used low-part-count clock source and the oscillator for PWM and buzzer drive.
Common Misconceptions and Pitfalls
The most common mistake is assuming "wider hysteresis is always better". Widening the band does increase the noise margin, but it also makes the circuit blind to genuine small-amplitude signals. A signal whose amplitude is smaller than the hysteresis width cannot switch the output, even if it is a correct signal. In design, take "two to three times the expected noise" as the upper guideline and always keep the width below the minimum amplitude of the signal you want to detect. Never forget that noise rejection and sensitivity are a trade-off.
Next, assuming the output saturation voltage V_sat equals the supply voltage. A real op-amp output does not swing all the way to the supply rails. With a general-purpose op-amp it stops one or two volts inside each rail, and the thresholds come out smaller than the calculated value accordingly. A rail-to-rail output op-amp narrows the gap, but there is still a voltage drop caused by load current. This tool lets you enter V_sat directly, so put in the actual output swing from the datasheet. If the comparator has an open-collector output, the pull-up voltage becomes the effective V_sat.
Finally, confusing the threshold formulas of the non-inverting and inverting types. This tool deals with the non-inverting Schmitt trigger (input through R1 to the + terminal, output fed back through R2), whose thresholds are V_sat*(R1/R2). In an inverting Schmitt trigger, where the input goes to the − terminal and a reference voltage is made by a divider, both the threshold formula and the handling of the centre voltage are different. Always confirm which configuration the schematic shows before applying a formula. Also, the thresholds are symmetric about the origin only when the output saturation voltage is symmetric in both polarities; in single-supply operation the reference setting offsets the thresholds.
How to Use
Set R1 (feedback resistor) and R2 (ground resistor) values in kΩ; the simulator calculates feedback ratio β = R1/(R1+R2)
Enter saturation voltage (typically ±12V or ±15V for op-amp rail limits)
Apply input voltage and observe upper threshold V_TH+ = V_sat × β and lower threshold V_TH− = −V_sat × β; hysteresis width equals V_TH+ − V_TH−
Monitor output state transitions: output switches HIGH when input crosses V_TH+ rising, and LOW when input crosses V_TH− falling
Worked Example
Design a non-inverting Schmitt trigger with R1=10kΩ, R2=20kΩ, V_sat=13V. Calculate: β=10/(10+20)=0.333, V_TH+=13×0.333=4.33V, V_TH−=−4.33V, hysteresis=8.66V. For 5V input ramp: output remains LOW until input exceeds +4.33V (switching HIGH), then stays HIGH until input falls below −4.33V. Noise margin of 4.33V prevents false triggering from 50mV noise spikes common in industrial sensors.
Practical Notes
Increase R1 relative to R2 to widen hysteresis (e.g., R1=47kΩ, R2=10kΩ gives β=0.825, wider thresholds for noisy 4–20mA transmitter signals)
Use V_sat matching your op-amp supply rails (LM358: ±15V typical, TL072: ±18V maximum) to avoid clipping and nonlinear response
For precision comparators (LT1016), reduce R1+R2 total below 100kΩ to minimize input bias current error (typ. 25nA)
Schmitt triggers in motor-control pre-drivers require hysteresis ≥100mV to prevent oscillation near switching threshold under PWM noise