[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Discuss, contribute and orient Volumio development!

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.

[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Postby supercrab » Tue Mar 26 2019 12:12

Hello ladies and gentlemen

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:

Image

Development Page

https://github.com/supercrab/volumio-plugins/tree/master/plugins/system_controller/gpio_control

Schematic

Schematic showing how to wire an LED on GPIO pin 17 and how to control a generic device at 12v.

Warning: Take care when connecting stuff to the GPIO pins. If done incorrectly the Pi can be damaged.

Image

Thanks for looking!
Raspberry Pi Zero | 5Hv2 USB soundcard | LB-Link Wifi adapter | TDA2003 amplifier
User avatar
supercrab
Fresh off the boat
Fresh off the boat
 
Posts: 4
Joined: Mon Feb 04 2019 20:44
Location: UK

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.


[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Postby Volpi » Fri May 10 2019 20:19

Hi Supercrab

Well done in coming up with the GPIO control plugin, which I'd really like to be able to use.

I wonder, if you get time, whether you would be able to read this that I posted just to see if you know of any obvious answer:

gpio-control-plugin-t12273.html

Thanks very much.

Regards
Graham
Random avatar
Volpi
Fresh off the boat
Fresh off the boat
 
Posts: 7
Joined: Thu May 02 2019 12:26


[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Postby supercrab » Sun May 12 2019 17:18

I shall I have at look a post on that thread:)
Raspberry Pi Zero | 5Hv2 USB soundcard | LB-Link Wifi adapter | TDA2003 amplifier
User avatar
supercrab
Fresh off the boat
Fresh off the boat
 
Posts: 4
Joined: Mon Feb 04 2019 20:44
Location: UK


[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Postby Volpi » Wed May 15 2019 09:45

Hi again Supercrab

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.

Thanks again
Regards
Graham
Random avatar
Volpi
Fresh off the boat
Fresh off the boat
 
Posts: 7
Joined: Thu May 02 2019 12:26


[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Postby supercrab » Fri May 31 2019 13:02

It might be worth opening a terminal window and typing

Code: Select all
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 :)
Raspberry Pi Zero | 5Hv2 USB soundcard | LB-Link Wifi adapter | TDA2003 amplifier
User avatar
supercrab
Fresh off the boat
Fresh off the boat
 
Posts: 4
Joined: Mon Feb 04 2019 20:44
Location: UK


[PLUGIN] GPIO CONTROL: CONTROL GPIO WITH VOLUMIO2 EVENTS

Postby Volpi » Mon Jun 03 2019 18:20

Thanks very much for your reply Supercrab.

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)

Thanks again
Graham
Random avatar
Volpi
Fresh off the boat
Fresh off the boat
 
Posts: 7
Joined: Thu May 02 2019 12:26


Return to Development talks

Who is online

Users browsing this forum: No registered users and 1 guest