0
\$\begingroup\$

Is there anything wrong with this debouncing circuit, aside from the fact that it can be made with a single Schmitt trigger and a capacitor that is charged when the button is not pressed?

enter image description here

\$\endgroup\$
2
  • 7
    \$\begingroup\$ The 10 K resistor on the left doesn't do anything (except waste power). Switching a voltage source across a capacitor is switch abuse, the switch may weld shut or may wear out quickly. You can find better debounce circuits with Google. \$\endgroup\$
    – John D
    Commented Oct 31, 2022 at 21:06
  • 6
    \$\begingroup\$ A resistor in series with the switch is highly recommended. Have you tried searching for switch de-bounce circuits? \$\endgroup\$
    – Andy aka
    Commented Oct 31, 2022 at 21:49

2 Answers 2

3
\$\begingroup\$

Yes, many things wrong. Or at least not entirely properly designed. It will work and be functional and may even be used in practice, but it still has problems that are easily solvable and make it better and more reliable.

Another thing is, if the hardware debounce is even needed at all. If this is for a generic logic input, and the bouncyness or slow input change does not affect the circuit, if for example it is filtered by software or it can trigger a single action, the debouncing or Schmitt trigger is not needed. If however it goes to an input which must have single well-defined sharp edge, such as to generate one single event or interrupt or counter clock pulse or something, then the hardware debouncing by filtering and Schmitt trigger is definitely needed, or in some cases, an even better debounce might be necessary which requires a SPDT button.

The 10k resistor on left is useless. The switch has no relation to it and it will constantly have 5V supply over it and it just wastes power. There is no reason why it is or why it should be present in the circuit.

As the resistor on right keeps the capacitor discharged, pushing the button will short circuit the capacitor with power supply, immediately charging it with high pulse of current.

While the current surge is short, it is only limited by internal resistance of capacitor, copper trace wiring and switch contacts, and can be multiple amps, it will degrade the switch contacts over time, and will likely exceed the safe current limits of the capacitor and the button.

So as already mentioned, pushing the button causes a fast voltage and fast current step. Even worse if the button connection is scratchy and there are bursts of steps instead of one. If the button is user accessible at suitable location and the capacitor is further away near the chip, the PCB wiring between them has stray inductance. The large current trasients will cause large voltage transients and this may cause overshoots, undershoots and ringing at the chip input, and it may unintentionaly stress the chip input structures.

\$\endgroup\$
1
\$\begingroup\$

You should remove the 10K resistor across the 5 V supply. It has no function and wastes current.

After that, the remainder of the circuit you have is OK, as long as you use a Schmitt trigger buffer/inverter. This answer covers the operation of that remainder of the circuit.

It includes the note that the capacitor will draw a spike current from the supply as the switch contacts connect. In theory, this is an infinite current at t0. But not in practice, where the components and track impedances stop this happening and local circuit decoupling will stop the supply rail dipping. You can subsequently observe that on a 'scope with a real circuit.

The notion that the capacitor current will damage the switch contacts or dip a typically/well-decoupled supply is false. This is a very common and standard circuit, used, without problems for years, in very large numbers of boards made every year since I first saw it 40 years ago. Those systems are all around us. I myself always avoid capacitor debouncing and use MCU/CPLD/FPGA sampling to debounce switches. But this method is harmless to do and proven as such.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ I'd say the possibility of switch damage depends on the layout (resistance and inductance), the ESR/ESL of the capacitors on the supply and the debounce circuit, and the construction of the switch itself. It may work forever in some cases, but I wouldn't make a blanket statement that it's safe, nor would I design that way. I haven't done any analysis so maybe I'm wrong, but it wouldn't hurt to put some resistance in series with the switch. \$\endgroup\$
    – John D
    Commented Nov 1, 2022 at 3:01
  • \$\begingroup\$ Depends on the PCB layout how large problem the button/capacitor combination is due to stray inductance and high dV/dt. It's even warned in some MCU appnotes IIRC. Thanks for reminding, will add that to my answer. \$\endgroup\$
    – Justme
    Commented Nov 1, 2022 at 5:40
  • \$\begingroup\$ @JohnD, the analysis would have to fit the empirical evidence, though, which is my perspective. We'd like a very large and very long practical experiment to have been done...and one has - millions of boards over decades. And its proven (not just shown) fine to do this. But my own opinion on sudden cap charging in my own engineering is it's a huge 'no' :-) I've always designed it out, never go near it. But I would be foolish to disregard the large amount of empirical testing that exists. That's my view: not 'I like it' but that the huge evidence overwhelms the limited theory we'd be applying. \$\endgroup\$
    – TonyM
    Commented Nov 1, 2022 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.