Go Down

Topic: Button - hardware debouncing with 1uF capacitor (Arduino Uno R3) (Read 898 times) previous topic - next topic

Aranha

#5
Dec 27, 2013, 10:56 pm Last Edit: Dec 27, 2013, 11:26 pm by Aranha Reason: 1
Thank you for your replies.
I found 330nF capacitor, that's the best I have... When I insert it, bounces are still there (but works as it should be - it sometimes switches the LEDs). In a few days I'll get 100nF, as you suggest, and try it.

I study computer science and I have really have a lot of programming there but noone will teach us how to create even simple circuits or explain how the basic elements work. I just try to do it on my own because it is what I'm interested in. I can sit and try to write a program whenever I want because I was taught how to do it but I can't sit and just build a circut like that. I wanna simply change it :).

I attach another picture of what I did (I know this is not actual schematic, sorry for that). If everything but the value of capacitor is good, I'll just get 100nF as soon as I can and try it.

@polymorph
I'm sorry, I forgot to answer your question. I use the internal pull-up resistor, which, following the datasheet, is 20k.

I attached the photo to my post and changed quote tags to code tags, thanks for that.

SirNickity

The difference between 100nF and 330nF isn't going to be a deal-breaker.  The gist of the problem with a 1uF cap is that it's overkill.  It stores more energy, which you short to ground when you press the switch, subjecting the contacts to avoidable stress.  Instead of, or in addition to a smaller cap, you might want to put a 100R resistor between the cap and the switch.  (Cap + to input pin, cap - to ground, cap + also through 100R resistor to switch +, switch - to ground.)  This helps limit current surges when the button is pressed.

BTW, the cap in your image there is a polarized electrolytic, and you have it backwards.  The stripe is usually the negative side.

One more tip:  Keep an eye on your image resolution.  If the width is > 1000 pixels, it means most users will need to scroll around to see it all, which is really distracting when tracing parts of a diagram.  Try to keep it under 1000 unless you need the resolution to convey detail.

polymorph

Perhaps the button is not making good contact.

In the Arduino IDE, look up Examples, Bounce, and open the sketch Change.
Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Go Up