# Schmitt trigger in button debouncer

While researching how to debounce a switch for digital applications, I often come around this diagram :

simulate this circuit – Schematic created using CircuitLab

Or other similar diagrams, with modified resistance / capacitance values. I understand that R1 is a pull-up, and R2 is here to limit the discharge rate of C1 and to augment the value of the time constant and to avoid short circuit when discharging, but why is there a Schmitt trigger ?

### When the button is open

The current is flowing through R1 and R2, and is sourcing current for whatever circuitry there is at the Schmitt trigger / output of the sub-circuit.

### When the button is closed

The capacitor C1 discharges through R2 to the common ground, following the equation of the discharge of a capacitor. But, at the junction between R2 and Schmitt trigger / output, the voltage should drop instantly, given that the resistance R2 is lower than the one of a Schmitt trigger IC, or any transistor base pin for the matter. So the Shmitt trigger shouldn't be required, given that we don't need any hysteresis ?

There is obviously a flaw in my reasoning, but I don't find it. Any transistor base pin or Schmitt trigger should have an impedance high enough so almost no current would come in, and the voltage would be too low for the threshold of the transistor, so , not only the Schmitt trigger would not be required, but fail the sub-system ? It's obvious there's a mistake I'm making, but again, I don't find it. Sorry if i'm stupid.

• Biggest flaw is lack of positive feedback or hysteresis with an inverting amp. Commented Sep 30, 2017 at 20:47
• What do you mean ? Sorry, I am really a self-taught beginner in the matter. Commented Sep 30, 2017 at 20:50
• Do you know where wiki pages are? Commented Sep 30, 2017 at 20:51
• ....No...Sorry. Commented Sep 30, 2017 at 20:52
• en.wikipedia.org/wiki/Schmitt_trigger Commented Sep 30, 2017 at 20:52

Your circuit does not show a Schmitt trigger.

A Schmitt trigger needs active components, transistors and/or an IC.

Some examples:

A logic gate Schmitt trigger (on a chip) is often made like this:

Using an opamp we can do this:

You can connect the output to a Schmitt trigger but that's not really needed for detecting a button press. Most microController inputs don't have Schmitt trigger inputs.

To reliably detect button presses without contact bounce problems just add a short delay after a button press is detected and detect if the button is still pressed.

• My question wasn't particularly about microcontrollers (hence hardware resolution of the switch bounce), but your answer fully addresses my question, thanks. Commented Sep 30, 2017 at 20:57
• Sure, if you want to hardware debounce, adding a Schmitt trigger after the circuit in your question will do the job. I'd probably choose a CD40106, HEF40106 or 4093 CMOS logic gates. Commented Sep 30, 2017 at 21:25
• While not really common these days, there have been many micros that did not like when the rise time was too slow, and you had to put a st before them Commented Sep 30, 2017 at 21:42

But, at the junction between R2 and Schmitt trigger / output, the voltage should drop instantly, given that the resistance R2 is lower than the one of a Schmitt trigger IC, or any transistor base pin for the matter.

No, it shouldn't. Because one terminal of C1 is connected to that junction too, and the voltage across a capacitor cannot change instantly.

When the button is closed, the voltage at the output will begin decreasing gradually, as C1 is discharged through R2.

If the output was sharply level triggered, it would be possible to open the button again just as the voltage across C1 was passing through the threshold. Then contact bounce could possibly make the voltage briefly jitter back and forth around the threshold, leading to noise in the digital output.

Oh the other hand, with hysteresis you're guaranteed* that the output can change between high and low only every so often -- namely, two transitions will be separated by the time it takes for C1 to charge/discharge from one of the thresholds to the other, which is limited by the resistors.

*: If the Schmitt trigger is assumed to be ideal, which is of not true in theory for real devices.