A/B Switches

I’m looking for a smart switch to change a source for speakers. I have two amps and one set of speakers. The speakers are either on for surround sound, or connected to whole home audio. This seems like it should be a fairly easy thing to find/ figure out, but I haven’t come up with much. It’s 8 inputs and 4 output. (+/- on L & R). It would be great to find one unit that did that, but I’d even pair up two (one for Left, one for Right).

Any good ideas how I can approach this? Thanks!

Are you comfortable using relays and ESPHome? Or are you looking for an off-the-shelf product?

Relay board?
I believe there are 8 channel boards with ESPs on them.

I’ve not done an ESPHome project before. I’d prefer off-the-shelf, but if an ESPHome project at least has a pre-build board and no soldering, then this might be the time I need to dive into that!

Never bought one and never seen this before but here is an 8 channel relay board
https://m.aliexpress.com/item/1005005050379955.html

Cheap relay boards controlled by ESP82xx / ESP32 are very common and can run Tasmota / ESPhome very easily. Getting a relay to click is easy.

The harder part is understanding the audio path and the impact of switching a reactive load between two amplifiers. Will the amp output stages blow up if switched from 4R to open circuit? How do you guarantee two amplifiers are not connected to the speakers at the same time due to an power-on uC error?

Audio is not my speciality, but strongly suspect commercial speaker selectors include dummy loads (could just be reasonably sized 4R resistors), and break-before-make mechanical switches. And that’s before considering the real rating of $1 relay contacts!

Using a four SPCO relays wired to one GPIO might work to switch two channels, with one speaker using NO and another NC on different relays, with dummy loads as needed on the other relay contact. The idea being that hardware (not software) prevents amps being connected - but then the time taken for a mechanical relay contact to move could still cause glitches.

I’d suggest researching commercial switchers, and your amplifier manuals - and don’t rely on software to turn OFF an amp before switching speakers. Hardware interlocks aren’t hard, especially when you’ve got a bank of 8x SPCO relays to play with.

Using the word relay vs switch has helped my Googleing a lot. I found the following post and will try to make contact, because the board they made looks like what I would be embarking on:

I have never tried using relays on speakers myself, but I know a friend at work did that connecting the baby monitor to the speaker system and have it trigger the relay with the LED turning on on the baby monitor.

I’m not sure I understand the " two amplifiers are not connected to the speakers at the same time", relays are binary, I don’t see how they could be both on and off at the same time.
The speakers could get out of sync with sticky relays.

Relays are binary only in modelling software - they are analogue mechanical systems, with all the contact bounce, delay, and make-before-break / break-before-make imperfections that can bite.

Amplifier outputs are usually push-pull drivers (i.e. not 0V and +/-40V), originally driven by matching transformers, these days by arrays of MOSFETs. This means you need to switch two wires, not one.

Typical “cheap” relay boards use $1 copies of Omron relays with one SPCO contact. To switch one speaker to two amplifiers therefore requires two SPCO relays as both terminals could be (say) +40V or -40V.

You might be lucky and your amp might use something like a dedicated TDA chip array with short and open circuit protection, but one day the relays might switch at the peak of a drum solo causing an impedance mis-match, and a surge, and an escape of magic smoke. :boom:

Making hardware development accessible is great, however the downside is less experience in designing resilient systems - e.g. you could use two relays per channel, driven by two GPIOs. Reboot the ESP with a bad choice of pins, and insufficient decoupling, and find one pin high; one pin low, leading to potentially two dead amps.

A better way is still two relays, but with one GPIO guaranteeing in hardware that even if the microcontroller gets in an odd state, the outputs will always be in a safe state. Of course, one DPCO relay would also work but that still leaves what happens to the amp when the load does from 4R to open circuit.

I suspect manual switcher designs assume the user will turn the volume down before switching - something harder to arrange with automation.

An even better way would be to mute both amps, switch at low volume, then unmute, but that’s a lot more hardware and wiring inputs and outputs to the same relay board is asking for feedback paths. Two 4x relay boards, with one set connecting (say) 1k mute resistors to the amp inputs?

Of course, an AV receiver typically does this internally with input and speaker switching - perhaps an old one with an RS232 or IR interface might be easier? (kind of shifts the problem to one of getting the latest 5k HDMI signal and 88kbps DAC into an old receiver amp though!)

1 Like

Great information! Thanks.

I wonder how the physical switchers work. I also found this, which is now discontinued (and I ordered one cheap on eBay): https://www.amazon.com/Niles-SPK1-FG00240-Speaker-Switcher/dp/B000761NRQ

Looks like it just gets triggered from a 12v source and it’ll flip over to the other set of speakers.

That Niles box you linked looks a lot better, and designed for automation.

Another approach is to add an extra line input into the AV amp - e.g. from a SONOS Connect.

Even if the AV amp doesn’t have a spare input, a resistor and decoupling capacitor connected to (say) a volume knob terminal might work (volume pots are typically between the preamp and main power amp, so can be a useful spot to add inputs). It’s a hack I’ve used, but that was more for PA sound rather than Hi-Fi.

I just started last week doing the same thing. I have a Sony Amp with an actual physical speaker button. For that I bought a SwitchBot Bot to press that button. More on that in a sec. I also want to change around a few sets of speakers. smaller for TV listening and larger for rock the neighborhood listening. For that I made a “smart speaker switch”. Just a 4 channel sonoff type relay board. I started with inspiration from this guy… Building A Smart Speaker Switch — Creation Station. Got knock off board from ebay and was lucky enough to find a detailed page on setting it up with Tasmota at the blackadder template pages.

Now back to the switchbot. I have it hooked up and working (just got it today). And now I need to figure out a good way to have HA save the “button” states of the amp. The Sony’s speaker button runs through “Speakers Off” “Speakers A” “Speakers B” and “Speakers A & B”. I have searched google just a bit so far not coming up with much. Figuring out the terms to search for is sometimes half the battle. Might be a template I need or maybe a slew of boolians. Not sure. Gonne go ask chatGPT now. I call her Cathy btw.

For the nerds among us, if you’re going the ESPHome route, consider that you may be able to use MOSFETs instead of relays. They’re silent, small, and cheap.

I want to do this but am afraid of blowing up my hifiberry DAC. I found this thread when looking for examples on how to use ESPHOME to control zones for wired outdoor speakers.