Electronic – Debouncing this Rotary Encoder Switch

debounce

I have this rotary encoder and I am not quite sure how to debounce the internal push button switch (shown in the SW02 diagram).

Any help would be appreciated, I'm a noob with this stuff.

EDIT
I would like to implement a hardware debounce

My primary problem is that I need to have my VCC on pin 5 and my ground on pin 3 in order to have my LEDs also work. And I don't know how to make the debounce work properly with that setup.

Best Answer

enter image description here

Note: You can replace the op-amp assembly with a schmitt-trigger inverter or buffer, to make your life easier. Anything with some input hysteresis will work.