alubbock / rpi-vidlooper

Video player for Raspberry Pi, controlled by GPIO buttons
MIT License
19 stars 19 forks source link

GPIO pins are very sensitive #8

Open Benny7587 opened 3 years ago

Benny7587 commented 3 years ago

Because of the very sensitive GPIO pin and the long cable (3 meters) to the push button (we only play one video) the video starts sometimes when lights are switched on or off. I tried to solve this with a pull up resistor and also a capacitor over the wire but cannot get it to work properly. I was thinking of a software solution in a way that the status of the gpio pin is checked multiple times with a short wait state (5x50msecs…) in between. Could this eliminate an induction pulse on the long cable. What is your opinion about this idea?

cveerkamp commented 2 years ago

I know this issue is over a year old at this point, but I just found this project & I had the same issue. I am using this with an outdoor monitor and button panel, with the Pi inside about 10ft away. I was able to solve my issues by using an optoisolator board, with 12v on the button side, and then 3.3v on the Pi side. I use 4 buttons, so I ended up buying this: https://www.amazon.com/dp/B07TCVTD2K

alubbock commented 2 years ago

@cveerkamp That's a good suggestion - debouncing in hardware would be preferable where possible. Increasing VidLooper._GPIO_BOUNCE_TIME might also help, or a software-based debounce as described on StackOverflow might also help. If anyone wants to create a PR based on the StackOverflow method, I'd be happy to review.