In Electrical Engineering, a Schmitt trigger is a comparator or inverter with hysteresis. It will convert a "dirty" analog signal to a nice clean digital signal.

Details:

A comparator takes any input and digitizes it: for say a 4 V upper rail, any input voltage below 2 V is output as 0 V and any input voltage above 2 V is output as 4V. An inverter inverts the input: any input voltage below 2 V is output as 4 V and any input voltage above 2 V is output as 0 V.

Now, an analog signal (such as a sine wave) will have noise - that is, many small oscillations. With a simple comparator, the output will fluctuate as the input passes the midpoint. Imagine a noisy sine wave as it crosses the 2 V threshold: 1.94 V, 1.97 V, 1.95 V, 1.98 V, 2.01 V, 1.99 V, 2.02 V, etc. The signal is in fact trending upward, but the noise causes glitches in the output.

The Schmitt trigger introduces hysteresis. Instead of having one threshold, there are two: one going up and one going down. Say we set the triggers to 1.5 V and 2.5 V. Then the inverter will not go low on a rising input signal until it reaches 2.5 V, and will not go high until the input signal becomes less than 1.5 V. While the input is in between 1.5 V and 2.5 V, the output is not changed.

Logically, this is implemented as an additional weak inverter in the "other" direction across the main inverter.

```    (strong)
|\      |\
in --| \o-+--| \o-+--  out
| /  |  | /  |
|/   |  |/   |
|       |
|   /|  |
\-o/ |--/
\ |
\| (weak)

```

Here is the CMOS diagram:

```                           __________
_____________/_______   |
_|     |_     /       _|  |
/--o||_       _||o-/   /-o||_   |
in _|      |_____|________|      |__|___ out
|     _|     |_       |     _|  |
\---||_       _||--\   \--||_   |
|_____|______\________|  |
\__________|
```