Toggle speaker input using GPIO pins in piCorePlayer?


I've modded an old tube radio some years ago, but back then, I "simply" stripped a regular SqueezeBox (classic one, from before Logitech even) and a standard amp of its case, and most modding was integrating them into the radio.

Then came some boring SqueezeBox Radios...

And now I want to extend our home audio system with two or three further modded tube radios. I bought some broken 60-80 year old ones, and started working on one. I grinded and repainted the case already, removed the old hardware carefully, then noticed what I bought as broken is still working as a class FM tuner.

Since this is going to be a present, I thought about making the mod even better. When turned on, it would play as a nice radio, and as a second surprise, it plays everything else. Instead of removing the broken tube radio stuff, my idea would be:

RPi3 & HiFiBerry AMP+ & piCorePlayer (already bought and set up) added to the case, with their power supply connected to the existing power switch to have them turn on when the radio is turned on.

Some kind of "switch" (transistor, relay) for the speaker, so that ideally, when the player software is "off", the old radio would be connected to the speakers, and when its "on", the new system would be (SqueezeCenter users know what I mean).

Which probably means I need:

  • A GPIO pin not used by the AMP+ I could use to control the "switch".
  • A relay probably that can be controlled by the probably low GPIO output, or
  • A transistor on the GPIO pin that toggles the 12-18 V to toggle the relay.
  • An idea how to mod piCorePlayer to toggle a GPIO based on the power state of the SqueezeLite player software.

I did some custom hardware like twenty years ago, so my skills are a bit rusty, but I know to hold the soldering iron and this sounds quite easy still with some hints (and like mighty difficult to research from zero RPi hardware knowledge).

Can anybody hint me at a GPIO I can use with a HiFiBerry AMP+ already connected, and what kind of hardware I can use to use that as a switch? Are there breadboards with existing RPi connectors I could use to simply add transistors and relays?

I've seen the similar post about turning on an external amp, but that was about a DAC, not AMP+, and the playing status is not fit for my use (imagine it reverting back to standard radio when an audio book has stopped... no good for sleeping time).

For the software side, there's a multitude of options... the worst but most simple one would be to use my home automation reacting to the change of a power state (FHEM supports SqueezeCenter) by sending a http request to the RPi that would toggle the GPIO. Similar "ugly" would be a SqueezeCenter plugin triggering the http request (I would have to learn Python, or was it Perl, plus the SqueezeCenter plugin framework). Ideal would be something running on the RPi itself, either within the player software (which would be the best), or at least a way for a daemon to read the state locally. Any hints on that road would be appreciated as well :)


Please sign in to leave a comment.