An op amp Schmitt trigger circuit adds positive feedback to a comparator, creating hysteresis—two distinct switching thresholds—to eliminate output chatter caused by input noise. For a standard 5V logic interface requiring a 2.5V nominal trip point and a ~480mV hysteresis window, use an LM393 open-collector comparator with a 10kΩ pull-up resistor, a 100kΩ feedback resistor (R2), and a 10kΩ input resistor (R1). This configuration guarantees clean digital edges even when the input signal is riding on tens of millivolts of switching noise.
The Core Topology: Why Hysteresis Beats a Standard Comparator
A standard comparator without hysteresis operates with a single threshold voltage. If your input signal hovers near that threshold, even 5mV of electromagnetic interference (EMI) or thermal noise will cause the output to oscillate wildly between high and low states. This "chatter" can crash microcontrollers or fry MOSFET gates through rapid switching losses.
The Schmitt trigger solves this by introducing positive feedback, creating a deadband (hysteresis) where the output state is locked regardless of minor input fluctuations. We use the non-inverting topology for most sensor interfaces because it preserves the signal phase (a rising input yields a rising output), which is critical when feeding active-high logic pins on an ESP32 or Arduino.
Topology Node Labels
- Node A ($V_+$): The non-inverting input. This is the summing junction where the input signal ($V_{IN}$) meets the positive feedback from the output.
- Node B ($V_-$): The inverting input. Tied directly to a stable reference voltage ($V_{REF}$).
- $V_{OUT}$: The digital output node, pulled up to $V_{CC}$ via a resistor.
- R1: Input resistor connecting $V_{IN}$ to Node A.
- R2: Feedback resistor connecting $V_{OUT}$ to Node A.
Design Walkthrough: Sizing Real Component Values
Let’s design a circuit for a 5V system. We want the output to switch HIGH when the input rises above ~2.73V, and switch LOW only when the input falls below ~2.25V. This gives us a 480mV hysteresis band centered around 2.5V.
1. Select the IC and Pull-up
We will use the LM393. It is a dual comparator with an open-collector output, meaning it can only sink current to ground; it cannot source current. Therefore, we must add a pull-up resistor. A 10kΩ pull-up to 5V limits the sink current to 0.5mA, keeping power dissipation low while providing a fast enough rise time for signals under 50kHz.
2. Calculate the Feedback Network (R1 and R2)
The hysteresis width ($\Delta V$) is determined by the ratio of R1 to R2 and the output voltage swing. For the LM393, the output high ($V_{OH}$) is 5V (via the pull-up), and the output low ($V_{OL}$) is approximately 0.2V (the internal transistor saturation voltage).
Let’s pick standard E12 values: R1 = 10kΩ and R2 = 100kΩ. The ratio $R1/R2$ is 0.1.
The threshold equations for the non-inverting topology are:
- $V_{TH\_HIGH} = V_{REF} \times (1 + \frac{R1}{R2}) - V_{OL} \times (\frac{R1}{R2})$
- $V_{TH\_LOW} = V_{REF} \times (1 + \frac{R1}{R2}) - V_{OH} \times (\frac{R1}{R2})$
Plugging in our values with $V_{REF} = 2.5V$:
- $V_{TH\_HIGH} = 2.5 \times (1.1) - 0.2 \times (0.1) = 2.75 - 0.02 = 2.73V$
- $V_{TH\_LOW} = 2.5 \times (1.1) - 5.0 \times (0.1) = 2.75 - 0.50 = 2.25V$
This yields a hysteresis band of exactly 480mV. To generate the 2.5V $V_{REF}$ at Node B, use a simple voltage divider with two 10kΩ resistors from 5V to GND, bypassed with a 100nF ceramic capacitor to filter out high-frequency rail noise.
Behavior Matrix: Component Drift and Failure Modes
Understanding what breaks when a component fails is critical for troubleshooting on the bench or designing for industrial reliability. Here is how the circuit reacts to extreme faults.
| Component | Failure Mode | Circuit Behavior & Symptom |
|---|---|---|
| R2 (Feedback) | Open Circuit | Positive feedback loop breaks. Hysteresis drops to 0V. The circuit reverts to a standard comparator and output chatter returns immediately in the presence of noise. |
| R2 (Feedback) | Short Circuit | Node A ($V_+$) is hard-tied to $V_{OUT}$. If output is HIGH, $V_+$ is 5V, which is > $V_{REF}$ (2.5V). The output locks HIGH permanently and will not switch back. |
| R1 (Input) | Open Circuit | Node A is pulled entirely to $V_{OUT}$ via R2. The input signal is completely ignored; output locks to its current state. |
| 10kΩ Pull-up | Open Circuit | The LM393 open-collector output floats when HIGH. The microcontroller GPIO pin will read random noise or float to an indeterminate voltage, causing phantom interrupts. |
| $V_{REF}$ Divider | Short to GND | $V_{REF}$ drops to 0V. Both thresholds collapse toward 0V. The circuit triggers HIGH on any positive noise spike and rarely switches LOW. |
Decision Path: Choosing Your Comparator IC
Do not blindly default to a general-purpose op-amp like the LM358 for comparator duties. Op-amps are designed for linear operation; when driven into saturation, they suffer from slow recovery times (often tens of microseconds) and phase reversal issues. Use a dedicated comparator. Follow this decision tree to select the right silicon.
| Application Requirement | Recommended IC | Key Specification |
|---|---|---|
| Cost-sensitive, <50kHz, 5V-36V rails | LM393 | Open-collector, ~$0.15, 1.3µs response time |
| High-speed (>100kHz), direct CMOS drive | TLV3201 | Push-pull output, 40ns propagation delay |
| Battery-powered IoT, ultra-low quiescent current | TLV3691 | Push-pull, 75nA quiescent current, 1.8V-5.5V |
| High-voltage industrial (up to 40V rails) | LM2901 | Quad open-collector, automotive grade available |
The Default Pick: If your project does not have a strict requirement for sub-microsecond switching speeds or nano-amp sleep currents, terminate your search and use the LM393. It is universally available, forgiving on breadboards, and its open-collector architecture allows you to easily shift logic levels (e.g., pulling up to 3.3V for an ESP32 while running the comparator on a 12V rail).
Breadboard Testing: Step-by-Step Verification
Before soldering, validate the hysteresis band on a breadboard. You will need a dual-channel oscilloscope, a function generator, and a multimeter.
- Wire Power and Pull-up: Insert the LM393. Connect Pin 8 to 5V and Pin 4 to GND. Wire the 10kΩ pull-up resistor from Pin 7 (Output 1) to 5V.
- Establish $V_{REF}$: Build the 10kΩ/10kΩ divider to generate 2.5V. Connect this to Pin 6 (Inverting Input 1). Measure with your multimeter to confirm 2.50V ±10mV.
- Wire the Feedback Network: Connect R1 (10kΩ) from your function generator output to Pin 5 (Non-inverting Input 1). Connect R2 (100kΩ) from Pin 7 (Output) back to Pin 5.
- Inject the Test Signal: Set your function generator to a 10Hz triangle wave, 0V to 5V amplitude, with a 0V DC offset. This slow ramp allows you to clearly see the switching points without scope aliasing.
- Probe and Measure: Connect Scope Channel 1 to the input signal (Pin 5 side of R1) and Channel 2 to the output (Pin 7). Trigger on the rising edge of Channel 2.
- Verify the Deadband: Use the scope cursors. Measure the input voltage (Channel 1) exactly at the moment Channel 2 transitions HIGH. It should read ~2.73V. Move the cursor to the falling edge; Channel 1 should read ~2.25V. If the gap is narrower than 400mV, check R2 for poor breadboard contact.
By strictly sizing the feedback ratio and respecting the open-collector architecture, you transform a noisy, unpredictable analog signal into a rock-solid digital logic stream. For further reading on comparator propagation delays and hysteresis math, refer to the Texas Instruments LM393 Datasheet and the Analog Devices guide on choosing comparators.






