Fixing spurious noise for GPIO inputs
Posted: Tue Sep 13, 2016 5:00 pm
Hi,
I have had 2 spurious GPIO input triggers this summer and decided to study it a bit further. The Raspberry Pi seems to trigger even without any external wires and using just a pullup resistor. My guess is that the noise can enter via the power supply or even be generated by the Pi itself.
Fortunately there is an easy solution. Before asking for permission to make a pull request I thought of discussing this thing on the forum.
The GPIO pins are polled every 50ms. What I would like to do is to add a hysteresis counter that requires the pin to be in the new state for 4 consecutive polls before it is declared valid.
This will slow down the GPIO button response by 200ms for both pushing and releasing a button. According to my tests this totally eliminates ghost pushes that seems to be a major nuisance when you read through the Raspberrypi.org forums.
Best regards,
Karri
I have had 2 spurious GPIO input triggers this summer and decided to study it a bit further. The Raspberry Pi seems to trigger even without any external wires and using just a pullup resistor. My guess is that the noise can enter via the power supply or even be generated by the Pi itself.
Fortunately there is an easy solution. Before asking for permission to make a pull request I thought of discussing this thing on the forum.
The GPIO pins are polled every 50ms. What I would like to do is to add a hysteresis counter that requires the pin to be in the new state for 4 consecutive polls before it is declared valid.
This will slow down the GPIO button response by 200ms for both pushing and releasing a button. According to my tests this totally eliminates ghost pushes that seems to be a major nuisance when you read through the Raspberrypi.org forums.
Best regards,
Karri