4 ms·
For my hobby projects I hardware debounce with a single tiny capacitor. The MCU already has schmitt trigger inputs (handles hysteresis). And it also has a high
by bombela 1y ago
For my hobby projects I hardware debounce with a single tiny capacitor.
The MCU already has schmitt trigger inputs (handles hysteresis). And it also has a high value pull up resistor. The tiny capacitor from input to ground complete the low pass filter.
When you press the button, it quickly empties the capacitor to ground. Because it is so tiny, combined with the intrinsics parasitic resistance, this is a small enough EMI for hobby work.
The MCU input will register the state change right away, the pull up resistor will slowly recharge the capacitor (we talking a few dozen of milliseconds here). The schmitt trigger will handle the transition cleanly.
Nothing to do in code. Interrupts just work as expected without anything special. I think it's worth it.