EmbeddedRelated.com
Jacob Beningo
Live online course · Jacob Beningo
AI for Embedded Developers
$100 off for EmbeddedRelated readers until Nov 1 · 5 live sessions, Dec 7-11
Discount ends in
16days 04hrs 31min 54sec
Learn More →

Schmitt Trigger

Category: Electrical | Also known as: schmitt

A Schmitt trigger is a comparator circuit with hysteresis: it has two distinct switching thresholds, one for rising input signals and one for falling, so the output changes state only when the input clearly crosses each threshold. The gap between the two thresholds prevents rapid, repeated toggling (chatter or glitching) when a slow or noisy signal crosses the switching point.

In practice

Schmitt trigger inputs appear on many MCU GPIO pins, labeled in datasheets with the classic hysteresis symbol or noted as "Schmitt-trigger compatible." When a pin is configured with this input type, noisy or slowly-slewing signals such as those from mechanical switches, open-drain buses, or RC networks produce a clean digital transition instead of multiple spurious edges. On STM32 and similar ARM Cortex-M parts, GPIO input mode registers may let you select or enable a Schmitt-trigger input stage, though on many MCUs the Schmitt-trigger behavior is enabled by default and not software-selectable as a separate option -- always check the specific datasheet.

Discrete Schmitt trigger ICs -- the 74HC14 (hex inverting) and 74HC132 (quad NAND) among the most commonly used -- are frequently dropped into designs to condition signals before they reach a microcontroller. A resistor-capacitor network feeding a 74HC14 forms a simple debounce or delay circuit. This technique is covered in posts like "The Least Interesting Circuit in the World" and appears in keypad interface designs discussed in "Good old multiplexed keypad in an embedded system."

Hysteresis thresholds vary by family and supply voltage. A 74HC14 running at 5 V will have a positive-going threshold (V_T+) and a negative-going threshold (V_T-) that together give roughly 1 V or more of hysteresis, but exact values differ across vendors and should be read from the specific device datasheet. CMOS logic running at 3.3 V will generally have lower absolute thresholds, though the scaling is not strictly proportional and depends on the specific family. Always consult the specific datasheet rather than assuming thresholds from one family apply to another.

A common pitfall is assuming that a Schmitt trigger input alone is sufficient to debounce a mechanical switch for firmware purposes. The hysteresis eliminates glitches caused by slow edges, but a bouncing contact can still produce multiple clean edges that are far enough apart in time to be counted as separate presses. For robust switch debouncing, software timing (sampling over a settle window) or an RC filter plus Schmitt trigger is the more reliable approach, as explored in "Byte and Switch (Part 1)".

Frequently asked

What is hysteresis in a Schmitt trigger, and why does it matter?
Hysteresis means the switching threshold for a rising input (V_T+) is higher than the threshold for a falling input (V_T-). Once the output has switched high, the input must fall below V_T- (not just back below V_T+) before it switches low again. This dead band prevents noise riding on a signal near the threshold from causing the output to chatter between states.
Do I need an external Schmitt trigger IC if my MCU GPIO already has a Schmitt trigger input?
Not necessarily. Many MCUs, including STM32, nRF52, and SAM series parts, include a Schmitt trigger stage on GPIO inputs, which handles normally noisy digital signals. An external device like a 74HC14 becomes useful when the signal is very slow-slewing (e.g., from a large RC network), comes from a source that could drive the pin into a linear region for a long time, or when you need a specific, guaranteed hysteresis window that the MCU datasheet does not fully characterize.
Can a Schmitt trigger fully debounce a mechanical switch?
It helps, but it is usually not sufficient on its own. A Schmitt trigger cleans up slow or noisy edges, but mechanical contacts can bounce repeatedly with intervals of hundreds of microseconds to low milliseconds, producing multiple clean transitions that firmware still counts as separate events. A common solution is an RC filter (to slow and average the bounce) feeding a Schmitt trigger input, combined with a software settle-time check.
What is the difference between a Schmitt trigger and a plain comparator?
A plain comparator has a single threshold: any input above it produces one output state, any input below it produces the other. It has no hysteresis, so a noisy input hovering near the threshold causes the output to toggle rapidly. A Schmitt trigger adds positive feedback to create two thresholds, making it far more immune to noise around the switching point.
Which common logic ICs implement Schmitt trigger inputs?
The 74HC14 (hex inverting Schmitt trigger) and 74HC132 (quad 2-input NAND with Schmitt inputs) are widely used discrete options. Schmitt-trigger variants also exist within the 74HCT and 74AC families, though not every device in those families includes Schmitt inputs -- check individual part numbers. On the CMOS side, the CD40106 is a classic hex inverting Schmitt trigger that operates across a wider supply range (3 V to 15 V), making it useful in mixed-voltage or battery-powered designs.

Differentiators vs similar concepts

A Schmitt trigger is often confused with a plain comparator. Both compare an input voltage to a reference and produce a binary output, but a comparator has a single, fixed threshold with no hysteresis. A Schmitt trigger adds positive feedback to create two thresholds (V_T+ and V_T-), making it noise-immune near the switching point. Operationally, a comparator is preferred when you need to detect an exact voltage level with high precision; a Schmitt trigger is preferred when the input is noisy or slow-slewing and clean edge generation matters more than threshold precision. Some op-amp comparator circuits add external positive feedback to deliberately create Schmitt-trigger behavior.