[Plugin] GPIO Buttons: Control volumio2 with buttons

Hello ladies and gentlemen

I am happy to release my plugin GPIO Buttons for you to control the volumio2 player with physical buttons.
With GPIO you can add buttons, LEDs and other stuff to your raspberry pi.
For a full explanation; go to the website on the official raspberry pi website: https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/

In this release the feature list is quite short, but enables control of basic player actions:

  • Play/pause
  • Vol+
  • Vol-
  • Next track
  • Previous track

For each action, a GPIO pin can be assigned from the gui as shown below:

For wiring and installation instructions visit the development page

Warning: Take care when connecting stuff to the GPIO pins. If done incorrectly the rpi can be damaged.
I am not to be held responsible for damage to electronics, humans or poor animals.

Download
Current version: 0.7.5
Most recent version always available here: Download

Development
https://github.com/tomatpasser/gpio-buttons

Video showcase by klokslagB

Thanks to klokslagB and balbuze for help with initial testing!

1 Like

Great work!! Really eager to try it and to add it to plugins list!!!

hey great work.
also looking forward to trying it! is it possible to extend to the use of rotary encoders?

best regards

paul

Yes, it is possible. I wasn’t able to make it for the initial release.

What about a PR? So we will include in the repo and people will be able to download and enjoy it… it seems stable enough!

You mean like the Spotify plugin or? How would I add it?

That’s a great news… I have to try this plugin…
Does it work also with odroid or just with raspy??

Great work. Maybe some feedback for improving the user interface (configuration):

I would like to see something object-oriented-style:
When you enter configuration for the first time, it’s empty with a button to add a gpis object: A popup comes up where you can select which kind of gpio object you want to add: Input: Button, Rotary encoder, etc. Output: LED, etc…
After selection you can select the physical ports that are connected to the object and finally you get a selection of possible action that can be assigned to classic actions of your gpio object: Button: Press, Release, Rotary: Turn left, turn right, Rotary with button: press, release, turn right, turn right when pressed, etc…
Suitable actions that can be assigned would be skip, fast-forward, loudness, play/pause, etc…

for the output part, e.g. led, one could think of something like a status indicator but i think that would be a bit overkill. Maybe first restrict this plugin to input rather than gpio

Currently it is for rpi only.

Thanks for the feedback! I had some of those thoughts myself when creating the initial version. Ultimatively I had to make it like this because the plugin platform in volumio2 is not very flexible yet and you can’t create lists in the configuration gui. In the future I would like it to be kind of as you describe :slight_smile:

If you need more layout elements, we could add them. Of course plugin UI is very limited now, because we encountered only few use cases, but thanks to your feedback we could add something like this…

Can you add the O(utput) in GPIO as well ?

It think it would be great if you could setup an output that can switch on/off an external amplifier based on the fact that volumio is playing something or not.
So you can set PIN X to go high if volumio starts playing music, and go low again after x minutes of not playing anything anymore.

i love using volumio so much that i threw out my audio set and hooked it up to a dedicated homebuilt gainclone amp and homebuilt speakers… The volumio pi never gets switched off but it would be great if volumio could turn of the amp after a while…

I do have a very similar use case and therefore like the idea, nevertheless i think that tomatpasser’s plugin should move away from the claim of handling GPIO - as the name suggest: General Purpose - as the use cases are way to vast to be included into a single plugin. So rather than clogging up the plugin with a huge set of features that are distributed to everybody, it should focus on “physical user interface” or “physical playback interface”.
If we implement the aforementioned functionality of switching an amp in a dedicated plugin, this plugin can be really streamlined (I’m thinking of just one drop-down to select the pin that drives the amp and maybe one to select the device if we can’t implement auto-detect) and only those people that have a use case for this scenario have to install the plugin. Maybe you could post this functionality to the plugin wishlist thread, so it will not be lost.

@michelangelo: Is there some api where we could poll/listen/observe/interrupt whether something is being played or not on a global basis (i.e. shairport/mpd/etc.)?

Maybe a good idea gpio output for command a analogic motorized potentiometer linked to software volume regulation of volumio ui (i think that this are a dream i suppose)

Inviato dal mio ZUK Z1 utilizzando Tapatalk

Hey tomatpasser, great work! I added this to Volumio plugins repo, so now it will be visible to everybody!

PS: I linked the zip to your website, is that ok with you?

I wasn’t able to install it from Plugin menu :

Downloading plugin at http://tomatpasser.dk/gpio-buttons.zip END DOWNLOAD: http://tomatpasser.dk/gpio-buttons.zip Creating folder on disk Unpacking plugin Checking for duplicate plugin Copying Plugin into location The folowing error occurred when installing the plugin: Error: Error: EACCES: permission denied, link '/data/plugins//gpio-buttons' -> '/data/plugins//miscellanea/gpio-buttons'
I tried to restart RPI before install, then stopped and launch volumio with sudo, same issue.
RPI2 + HifiBerry DAC+
System Version: 0.979 Released: Sat Aug 20 18:39:20 CEST 2016

Of course, I will make sure to keep it updated. (Sorry for not replying to this, been a bit busy!)

I did already what you ask and it’s been working in my setup for a long time without issues.
Use the script gpio.tar.bz2 from volumio-customisation-script-nas-share-included-t1382.html

Further info:
turn-off-external-apparatus-from-volumio-t593.html

Hello,

Very interesting plugin.

I installed it, but I can’t get it to work. When I go to the settings, I get the setting screen as expected, it behvave as expected, but it looks like the ‘SAVE’ button does not work. When I come back to the settings, all GPIO entries are unset. :confused:

Now it is even worse: I deactivated the plugin, and when I try to reactivate it, he does not want because the GUI thinks it is active (see the “Active” bullet, and the activation button on “Off”). :frowning:

Worse, I deactivated Spotify to try, and can’t activate this one anymore either… :cry:
plugin activation.png

When I click on the on/off buttons, I get the following creen for 1/4 of a second, then it goes back to the screen above:
plugin activation dissapears.png

Can you help solving these 3 issues?

Thank you!

Yes there is something wrong in plugin management… The only way to reactivate a plugin is to edit /data/configuration/plugin.json and replace “false” by “true” in the section of the concerned plugin

Merci beaucoup balbuze, plugins are now active again.

The corresponding section is now:

"gpio-buttons": { "enabled": { "type": "boolean", "value": true }, "status": { "type": "string", "value": "STARTED" } }

But see my next post…

Regards!