[Plugin] GPIO Buttons: Control Volumio 2/ Volumio 3 with buttons

In nanosound it is hardcoded in index.is. In my plugin you set it in the UI configuration in volumio, and it is saved in a file read by the plugin.

1 Like

Hi tomatpasser,

Tnx for the great work!
I want to use a pir sensor to play and pause volumio. I’ve connected it to gpio17 and when it’s sees movement it becoms high (3,3v) it plays the volumio en when it’s inactive it becoms low 0v. If there is movement, it becomes high again and volumio pauses.

Is there a possibilaty to change the code so it pauses on a low gpio17 and plays ond a high gpio17?

Hi guys,

I have found a script to use rotary buttons here, it’s for Rpi so near from working in this script.

gist.github.com/savetheclocktow … 2e594d43c1

I think you probably know it thanks to google but if I can remotivate this implementation…

I will have a look.

Hi guys,
Can someone help me customize this plugin for Odroid C2?

Best,
Ralf

I want to built a standalone steampunk webradio. I installed volumio and activated the push button plugin. Everything works fine. I started wiring and testing the buttons, wow so easy. Then the k.o for this system. How can I handle a radio without a posibility to change the radio station ? The prev/next buttons can only be used in the playlist. Are there any plans for an upgrade or is that not an issue?

So here’s the bug I’m seeing:
When I power up volumio, the GPIO buttons don’t work. I have another script I wrote that also uses GPIO buttons, but it is not active (it was for some testing I was doing earlier). If I run the script, then break out of it, the GPIO buttons start working as expected from the plugin. But I have to do this each time I restart the device - SSH in, run my script, break out of my script, and then everything works.
Thoughts?

There seems to be a bug indeed, I just finished the following setup:

Volumio 1.018 running on RPI2 with Waveshare 3.2" LCD Touch screen
Display and Touch function both work OK, after configuration of hardware, drivers and ‘Touch Display’ plugin
To get the three hardware buttons to function on the Touchscreen, I installed plugin: ‘GPIO Buttons (updated 20-6-18)’

RPI has been rebooted, plugin switched to activated.
Configured settings, saved and got a confirmation.
Rebooted again, no working buttons…
Checked settings in /data/plugins/system_controller/gpio-buttons/config.json.
They were not saved correctly by changing the settings and saving them in GUI.
I added the correct GPIO pin numbers for my hardware to the config.json by hand.
Rebooted again.
Still, no buttons…

Contents of my config.json file:

{ "playPause":{ "enabled": {"value": true, "type": "boolean"}, "pin": {"value": 16,"type":"number"}, "value": {"value": 0, "type": "number"} }, "volumeUp":{ "enabled": {"value": false, "type": "boolean"}, "pin": {"value": 18,"type":"number"}, "value": {"value": 0, "type": "number"} }, "volumeDown":{ "enabled": {"value": false, "type": "boolean"}, "pin": {"value": 22,"type":"number"}, "value": {"value": 0, "type": "number"} }, "previous":{ "enabled": {"value": true, "type": "boolean"}, "pin": {"value": 12,"type":"number"}, "value": {"value": 0, "type": "number"} }, "next":{ "enabled": {"value": true, "type": "boolean"}, "pin": {"value": 18,"type":"number"}, "value": {"value": 0, "type": "number"} }, "shutdown":{ "enabled": {"value": false, "type": "boolean"}, "pin": {"value": 3,"type":"number"}, "value": {"value": 0, "type": "number"} } }
Link to Waveshare 3.2" screen product sheet with table of the interface pins:
https://www.waveshare.com/product/3.2inch-RPi-LCD-B.htm

Double. See below.

OK, simple question. I must be doing something wrong. I am trying to get multiple buttons to work, but the max I can get to work is 2, in which one is connected in between GND and GPIO, and one in between 3.3V and GPIO. Because I am working from the header on top of a Allo Piano 2.1 I have limited GPIO pins: only one with a default ‘high’ (GPIO 4). The rest op the available GPIOs is default ‘low’, so I should connect to 3.3V. One button works on 3.3V, but when connecting multiple buttons to 3.3V it does not. What I did was have the 3.3V on a breadboard rail, and connected to two buttons to the rail, and from the buttons back to two GPIOs. What wrong with this? Should I add resistors to get this to work?

Hello.
Question: Is it possible to add somehow long press for “Shutdown” button?
Basically I want it so that if I hold down the “Shutdown” button for say 3 seconds, it shuts down.
Mostly to stop accidental shutdowns.

Hello.

First of all I want thanks tomatpasser for that useful plugin.

I used it for power off and on function with GPIO 3 pin everything work fine.
Today I connect I2C display and have to change GPIO pin to another because 3 pin needs to display. Shutdown function works fine like always but now I can’t power on RPI with the button.
I tried different GPIO but only power off function work and no power on.
Any advice how to solve this problem?

P.S. Sorry for my English :slight_smile:

How many time I need to wait ?

root@volumio:/volumio/volparametriceq/gpio# volumio plugin install

This command will install the plugin on your device

Compressing the plugin
Plugin succesfully compressed
Progress: 10
Status : Downloading plugin

Hello,
Could you please tell. Me how to wire to have these buttons works? All this button should go to gpio pins and 3.3v pin?
Thanks…

Hi Lintbf,

i connected this way (i use an old BlueRayPlayer Case, so i connected Play/Pause/Stop buttons to Play/pause GPIO):


2 Likes

Hi,
Thanks for the picture.
Why have not you used the 3v3 tail?
I have one button for shutdown and wake up conectez to gpio3, wake up by default and for shutdown I configured via plugin.
For the pull-down resistor I used 1k resistor… when configured the shutdown button on another gpio
What do you think about above setup?
Regards

hi,
i have read the raspberry pi doc,
you are right, 3v3 is correct.

on GPIO 2 and 3 in my installation there is a LCD Display connected.

What do you think about above setup?

I think it is a good setup
Regards

Hi,
I have configured gpio 23 for stop play functionality.
When I press the button the music is stopped but if I press again, I see a message that the station is restarted but nothing is played…
În order to make it work, I need to remove the station from queqe and then start again from volumio. Local. During this process I also set eceive an error : error not seekable
Rpi4, volumio v 2.779,
Thanks
Update
I have restarted pi, press the physical play button, the radio station start, then press again to stop it - - it is stopped but when press back to start, radio is not started. But I see a green windows that says it is started…
___
/_ \ __
__ __ //\ \ __ __ ___ ___ /_\ ___
/\ /\ \ / __\\ \ \ /\ \/\ \ /' __ __\/\ \ / __\
\ \ _/ |/\ \L\ \
\ _\ \ _\ /\ /\ /\ \ \ /\ \L\
\ _
/ \ _//_\ _/\ _\ _\ _\ _\ _/
// // // // /////////___/

         Free Audiophile Linux Music Player - Version 2.0

      C 2015 Michelangelo Guarise - Volumio Team - Volumio.org

Volumio Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
volumio@volumio:~$ journalctl -f – Logs begin at Wed 2020-07-01 12:39:33 UTC. –
Jul 01 12:44:28 volumio systemd[2193]: Starting Sockets.
Jul 01 12:44:28 volumio systemd[2193]: Reached target Sockets.
Jul 01 12:44:28 volumio systemd[2193]: Starting Basic System.
Jul 01 12:44:28 volumio systemd[2193]: Reached target Basic System.
Jul 01 12:44:28 volumio systemd[2193]: Starting Default.
Jul 01 12:44:28 volumio systemd[2193]: Reached target Default.
Jul 01 12:44:28 volumio systemd[2193]: Startup finished in 30ms.
Jul 01 12:44:28 volumio systemd[1]: Started User Manager for UID 1000.
Jul 01 12:44:28 volumio sshd[2188]: lastlog_openseek: Couldn’t stat /var/log/lastlog: No such file or directory
Jul 01 12:44:28 volumio sshd[2188]: lastlog_openseek: Couldn’t stat /var/log/lastlog: No such file or directory
Jul 01 12:44:52 volumio volumio[950]: info: CoreCommandRouter::volumioGetState
Jul 01 12:44:52 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:52 volumio volumio[950]: info: CoreCommandRouter::volumioPlayJul 01 12:44:52 volumio volumio[950]: UNSET VOLATILE
Jul 01 12:44:52 volumio volumio[950]: info: CoreStateMachine::play index undefined
Jul 01 12:44:52 volumio volumio[950]: info: CoreStateMachine::setConsumeUpdateService undefined
Jul 01 12:44:52 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:52 volumio volumio[950]: info: CoreStateMachine::startPlaybackTimer
Jul 01 12:44:52 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:52 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:44:52 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:44:52 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:52 volumio volumio[950]: info: CorePlayQueue::getTrack 1
Jul 01 12:44:59 volumio volumio[950]: info: CoreCommandRouter::volumioGetState
Jul 01 12:44:59 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:59 volumio volumio[950]: info: CoreCommandRouter::volumioPlayJul 01 12:44:59 volumio volumio[950]: UNSET VOLATILE
Jul 01 12:44:59 volumio volumio[950]: info: CoreStateMachine::play index undefined
Jul 01 12:44:59 volumio volumio[950]: info: CoreStateMachine::setConsumeUpdateService undefined
Jul 01 12:44:59 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:59 volumio volumio[950]: info: CoreStateMachine::startPlaybackTimer
Jul 01 12:44:59 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:59 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:44:59 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:44:59 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:44:59 volumio volumio[950]: info: CorePlayQueue::getTrack 1
Jul 01 12:45:01 volumio volumio[950]: info: CoreCommandRouter::volumioGetState
Jul 01 12:45:01 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:01 volumio volumio[950]: info: CoreCommandRouter::volumioPlayJul 01 12:45:01 volumio volumio[950]: UNSET VOLATILE
Jul 01 12:45:01 volumio volumio[950]: info: CoreStateMachine::play index undefined
Jul 01 12:45:01 volumio volumio[950]: info: CoreStateMachine::setConsumeUpdateService undefined
Jul 01 12:45:01 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:01 volumio volumio[950]: info: CoreStateMachine::startPlaybackTimer
Jul 01 12:45:01 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:01 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:45:01 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:45:01 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:01 volumio volumio[950]: info: CorePlayQueue::getTrack 1
Jul 01 12:45:04 volumio volumio[950]: info: CoreCommandRouter::volumioGetState
Jul 01 12:45:04 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:04 volumio volumio[950]: info: CoreCommandRouter::volumioPlayJul 01 12:45:04 volumio volumio[950]: UNSET VOLATILE
Jul 01 12:45:04 volumio volumio[950]: info: CoreStateMachine::play index undefined
Jul 01 12:45:04 volumio volumio[950]: info: CoreStateMachine::setConsumeUpdateService undefined
Jul 01 12:45:04 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:04 volumio volumio[950]: info: CoreStateMachine::startPlaybackTimer
Jul 01 12:45:04 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:04 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:45:04 volumio volumio[950]: verbose: MPD COMMAND [object Object]Jul 01 12:45:04 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:04 volumio volumio[950]: info: CorePlayQueue::getTrack 1
Jul 01 12:45:05 volumio volumiologrotate[641]: /bin/volumiologrotate: line 22: [[:
Jul 01 12:45:05 volumio volumiologrotate[641]: 2085
Jul 01 12:45:05 volumio volumiologrotate[641]: 1326: syntax error in expression (error token is “1326”)
^[[B^[[B^[[Jul 01 12:45:29 volumio volumio[950]: info: CoreCommandRouter::volumioGetState
Jul 01 12:45:29 volumio volumio[950]: info: CorePlayQueue::getTrack 0
Jul 01 12:45:29 volumio volumio[950]: info: CoreCommandRouter::volumioGetQueue
Jul 01 12:45:29 volumio volumio[950]: info: CoreStateMachine::getQueue
Jul 01 12:45:29 volumio volumio[950]: info: CorePlayQueue::getQueue
Jul 01 12:45:29 volumio volumio[950]: info: CoreCommandRouter::executeOnPlugin: multiroom , getMultiroom
Jul 01 12:45:29 volumio volumio[950]: info: CoreCommandRouter::volumioGetVisibleSources
Jul 01 12:45:29 volumio volumio[950]: info: CoreCommandRouter::executeOnPlugin: my_music , getDisabledSources
Jul 01 12:45:29 volumio volumio[950]: info: Listing playlists
^[[B^[[D^[[D

Hi,
I have changed to another radio stations and it is working ok. I guess it is an issue with 80 80 radios… Also from gui has issues when start stop…
Thanks

Hi,
has anyone figured out how to implement the functionality to change playlists on buttonpress? I don’t need a GUI for that. Just the code to make it possible: Button 1 = play Playlist X, Button 2 = play Playlist Y and so on.
Many thanks
Muhackl

1 Like

Hi @workahol !

did you manage to create this toggle modification ?
I was having a look at it myself, but I’m a beginner so I have a lot of questions…
I guess I did understand how @tomatpasser has coded his plugin but I’m not sure of the most simple way to modify it and integrate this functionality.

Great plugin anyway, but this toggle thing would make it greater !!!

2 Likes