![]() |
[SOLVED] Debugging/debouncing GPIO buttons... (false triggers) - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: [SOLVED] Debugging/debouncing GPIO buttons... (false triggers) (/showthread.php?tid=5198) Pages:
1
2
|
RE: Debugging/debouncing GPIO buttons... (false triggers) - marek.marakesh - 11-22-2022 @challenge I had similar issue to yours, but I overcome this by changing the "logic" of triggering actions by momentary switches. I changed the wiring to: +3.3V (GPIO pin 1) -> momentary switch -> GPIO input pin defined on Moode GPIO setup page. To use this kind of wiring you need to adjust mentioned script to initialize input GPIO pins to low logic (zero), by changing all the "GPIO.setup" lines in script /var/www/daemon/gpio_buttons.py By default all input GPIO pins configured on Moode GPIO setup page are set to high logic state. This is realized by lines: Code: GPIO.setup(sw_1_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) What needs to be done for my wiring is just to change them all buy this simple command being logged via ssh as pi user: Code: sudo sed -i s/pull_up_down=GPIO.PUD_UP/pull_up_down=GPIO.PUD_DOWN/g /var/www/daemon/gpio_buttons.py After this modification you can even reduce debounce paramter to 150ms from default 1000ms (1s). PS This is for RPi 3B+ and I found in documentation, that each GIPO pin has internal pull up / pull down resistors, so you don't need to use additional external resistors. Details can be found here: Raspberry Pi hardware Here is my pins configuration: Code: - all GPIO settings are in moode-sqlite3.db located in /var/local/www/db and must be defined via GUI RE: Debugging/debouncing GPIO buttons... (false triggers) - Tim Curtis - 11-22-2022 (11-22-2022, 09:36 PM)marek.marakesh Wrote: @challenge I think there were previous requests for an option to define pull up or pull down. I'll add to the TODO list. RE: Debugging/debouncing GPIO buttons... (false triggers) - marek.marakesh - 11-23-2022 Quote:I think there were previous requests for an option to define pull up or pull down. I'll add to the TODO list. Thanks Man! It will make my life easier with updates ;-) |