What is a Schmitt Trigger?
A Schmitt trigger is a comparator (not exclusively) circuit that makes use of positive feedback (small changes in the input lead to large changes in the output in the same phase) to implement hysteresis (a fancy word for delayed action) and is used to remove noise from an analog signal while converting it to a digital one.
It was invented way back in 1937 by Otto H. Schmitt (whose legacy is somewhat understated) who called it a ‘thermionic trigger’.
Why Schmitt Triggers?
Comparators by nature are very fast, since they lack the compensating capacitor found in their op-amp cousins. Comparators are not limited by output slew rate and transition times are in the order of nanoseconds. Comparators also have especially sensitive inputs because of their very high gain – even tiny changes in the input can cause instant change of state on the output.
This problem gets worse when the differential input signals reach the dead zone, that is, the minimum input differential voltage required to maintain a stable output. Within this narrow range, the comparator has no idea what to do with its output – which leads to something called motorboating, which is the output oscillating. This problem also occurs with signals that have a slow transition time – the input signal spends enough time in the dead zone (with reference to the reference voltage, of course) to create multiple output transitions, as shown in the figure below.
If you notice carefully, the input signal varies with the output swing and there’s a lot of noise on the supply rail (as seen on the output through the pullup resistor), which is a result of poor decoupling!
If there was any logic connected to the output (which in most cases is true), it would detect the multiple transitions and cause havoc – flip flops would toggle multiple times, maybe causing something important to reset.
This is something that can be remedied using hysteresis – in this case with the addition of a single resistor between the inverting terminal (which in this case is the reference) and the output. The difference is marked, again from the figure.
Again, note the unstable reference voltage.
How Does a Schmitt Trigger Work?
A Schmitt trigger makes use of positive feedback – it takes a sample of the output and feeds it back into the input so as to ‘reinforce’, so to speak, the output – which is the exact opposite to negative feedback, which tries to nullify any changes to the output.
This reinforcing property is useful – it makes the comparator decide the state of the output it wants, and makes it stay there, even within what would normally be the dead zone.
Consider this simple circuit:
Assume the input voltage is lower than the reference voltage at the non-inverting pin and the output is therefore high.
V* is the reference input voltage which creates a fixed bias at the non-inverting input. Since the output is high through the pullup resistor, this creates a current path through the feedback resistor, slightly increasing the reference voltage.
When the input goes above the reference voltage, the output goes low. Normally this shouldn’t affect the reference voltage in any way, but since there’s a feedback resistor, the reference voltage drops slightly below the nominal value because the feedback and the lower reference resistor are now in parallel with respect to ground (since a low output shorts that terminal of the resistor to ground). Since the reference voltage is lowered, there is no chance of a small change in input causing multiple transitions – in other words, there is no longer a dead zone.
To cause the output to go high, the input must now cross the new lower threshold. Once crossed, the output goes high and the circuit is ‘reset’ to the initial configuration. The input has to cross the threshold just once resulting in a single clean transition. The circuit now has two effective thresholds or states – it is bistable.
This can be summarised in the form of a graph:
This can be understood in the usual sense – the x axis is the input and y axis is the output. Tracing a line from x to y, we find that once the lower threshold has been crossed, the hysteresis goes high and vice versa.
The operation of the non-inverting comparator is similar – the output again changes the configuration of a resistor network to change the threshold to prevent unwanted oscillations or noise.
Applications of Schmitt Triggers
Schmitt triggers find a wide range of uses mostly as logic inputs. Again, it’s not a nice thing to have a single logic threshold, in case of noisy or slow signals multiple output transitions may result. Reading the datasheet of any logic chip, you’ll find that two thresholds are specified – one for a rising edge and one for a falling edge – this is evidence of Schmitt input action.
Sometimes logic gates are drawn with a little ‘lightning’ symbol inside them, this is a stylized hysteresis curve indicating that the device has Schmitt trigger inputs.
Having two thresholds gives Schmitt triggers the 555 like ability to act like predictable oscillators.
Assume that the capacitor is initially uncharged.
The gate detects this as an input low and sets the output high, since it’s an inverting gate. The capacitor begins charging thought the resistor R. Once the upper threshold is reached, the gate flips to output low, discharging the capacitor to the low threshold, providing a predictable frequency output.
The expression for frequency can be derived with a little mathematical juggling:
Where R and C are the resistance and capacitance, VT + is the upper threshold, VT – is the lower threshold and VDD is the supply voltage. Note the ‘approximately equal to’ symbol.
2. Switch Debouncing
Mechanical switches as logic inputs are not exactly the best idea. The switch contacts tend to be somewhat springy, causing a lot of unwanted jitter, which again can cause multiple transitions and glitches further down the line.
Using a Schmitt trigger with a simple RC circuit can help mitigate these problems.
When the switch is pressed, it discharges the capacitor and causes the output to go high for a moment till the capacitor charges up again, creating a clean pulse on the output.
Where Can I Find Schmitt Triggers?
Schmitt triggers are better known as buffers or inverters in the logic world – but beware, not all gates are Schmitt triggers. Like all logic, they’re available in DIP or SMD form, with multiple gates on a single package. A good example is the 74HC04, which is a hex inverter with Schmitt trigger inputs.
Of course, other logic gates like the 4081 quad AND gate have Schmitt inputs too.
Schmitt triggers are useful when noisy signals are involved – they clean up the noise and prevent unwanted multiple transitions and oscillation.