0

I've seen several threads where users experience some noise fluctuation in the GPIO input readings, for instance, without any physical change to a Button's state, the events when_released/when_pressed are being triggered, even with correct configuration of pull-up/pull-down.

This is normal and expected on "real world" scenarios, however I would like to know if there is a way using the gpiozero library, to ignore events that happen too fast, for instance, a button is active, then a release and press event are triggered with a small interval in between, say 10ms for instance. I nee to ignore both the press and release rather only the release if I configure the bounce_time.

Is this possible with gpiozero? I've been trying to understand the library code, but I haven't found a way to do this without hacking too much.

The Button.bounce_time property is not applicable, since that configures only the time to ignore events after a first event happened, which is not what I need. I need to ignore all events (including the first one) if another event happened really close to the first one.

BTW, I'm using RPi.GPIO as the pin factory for gpiozero.

2

As far as I am aware my pigpio library is the only gpiozero back-end to have a proper debounce implementation.

pigpio provides a glitch filter which ignores any level transitions shorter than a specified number of microseconds.

E.g. from Python set_glitch_filter().

  • Awesome joan, I will try your library and let you know if it solved. – ffleandro May 10 '17 at 21:39
  • Joan, thanks for the library. Everything working as expected. Is there any way to log everytime a glitch is ignored? Also, I have some ideas on using this library on devices other than RPi. Is there any channel you prefer we can talk some more? – ffleandro May 11 '17 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.