I have a push button that I would like to debounce. I only care about the first rising edge of the signal which is connected to an Arduino's GPIO. After reading on the web about hardware debouncing, I understand that to truly debounce a push button, I would need a latch or a logic gate to keep a sharp edge that the Arduino could read correctly. But I don't have any and it takes a month to order anything from where I am.
So, I came up with this circuit attending to avoid using extra parts:
I would like someone to help confirm the following assumptions:
When the button is pressed, C1 will charge almost instantly because there is no resistor to slow it down. When the button is released, C1 will slowly (0.1s) discharge thru R1. This should debounce the rising edge of the button as after the initial rise, R1 prevent C1 to discharge thus keeping the GPIO high.
I don't own a oscilloscope to test this. So this is just what I'm assuming will happen.
My questions are:
- Is it safe to charge C1 so fast?
- Is it safe for the GPIO?
- Are my assumptions correct?