Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4821

Beginners • Re: GPIO pins false positives due to digital noise on Buttons

$
0
0
This should help you understand how to add external pull up/down resistors.

https://github.com/raspberrypilearning/ ... up_down.md

If you are having problems with interference then switching you inputs to pull up so when you press the button it pulls the circuit down and use a resistor between 10K and 1K for the pull down starting with the higher values.

I would also advise not using gpio 2/3 as these have built in pull up resistors for use with I2c on these pins
Hi, I implemented a 10k resistor for each ground wire on the switch buttons and it reduced the noise by 80% i'd say, I used to get random noise several times per seconds and now it's like one every 4-5 seconds , so we are on the right track.
I noticed that when I press and hold the switch button to ground it to 0, the signal is stable and no noise is received, the test shows a permanent 0, but the button unpressed with the pull up to high on 3.3v is where noise is received which is weird because, if there is noise shouldn't it happen on both?
Here's the test recorded, at the end of the video I press the input switch to ground it to 0:
https://www.youtube.com/shorts/kWm8w3QfvFQ

A good reference for protecting GPIO inputs is https://www.digikey.de/en/articles/prot ... lectronics
In this document, there are buttons used from GND to GPIO, using pullup resistors. Also to note that you should replace the 5V in the doc to 3.3V for RPi.
My favorite is Figure 8: Low pass filter protection for an input.

In addition to this: use for each button a pair of twisted wires. Does not need to be an industrial product, for short lengths I usually twist two strands manually. For your 5 buttons, there will be 5 pair of twisted wires leaving the RPI, each pair going to one button.

Using the ubiquitous RPi.GPIO add_event_detect-method, I found spurious events in some of my setup using very short wires to a button. It was a python code managing the shutdown of the RPi, and from time to time the RPi did shut down... Fixed this by not using the add_event_detect and polling the GPIO and having an additional mean value filter.
Hi, yes I stopped using add_event_detect-method() and that reduced a lot of noise.
I'm gonna try the twisted wires, is that a physical phenomenon that improves noise reduction?

I'd love to try a low pass filter protection for an input, I'm not sure how I could implement it on the RP, I'm gonna keep reading

Statistics: Posted by danilux — Tue Apr 09, 2024 3:27 am



Viewing all articles
Browse latest Browse all 4821

Trending Articles