Debouncing Raspberry Pi GPIO the hard(ware) way... #36
Andy-ABTec
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When the Raspberry Pi first boots, all the GPIO pins are set to input. GPIO's 0 through 8 have internal pullups
(to 3.3V) enabled - the rest have internal pull-downs (to Ground) enabled. I'm no programmer so I have no idea how this is changed, but I would imagine that there are library functions that handle it.
These pull-ups and pull-downs should generally be sufficient if the pin in question is (a) not being used, or (b) being used by circuitry in close proximity to the processor, however connecting them to switches, buttons and the like can lead to problems in electrically noisy environments (like a 3D Printer?) even with sensible wiring routing and screening.
The following "Active Low" circuit is commonly used to suppress spurious triggering: -
The 1K resistor "nails" the GPIO pin high (the internal pull-up is about 50K) and the 100R resistor and 100nF capacitor form a low pass filter with a cut-off frequency of just under 16KHz (1/2πRC) to help deal with noise pickup.
An "Active High" version is easily created by swapping the 3.3V and Ground connections.
The circuit should be placed as close to the Pi as possible.
A "Fail-Safe" setup (eg for an Emergency Stop) should use the Active High configuration replacing the button with a normally closed switch. Any physical failure in this configuration produces the Low trigger required.
Beta Was this translation helpful? Give feedback.
All reactions