I wonder if a PIO pin trigger output is possible or 3.5mm

@spockfish Harry I wonder if it would be an easy thing to have an IO pin go high when play is started and perhaps time out after say 5 mins when play is stopped?

I am asking as a lot of devices that are connected to RPi’s like amps, DACs and pre/processors etc could be turned on/off if such a trigger output was available. I guess it might be a bit more the DIY types here that might use such a thing but I couldnt think of another way to patch this in without doing at the ropieee OS level.

Im not sure f the 3.5mm audio jack could be used to provide a trigger type output level with a PWM signal maybe directed to it.

Might have to google some things on that option.

Maybe the MUTE line could be used with a buffer and a small cap to hold the signal up for a time to allow for gaps and short pauses. But then this wont work for USB connected DACs

Food for thought in the winter months :stuck_out_tongue:

3 Likes

Hi,

This is an interesting idea. In general this is feasible: Roon’s API provides this information, so yeah.
Doing this via GPIO would be rather easy; your suggestion with using the audio jack sounds more complicated: there is no low level access to this port, other then via a normal audio channel.

Thanks Harry, yeah I goggled around for the 3.5mm possibility and came up empty handed. Maybe @Jan_Koudijs might have some thoughts if it an extension possibility. I do wish I could code so often these days…but my skills are more on the hardware side unfortunately :blush:

I agree with @spockfish, the Roon API provides the basics to make this happen.

The extension should be able to access the GPIO pin, and therefor has to run on the RPi. A quick Google shows that there are solutions for this:

https://www.npmjs.com/package/rpi-gpio
https://www.npmjs.com/package/onoff

It would require some circuitry to get the correct voltage level (typically 12V) and allow it to supply some current. Re-purposing the audio jack might be difficult, it is probably easier to use a prototype HAT and build a circuit on that. Not sure what the circuit should look like.

Most triggers I have seen will operate from 5v to 12v and as there is no voltage on a RPi more than 5v unless it’s running a hat that might have it supplied, any diy effort would have to perhaps connect to an external trigger interface to bump a 12v supply out to higher trigger levels, using a simple transistor interface is probably good enough.

@spockfish any thoughts having this in a beta that when the display is active a pin on the PIO is made alive +5V

I’m not a software type so trying anything extension wise for me is out of my league…but if we can get a PIO to turn on and off when the display is on showing tracks… then we could power up a pre/amp and shut it down again when the clock comes on or it blanks off. This way it follows the zone. Maybe if this works it could perhaps be like the OSMC and have a zone configured and maybe even a PIO that is known to be safe for audio hats to not get upset.

Yes, this is rather simple to achieve. The only thing we need to decide on which pin :wink:

Ok great maybe it can even be a selection of several pin options in the setting. Maybe I can figure out something that work based on some testing with some small app based setup that’s on the web…hold that thought :smiley:

Any progress on this?

I haven’t had time to think about it to be honest.

Something like this maybe but could probably use 12V supply to the switch if 5V wasn’t enough to trigger the equipment from the Pi… I just got a proto board and some relays and connectors etc to play with this.

@spockfish lets try PIO4 but make it optional to turn on the feature as if there is a HAT on the Pi then maybe we need to avoid having it activated. Or maybe you have a better pin too use that most HATs wouldn’t use?

Went to my local electronics mall and found this for a few $ but need to downsize the relay I think…its pretty much overkill for a trigger switch. :blush:

but I need something to try and trigger it with not sure with the Ropieee build if there is anything PIO command related…maybe have to blow a raspberian image to play with it

No need. You can use the gpio command that is installed already.

OK for GPIO17 & GPIO4 how do I toggle it… I tried

gpio toggle 17 

gpio toggle 4 

and this did nothing even multiple times using the GPIO 4 and 17 (pins 7 and 17 respectively)

gpio -g mode 4 out also didn’t help

If I pull the IN line low I get a change of state on the relay so its working but the pins are not active it seems.

Any ideas?

gpio readall
Oops - unable to determine board type... model: 17

using a RPi4. Relay board seems to activate on a 0V (GND) on the input pin.

OUCH

[root@XL55RPi4 ~]# gpio -v
gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Segmentation fault (core dumped)
[root@XL55RPi4 ~]#

seems maybe its all different on a pi 4

Seems like the pinouts and names differ from model to model too…aaaarrrrrgggggg

on my 3B+ its fine for GPIO readall

[root@DiningRoon ~]# gpio readall
 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | ALT0 | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |  OUT | 1 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 | ALT0 | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | ALT0 | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | ALT0 | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
[root@DiningRoon ~]#

welcome to the wondrous world of GPIO on the Pi :wink:

Anyways, I would suggest to figure it out on the 3B. In the mean time I’ll figure out what to do on the Pi 4.

Thanks Harry…I bought a couple of the relay boards, but was also planning on designing my own pcb to make some…might be more hassle than it’s worth designing a dedicated unit unless there is a lot of interest.

Already updated the package, so with the next update this will be solved.

1 Like