Schmitt Trigger Tutorial: Hysteresis Thresholds, Noise Immunity & Relaxation Oscillators
Drop a noisy analog thermistor or mechanical switch signal into a plain single-threshold op-amp comparator and the output erupts into dozens of spurious chatter glitches every time the signal crosses the decision threshold. Adding controlled positive feedback converts an open-loop comparator into a Schmitt trigger—introducing two distinct switching thresholds separated by a dead-band hysteresis window. In this tutorial you will derive upper and lower trigger thresholds (V_UT and V_LT) for inverting Schmitt topologies, design switch debouncers and square-wave relaxation oscillators, and simulate full hysteresis loops in NodeSim.
1. Why Plain Comparators Chatter & How Hysteresis Fixes It
Consider monitoring an ambient light photodiode ramp rising slowly past 2.50 V with 20 mVpp power-supply noise riding on top. A bare comparator set cleanly at V_ref = 2.50 V triggers HIGH at 2.501 V, drops LOW milliseconds later when noise dips to 2.492 V, flips HIGH again at 2.504 V, and toggles dozens of false clock edges before the slow ramp climbs past 2.52 V.
Positive feedback solves this cleanly by making the switching threshold depend dynamically on the current output state. While Vout sits at +V_sat (HIGH), positive feedback pulls the non-inverting (+) reference threshold slightly higher to an Upper Threshold Voltage V_UT. Once Vin climbs past V_UT, the comparator snaps cleanly to −V_sat (LOW), which immediately shifts the reference threshold downward to a Lower Threshold Voltage V_LT. Any noise smaller than hysteresis width V_hys = V_UT − V_LT cannot pull the output backward.
Inverting Schmitt Trigger (Input on − terminal, R1/R2 divider from Vout to + terminal): Upper Threshold (Output currently +V_sat): V_UT = +V_sat × R1 / (R1 + R2) Lower Threshold (Output currently −V_sat): V_LT = −V_sat × R1 / (R1 + R2) Hysteresis Window: V_hys = V_UT − V_LT = (V_sat_high − V_sat_low) × R1 / (R1 + R2)
Using +/-12 V saturation rails with R1 = 10 kOhm and R2 = 100 kOhm establishes switching trip points near +1.09 V and -1.09 V (total hysteresis deadband ~2.18 V).
2. Inverting vs Non-Inverting Schmitt Topologies
Swapping which terminal receives Vin fundamentally changes how hysteresis behaves and which resistor node sets loop gain. In the inverting Schmitt trigger, Vin wires directly into the high-impedance inverting (−) terminal while R1 and R2 divide Vout back to the non-inverting (+) pin. This topology offers very clean, well-isolated high input impedance when you only need inverted digital output logic.
In the non-inverting Schmitt trigger, input Vin passes through input resistor R1 to the (+) pin while feedback resistor R2 closes from Vout back to the same (+) junction (inverting pin stays tied to reference V_ref). Here, positive feedback pushes input threshold symmetrically about V_ref = 0 V at ratio +/- (R1 / R2) * V_sat, making sure R1 never exceeds R2 unless rails exceed Vin swing.
- Dedicated Comparators vs General-Purpose Op-Amps: Real analog designers prefer true comparators (LM393, LM311, TLV3201) over general-purpose op-amps like LM741 when speed matters. Op-amps carry internal dominant compensation capacitors that slow slew edges to microseconds, whereas comparators snap cleanly in nanoseconds.
- Offset Reference Shifting: Running from a single +5 V supply? Tie the bottom of divider resistor R1 to a 2.5 V mid-rail reference rather than ground so V_UT and V_LT sit cleanly around 2.5 V +/- ΔV instead of trying to trip negative voltages.
3. Turning a Schmitt Trigger Into an RC Relaxation Oscillator
One of the neatest analog circuits you can build with zero crystals and zero dedicated 555 timer ICs requires just one Schmitt trigger op-amp plus one external RC branch. Wire feedback resistor Rf from Vout to the inverting (−) input charging grounded timing capacitor Cf, while keeping positive feedback divider R1/R2 wired to (+).
At power-up, if output starts HIGH at +V_sat, capacitor Cf charges exponentially upward toward +V_sat until voltage reaches V_UT. Instantly the comparator flips LOW to −V_sat, forcing Cf to discharge backward toward −V_sat until crossing V_LT—producing a continuous, rock-steady 50% duty-cycle square wave at the output and exponential triangle ramps across Cf.
Schmitt Feedback Fraction: β = R1 / (R1 + R2) Oscillation Period (Symmetric +/- Rails): T = 2 × Rf × Cf × ln((1 + β) / (1 − β)) Special Quick Rule (Pick R2 = 1.16 × R1 ⇒ β = 0.462): T ≈ 2 × Rf × Cf ⇒ f_osc ≈ 1 / (2 × Rf × Cf)
4. Observing Hysteresis & Oscillation Inside NodeSim
Click Simulate Live Circuit to launch NodeSim's pre-wired Schmitt trigger relaxation oscillator circuit. Run Transient (.tran) across 10 ms and inspect two probes simultaneously: watch the green op-amp output jump crisply between +V_sat and −V_sat rails whenever the blue capacitor ramp V(−) kisses V_UT or V_LT.
For an extra experiment, delete feedback timing cap Cf and drive pin (−) from a slow 50 Hz triangle/sine source summed with small 500 kHz high-frequency noise to witness firsthand how hysteresis ignores high-frequency noise spikes cleanly.
Reference Component Values & Bill of Materials
| Part / Designator | Nominal Value | Role in Circuit |
|---|---|---|
| U1 (Op-Amp / Comparator) | Universal Op-Amp | Driven in open-loop saturation between positive and negative supplies |
| R1 (Lower Pos-Feedback) | 10 kOhm | Sets positive feedback fraction β = R1 / (R1 + R2) determining V_UT/V_LT |
| R2 (Upper Pos-Feedback) | 22 kOhm | Feeds output rail fraction back to (+) input to lock hysteresis window |
| Rf (RC Timing Resistor) | 10 kOhm | Determines charge/discharge RC constant in oscillator configuration |
| Cf (Timing Capacitor) | 100 nF | Ramps between V_LT and V_UT generating oscillation period |
Expected Waveforms & Simulation Verification
| Probe / Node | Analysis Type | Expected Waveform | Engineering Check |
|---|---|---|---|
| Vout (Output Rail) | Transient (.tran) | +/-14 V crisp square wave | Switches state whenever capacitor node crosses V_UT or V_LT |
| V_cap (Inverting Pin) | Transient (.tran) | Exponential sawtooth bounded by V_LT and V_UT | Exact hysteresis band limits visible as upper and lower triangle peaks |
| V_plus (Threshold Pin) | Transient (.tran) | Stepped square wave at +/-V_UT | Visual proof of dynamic reference threshold jumping on output flip |
Troubleshooting Common SPICE & Bench Mistakes
Hands-On Lab Exercises in NodeSim
- Halve R1 while holding R2 constant in NodeSim and observe both hysteresis band shrinkage on V_cap and the immediate frequency increase.
- Double Cf from 100 nF to 200 nF and verify the square-wave oscillation period doubles cleanly.
- Disconnect Rf/Cf timing feedback and apply a 2 Vpp sine source on (−) to measure exact V_UT and V_LT trigger crossings directly on the time axis.
