I have seen many designs of switch circuit: enter image description here

I know that a capacitor will help anti-shake but I realy do not know how i can anti-shake. Does it work like a decoupling capacitor or a low-pass RC filter? and then I want design another switch circuit but do not know how to add a capacitor: enter image description here


The capacitor works like a RC filter to eliminate high frequency bounce when the switch is flipped.

For your other circuit, you should connect the cap from the signal pin to ground.

  • \$\begingroup\$ I think it is not the same as a normal RC filter. Take a simple RC filter for instance, high frequency signal goes from one side of resistor and then go through the capacitor to the ground. In this example, high frequency bounce is from switch, so if it works like a RC filter, it should go through a resistor and then the input of MCU. But why does it connect it to input to MCU directly? \$\endgroup\$ – oilpig Jun 2 '13 at 5:37
  • \$\begingroup\$ It is similar to a RC in that it integrates the signal over time. When the switch is closed/opened, it may produce a lot of transients because the contacts may bounce. The capacitor is (relatively) slowly charged/discharged so your MCU only sees one transition. \$\endgroup\$ – Pentium100 Jun 2 '13 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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