8

I have a circuit where I am using a tactile switch to pull 3.3v down to ground and investigating debouncing the button. My relevant part of the circuit is

enter image description here

The 100nF cap does work here my signal has ringing that operates in the undefined region and causes a few false clicks. Increasing the capacitance to 1uf makes it worst. I tried using 10nF which was better. It reduced the ringing time but did not remove it. Image of scope trace below for 10nF.

enter image description here

This ringing is not really a switch bounce contact problem is it. What causes this ringing. There is capacitance on the power rail could it be that ?

My best results are with removing the caps entirly.

I know I can use software to solve this issue so it is not a big issue but I am using this as a learning exercise.

My easyeda design:

Top:

top

Bottom:

bottom

Marcus Müller
  • 88,280
  • 5
  • 131
  • 237
Glenn Pierce
  • 229
  • 1
  • 6

2 Answers2

10

The ringing is caused by poor layout (possibly breadboarding is the worst culprit) AND the fact that your button's switch-contact is shorting out a charged capacitor - the instantaneous current flow is (practically) tens of amps and that surge (along with poor wiring and layout creating excessive loop inductance) causes the ringing.

Try putting a 10 ohm resistor in series with each capacitor.

Andy aka
  • 434,556
  • 28
  • 351
  • 777
  • Its a pcb made at JLPCB. The traces are short with a large ground plane. I have added a link to the pcb on my original question. I will try the resistor. Thanks – Glenn Pierce Jun 03 '20 at 12:26
  • 5
    The direct short of a ceramic capacitor is for sure the reason. I have seen this mistake on dozens of boards. Tutorials often neglect to mention you should have a series resistance with the switch. – MadHatter Jun 03 '20 at 17:12
4

Pushing the button causes high dv/dt so the edge is extremely fast and depends on the scope ground lead connection how it will see the fast edge due to inductance in the probing setup. If the switch bounces, it also causes high di/dt spikes, and even if it does not, impulse from shorting the cap is like a small loop of coil that can induce magnetic field to the scope probe, and can also cause ringing due to any stray inductance and capacitance. The high di/dt can cause significant voltage in stray inductance which could cause stress for the IO pin structure, so even Atmel appnote suggests a 330 ohm series resistor to limit the discharge current (related to the reset pin, as it has no clamp diode to VCC).

Justme
  • 127,425
  • 3
  • 97
  • 261