Hello Raspi forum,
I have been using Raspi for a while and I was more than happy. However, right now, I am working on a project where I need reliable detection of the IO inputs.
I am trying to detect a person passing through a door with two pairs of IR transmitter/receiver that have a build in relay switch, that connects the wires (similar to a push button), when someone pass through a door (and interrupt the IR beam). The time when the wires are connected is quite short, so I cant use polling and I need edge detection with callback instead. I am using an external pull-up with 10kohm on both pins, so they are not floating.
I have seen that I have quite a lot of "passings through" door during night, when I am sure there is nobody passing so I have made a small logging app. I have seen that there are false edge detections on both IO pins in short span of time (8 ms). I have tried to reperoduce the problem and I have found, that the false detection occurs whenever I plug another device (in particular device with transformer (eg. old solder iron, computer charger)) to the same plug as the pi.
My solution ideas:
I have tried to change the pullup to smaller size to make the effect bigger (5kohm) with no difference. Then I have tried to use another power source for pi. After trying a lot of phone chargers with micro usb with no positive effect, I have tried a switching power supply for a computer to provide 5V for pi as well as 3.3V for GPIO input, but there was still no difference. I was still getting random false edges and I was able to reproduce them by plugging other devices in the same socket.
I am using the latest rapsbian image from the website. It is B model. The library used is Rpi.GPIO for python.
Does anybody now how to solve this issue and prevent the false edges? Is there anything else I can provide you with?
My pi detects false edges on GPIO pins randomly, in particular at the moment when I connect another device to the same power plug.
Thanks a lot in advance!