Calculating R and C for schmitt trigger debouncer
For filtering C1 should be at the invertor. R2C2 form the debouncing filter. Now R2 can be a high value, so C1 can be smaller. R2C2 also form a low pass filter to remove RF interference and noise spikes.







simulate this circuit &ndash; Schematic created using CircuitLab

R1 is sized to set the switch current. If you go looking closely, you will see that switches (and relays) have a minimum current, as well as a maximum current. 

Non-gold/non-carbon contacts need significant current - not microamps.

When you operate them below the minimum current, oxide can build up on the contacts until, they no longer conduct. This becomes an issue when you use something like a micro switch with silver contacts, that is rated for 2A current. 

Many switches have totally different contact versions in the same body. e.g these micro-switches have wetting current 1mA for 0.1A version. 160mA for 10Aversion. See micro-load graph See it is voltage dependent.

from just this one graph I will suggest a rule of thumb of 1/50 of max current.

Sometimes an electrolytic capacitor is across the switch, like your diagram, to ensure the oxide is burnt off in a small splat each time the contact closes. this can help high current contacts, but burn out low power gold ones.

In my experiments, I found that switches need to be sampled faster than 15Hz, to avoid the perception that they are slow or miss. 10ms is probably an adequate debounce time. (though there are some keyboards so bad they could play basketball)