Schmitt trigger (source code)

= Schmitt trigger
{c}

A <Schmitt trigger> is a threshold circuit with <hysteresis>: its switching level depends on its current output state. An input rising through an upper threshold causes one transition, whereas an input falling through a lower threshold causes the reverse transition. Between the thresholds, the circuit retains the state reached previously. This makes a <Schmitt trigger> useful for turning a slowly varying or noisy signal into clean transitions, rather than repeatedly switching whenever noise crosses a single reference level.<Inverting Comparator With Hysteresis Circuit by Texas Instruments>[SNOA997A, p. 1, Design Description; pp. 2–3, separate output-state equations]{ref}

A simple inverting implementation puts the signal on the negative input of an <electronic comparator>. Connect its positive input to output $V_o$ through a <resistor> $R_o$ and to a reference $V_r$ through a <resistor> $R_r$. Neglecting comparator input current, <Kirchhoff's current law> gives
$$
V_+=\frac{R_rV_o+R_oV_r}{R_o+R_r}=\alpha V_o+(1-\alpha)V_r,
\qquad \alpha=\frac{R_r}{R_o+R_r}.
$$
For ideal high and low output levels $V_H,V_L$, the input switches on a rise at $V_{\uparrow}=\alpha V_H+(1-\alpha)V_r$ and on a fall at $V_{\downarrow}=\alpha V_L+(1-\alpha)V_r$. Thus the separation of the switching thresholds is
$$
V_{\uparrow}-V_{\downarrow}=\alpha(V_H-V_L).
$$
The output feeds back so as to reinforce its new state: after a rising input makes the output low, the positive-input threshold falls too.

For illustrative values $R_o=90\,\mathrm{k\Omega}$, $R_r=10\,\mathrm{k\Omega}$, $V_r=2.5\,\mathrm V$, $V_H=5\,\mathrm V$ and $V_L=0$, the thresholds are $2.75\,\mathrm V$ and $2.25\,\mathrm V$. At an input of $2.50\,\mathrm V$, the output can be either high or low, depending on the preceding trajectory. These chosen numbers describe the ideal circuit above, not a particular device specification.

An <oscilloscope> demonstration applies a slow triangular input with a small ripple and records input and output together. Compare the rising and falling transition levels, and then reduce the threshold separation to see when the ripple produces additional transitions. In a real circuit, <input offset voltage>, <resistor> tolerances, output loading and any internal <hysteresis> change the thresholds. An open-drain output also requires a pull-up <resistor>; its load must be included in the feedback calculation.<Inverting Comparator With Hysteresis Circuit by Texas Instruments>[p. 1, Design Notes; pp. 2–3, pull-up and feedback network analysis]{ref}