-->
Page 2 of 4

Re: Status change on GPIO when I just tap on it with a wire?

PostPosted: Sun Sep 16, 2018 11:15 pm
by buzzy
PatrykW wrote:Mate, you want to do some debouncing there. Connections never perfect and virtually everything has some electrical charge. Try using this:
https://github.com/thomasfredericks/Bounce2
Works for me like a charm :)


I will try the debounce lib that you linked. I doubt that it will work though, as there is no logic to debounce on. If it just went from LOW to HIGH very quickly a couple of times and ended on HIGH, that would be fine, because there is a "logic" to that. But in my case, the PIN just randomly switches between LOW and HIGH when I touch it. Almost like was floating. Also, the lib that you sent does not seem to be using interrupts, which is bad in my opinion. Checking the PIN-status in every loop is "bad" coding. An interrupt should be used that only triggers when there is a status-change on a PIN. Then the debounce code should be put there.

Re: Status change on GPIO when I just tap on it with a wire?

PostPosted: Sun Sep 16, 2018 11:32 pm
by rudy
You mentioned an RC delay? What is that? Could you please elaborate some more.


I never have input pins connected directly to wire outside the product. I would have a pull up resistor, say 1K, then 10K between the 1K resistor and the input. And from the input to ground I use a small capacitor. Sometimes 0.1uF, but it depends on how quickly I need to respond to the change on the input.

Layout of the wiring is also important. Usually in a case like your's I ask to see a picture of the setup. To see what might be possible causes.

Re: Status change on GPIO when I just tap on it with a wire?

PostPosted: Sun Sep 16, 2018 11:43 pm
by buzzy
rudy wrote:
You mentioned an RC delay? What is that? Could you please elaborate some more.


I never have input pins connected directly to wire outside the product. I would have a pull up resistor, say 1K, then 10K between the 1K resistor and the input. And from the input to ground I use a small capacitor. Sometimes 0.1uF, but it depends on how quickly I need to respond to the change on the input.

Layout of the wiring is also important. Usually in a case like your's I ask to see a picture of the setup. To see what might be possible causes.


I really appreciate your help! What you are saying makes sense and I will try it :)
I am currently uploading a video where I film my entire (weird) experience. I will post the link as soon as it's done. It's only 3 minutes long, but my upload speed is slow. Seems like you will be the correct person to help me guide through this (to me) completely crazy experience :)

Re: Status change on GPIO when I just tap on it with a wire?

PostPosted: Mon Sep 17, 2018 12:39 am
by schufti
with a 1k pullup and 10k series you will have a hard time seeing a low on the input ...
better try the other way round.