Switch debounching

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
srogers
Posts: 11
Joined: Sun Feb 06, 2022 12:25 am

Switch debounching

Post by srogers » Sat Feb 19, 2022 6:34 pm

I have a breadboard kit for my Pico Pi. On this breadboard kit there are four switches with pull-up resistors, four LEDs with current limit resistors, a buzzer, and terminal boards for 5V, 3V3 and ground. Every Pico Pi pin is brought out to a new set of pins that are easily accessible.

On my breadboard, I found that the switch pins were improperly wires to the extent that I couldn't get a change of state with them no mater what I did. So I rewired my switch buttons, adding a button for RESET.

When I started testing the new wiring, I figured I would have to write some de-bounce coding The package of tactile switches I got from eBay has specs that said contact bounce <20 ms.

To my amazement, and confirmed with a logic analyzer, the trace for button actuation for these new buttons is actually a perfect square wave in both actuation and de-actuation.

Does this seem reasonable? ... For a box of 25 tactile switches at less that $7.00?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Switch debounching

Post by davef » Sat Feb 19, 2022 7:42 pm

I tried searching for <logic analyzer switch bounce> as I didn't even know if a logic analyzer could capture sharp transitions. I suggest that you are not looking close enough, ie nanoSeconds. Try a 100MHz DSO.

https://www.tek.com/ko/documents/primer ... ndamentals

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Switch debounching

Post by pythoncoder » Sun Feb 20, 2022 1:47 pm

See this doc. A decent LA can capture bouncing, but there are other subtleties described in the doc.
Peter Hinch
Index to my micropython libraries.

Post Reply