Confusing 10k resistor w/ 100nF capacitor across it

Simple exercise, push NO button and LED goes HI and after delay time goes LO, LED between D12 and GND. NO button between 5VDC and D7. D7 to gnd through 10k resistor w/ 100nF cap across the resistor(external pulldown instead of software)? What is this cap doing? Circuit works fine without the cap and resistor pulls down spurious inputs. The resistor I understand, but what is purpose of cap?

Removing both cap and resistor will cause D7 to trigger the LED to go HI. Putting the scope probe on D7 will pull it down and eliminate spurious inputs. Cap alone or resistor alone prevents spurious inputs on D7. Seems they used the belt and suspenders method of eliminating spurious inputs, unless I am missing something here.

No I was wrong. With cap alone, when button is pushed LED goes HI and does not time out. Code must believe the button is being held closed. Even more of a reason for me to question why the cap?

Probably there for debouncing the button, which in your application indeed has no effect.

  1. hardware debouncing

  2. killing hash, in case of long wires and/or noisy (electrical) environment.


OK, well, I note you have been enjoying yourself posting over the last 24 hours or so.

Unfortunately. not actually providing much by way of information. :roll_eyes:

Either you are experimenting randomly, or are referring to some "tutorial" somewhere. Unfortunately, we - readers here - have no idea what you are up to as you have not cited any reference.

In short, the input pin is of such high impedance that it may as well be regarded as "no connection". If you have it connected to a capacitor, when you charge it up, the state will remain until the capacitor discharges by its own leakage and moisture on the connections.

The safest way to provide a pushbutton input is have it connect between the input pin and ground. The ATmega MCU will provide an internal Pull-up for you it you set the pinMode to INPUT_PULLUP. You may need to provide an external pull-up if you need a value less than the internal approximately 47k.

When you have a programmable microcontroller, it is of no value to put a capacitor across the pushbutton and in fact, having the button discharging the capacitor every time it is pressed may cause progressive degradation of the button contacts. De-bouncing is performed in software - and incidentally, not using interrupts!