I am happy to release my plugin GPIO Control which allows Volumio to control GPIO pin states when certain events occur.
With this plugin you can control LEDs and pretty much anything else running connected to your raspberry pi! I currently use it to illuminate and an LED whilst music is playing and when the system starts turns on 12v audio amplifier and illuminate a system on LED.
This is based on tomatpasser’s gpio-buttons.
Tested on a Pi Zero and running stable for weeks now.
I did try supporting PWM which would have been great with the volume changed event but ran into issues. I used a library called pigpio but it required sudo permissions to access the hardware PWM. I didn’t want to ruin Volumio with my implemented with my limited knowledge!
The currently supported Volumio events are:
system startup
system shutdown
music start
music stop
music pause
For each event, a GPIO pin can be assigned from the GUI and the state defined as shown below:
Here is a report on my attempt to use the GPIO control plugin on the Raspberry Pi3B:
Tested with a single LED connected (as shown in your diagram) to indicate a MUSIC PAUSE EVENT.
In settings the GPIO state is ON
Music playing = LED OFF
(First time) pause = LED ON
From then on, whether playing or paused, the LED remains ON.
This is the problem I’ve always had.
I don’t think it’s relevant but the LED was measured to be using below 16mA.
Also, I tried toggling the GPIO state from ON to OFF in the settings (but I didn’t think that would help).
Up until now, I have been using the ‘Amplifier switch’ plugin to light an LED on play. As this is triggered by play status, I did wonder if there may be some conflict with your plugin. So:
To rule out the possibility of any conflict with other installed plugin(s), I flashed another SD card with Volumio and started from scratch installing ONLY your GPIO control plugin. No good, the result was still as above.
Back in the last century, I qualified as an Electronics Service Engineer, but I have not got a clue about programming or even how to see the Pi’s command lines. This is why I appreciate what you developers do to allow us to interface buttons and LEDs with Volumio.
I note that you’ve had steady results with the plugin on a Pi Zero and presume that it should work equally well with the Pi3B. Maybe other users will be able to report their experiences.
It might be worth opening a terminal window and typing
sudo journalctl -f
This will let you see the volumio events being handled and will show you what state the plugin sets them. Once you’ve given it a test send me the log file
Like I said, I know nothing about opening terminal windows / seeing / sending log files so I’ll have to give up on this for now (at least until I learn a bit more about the above, because I would eventually like to use your plugin)
Hi, i have the same result using GPIO-control as Volpi. The LED’s went on (play, pause) but never off.
The LED’s never go off.
I cant’t attach the log file, the upload-function said that the file extension is not allowed.
It’s switch triggers play using the ‘GPIO buttons’ plugin. It’s green LED lights on play using that ‘amp switch’ plugin. (Of course it also lights when triggered remotely via a screen). Note that, as supplied, these arcade buttons are intended for 12v. use - it’s a simple job to change the series resistor to give your desired brightness at 3.3v.
(I also use a momentarily lit blue either side of the green for previous / next tracks - not subtle, but colourful )
Excellent work, I have configured two states to turn off and turn on my amplifier with the start and stop cycles of Volumio.
I use Icepower with the Icextend module, this has a trigger uqe activates or deactivates the amplifiers when receiving 3.3/5v, your system is the only one that has worked properly of all I have tested.
I only have one doubt, the Icextend only needs a boost to trigger the command, and I think that your programming activates the GPIO pin all the time, the Icextend also has a trigger that works with the audio signal, when there is no audio for 13 minutes the amplifiers are turned off, but with your addon they don?t turn off, I guess because the GPIO keeps it on all the time.
I am very new to all this, and sorry if I didn’t understand this correctly, but maybe you can add a function that allows you to change the action from a continuous value to a simple temporary pulse, of for example 1 second, or to an adjustable value.
Have you looked at the AmpSwitch plugin - it allows you to set a pulse instead of holding the GPIO either on or off, for similar use cases like you describe.
I too am having the same issue. I’d like to use the shutdown pin to turn some items off via a pulse. The shutdown output is always on until the unit is booted up. I’d like it to output a pulse when a shutdown is triggered and output nothing on boot up. Is this a possibility??
Hi! Very nice plugin! Use it everyday to trigger my active speakers. Question: Is it possible to implement a delay function? It would be nice if one could set an idle time before shut off, like 3 minutes or so. Right now my speakers turn off instantly.
Hi supercrab,
thanks to your plugin, it works fine in my installation.
maybe when you add some functionality to your plugin, in is possible to add three GPIO Controls to indicate the sampling rate.
Example:
Sampling rate higher than 96 =(176, 192, …) → GPIO 5, 6, 13 are high
Sampling rate higher than 48 less and eq 96 =(88, 96) → GPIO 5 is low, 6, 13 are high
Sampling rate higher or eq than 44 and less 88 =(44, 48) → GPIO 5, 6 are low, 13 is high
Sampling rate less 44 → GPIO 5 is high, 6 is low, 13 is high
Here is a thread, whrere the readout of the sampling rate was discussed
Hi,
Hey this is great, really useful )))
I’ll use it to control an optical Toslink switcher so it switches to the Digi+ Pro when playing and all other sources if not. It will mean modding an RC controlled switcher, however shouldn’t be too difficult.
Cheers,
Malcolm