![]() |
[How to do instruction] Use hardware momentary switches to control moOde - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: FAQ and Guides (https://moodeaudio.org/forum/forumdisplay.php?fid=9) +--- Thread: [How to do instruction] Use hardware momentary switches to control moOde (/showthread.php?tid=198) |
RE: Use hardware momentary switches to control moOde - Tim Curtis - 04-13-2020 I don't have any GPIO connected devices that would make use of the feature but there are other moOde users that are using it. Maybe one of them will chime in and try to troubleshoot your particular issue. If it turns out to be some sort of bug in moOde that can be reproduced then most likely it can be fixed. RE: Use hardware momentary switches to control moOde - GreyLinux - 04-18-2020 (04-13-2020, 05:11 PM)sisim Wrote: I used another script, showing 0 or 1 every 0.1 second and I tested it with several GPIO, this is what I get: I'm not sure if I can help here but I believe that you had the same problem I did when I moved from Volumio. I had gpio pins 5 and 6 (default high )connected via buttons to ground as the documentation suggested configuring for the opposite voltage as described here The other gpio pin (13)(default low) I had conected to 3.3V. however when I came to moode it didnt work properly . as kent said Quote:OK, so now I've actually read Tim's earlier reply: the code for every pin is set to pull up or (high ) when no button is pressed this stops it foating as explained in this excellent site I discovered here This might be why you see the numbers fluctuating between 1 and 0 I would suggest that either you wire all pins you use to ground and keep using Tims script or keep your wiring that you have and change the Code: pull_up_down=GPIO.PUD_UP Code: pull_up_down=GPIO.PUD_DOWN for each Gpio you have conected to 3.3V in Tims script . although I'm not sure if Tim's script would be overwritten each time you updated Moode and you would have to chnage the value again . I hope this helps as its something I've learned today based on reading that site regarding pins floating unless they are pulled (in software) using the internal resistors on the PI or an external pull up/down resitors is used. Unfortunately (like many) I didnt read the first post in this thread properly and it says Quote:On the hardware side, you set your hardware button to connect the ground pin of your RPi with a GPIO pin of your choice regards Tim ( another one ) RE: Use hardware momentary switches to control moOde - Tim Curtis - 04-18-2020 Should there be a pull up/down configuration option for each pin in the GPIO Config screen or should all the pins be configured as pull down instead of pull up? RE: Use hardware momentary switches to control moOde - GreyLinux - 04-18-2020 (04-18-2020, 12:57 PM)Tim Curtis Wrote: Should there be a pull up/down configuration option for each pin in the GPIO Config screen or should all the pins be configured as pull down instead of pull up? It might make an already complicated element even more complicated , I think that its nice that the GPIO config screen is rather clean and simple showing basic settings that you might need. You could however provide an advanced configuration tab in the config screen that allows changing the pull options but hides it by default. RE: Use hardware momentary switches to control moOde - TheOldPresbyope - 04-18-2020 (04-18-2020, 12:57 PM)Tim Curtis Wrote: Should there be a pull up/down configuration option for each pin in the GPIO Config screen or should all the pins be configured as pull down instead of pull up? IMHO, either make no change or change to a choice* of up or down. Otherwise the folks who already have working systems would have to make physical changes to their wiring. Regards, Kent *As a hacker, I'd vote for choice but that's just for convenience. I prefer having switches ground a pin but there's no iron-clad rule I'm aware of that dictates one choice or the other. RE: Use hardware momentary switches to control moOde - GreyLinux - 04-24-2020 Hi everyone, so I was still having some glitches with my setup regarding gpio problems, after a lot of research I have finally fixed it for good . I will start a fresh thread detailling my project and how I fixed issues with the gpio buttons. here is the thread : http://moodeaudio.org/forum/showthread.php?tid=2414 Tim I apologise if its not the best place for this thread , please move it if you think it would be better elsewhere RE: Use hardware momentary switches to control moOde - alekmaker - 05-13-2020 If I want to add a few more buttons, I just have to add a few more paragraphs like this to the file, elif str(row['id']) == '8' and row['enabled'] == '1': sw_8_pin = int(row['pin']) sw_8_cmd = row['command'].split(' ') GPIO.setup(sw_8_pin,GPIO.IN, pull_up_down=GPIO.PUD_UP) def sw_8_event(channel): subprocess.call(sw_8_cmd) GPIO.add_event_detect(sw_8_pin, GPIO.RISING, callback = sw_8_event, bouncetime = bounce_time) print str(datetime.datetime.now())[:19] + ' sw_8: pin=' + str(sw_8_pin) + ', enabled=' + row['enabled'] + ', bounce_time=' + str(bounce_time) + ', cmd=' + row['command'] only change the numbers to "9", "10", etc. Isnt it? RE: Use hardware momentary switches to control moOde - alekmaker - 09-21-2020 I use 5 gpio buttons to switch playlists and two to next/prev Change playlist work good, but next and prev doesn't. If I check buttons thru "gpio readall" I see - buttons is works, if I use "sudo /var/www/command/gpio-buttons.py" I see when I push to next and prev nothing happening, all another buttons work. Why? What I did wrong? see the attached screenshots: RE: Use hardware momentary switches to control moOde - Tim Curtis - 09-21-2020 The help text under the SAVE button. "NOTE: Use a comma to delimit arguments in the CMD field. Example: mpc,load,My Playlist" RE: Use hardware momentary switches to control moOde - Tim Curtis - 10-01-2020 I haven't wired any buttons into a Pi but what I can say is that you don't need sudo for commands in the CMD field in GPIO Config. Just make sure that any commands with arguments for example "load playlist_name" are delimited with comma as below load, playlist_name |