debouncing again

hi all, still noob.

ive followed about three debouncing tutorials and am finding that the solutions work MOSTLY. that is, about 6 /10 times i press my pushbutton, i only get one response (desired). but quite often it responds two or three times or even more.

does debouncing have this problem inherently? or for you does it only respond once when you press your button? also, does debouncing handle if you HOLD the button down for a brief moment?

basically to get only one response i need to tap the button extremely quickly.

any ideas? thanks, marco.

ps. ive just tried the tutorial found in the arduino tutorials. ive tried other tuts that use "delay". just curious to know if debouncing is a solid solution or if i should expect error.

I debounce switches in hardware. More parts but not too bad.
The circuit I use is in the NB1-PB1 datasheet at
http://wiblocks.luciani.org/NB1/NB1A-PB1-index.html

(* jcl *)


www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks
blog: http://luciani.org

just curious to know if debouncing is a solid solution or if i should expect error.

Yes when it is right it is a solid solution. Contact bounce is a physical phenomenon, you remove it by in effect blanking out the switch for a period of time after a transition. As you have seen this can be done in hardware or software or a mixture of both. The trick is to blank out the switch for just long enough to cover the bounce, any longer and the switch will not respond as fast any shorter and you risk getting the occasional bounce through.

Check out these little fellows.

http://www.maxim-ic.com/datasheet/index.mvp/id/1896

Full 40mS debounce, 15kv ESD protection, +-25v inputs, no other components needed and 1, 2 or 8 inputs.

I know you can do the debounce for free in software but not all the ESD stuff and 25v inputs.

Haven't you come across ESD protection in software?

Yep, I can detect but not handle very well. The code goes something like this

// do something
// do something
// do something
if (input_volts > 15000) goodnight_nurse()
// other code that will never see the light of day

thanks for all your help guys. I decided to try the Bounce library and found it to work perfectly. So clearly I was not understanding the process or at least it was not working for me. Anyhow, the Bounce library is my friend and I will keep it handy.

Thanks though guys/girls!