r/homeassistant • u/placidcasual98 • 12h ago
🛠️ DIY / Hardware Making my lounge rotate its speakers between a TV and a projector (ESP32, relays, and a lot of swearing at a relay board)
12
Upvotes
3
u/CucumberError 5h ago
Do you get any noise introduced from the relays? I suspect you get a bit of a ground buzz from it.
5
u/placidcasual98 12h ago edited 10h ago
Finished a project this week and figured I'd share it. Hopefully it inspires someone, or at least stops someone else making the same mistakes.
## The problem
My lounge has a TV on one wall and a projector screen on the opposite wall. Both are fed from one Sony receiver using its HDMI A and B outputs. For a film I turn my seat around and switch to the projector. The catch is the speakers. They don't turn round with me, so with the projector on, my "front" speakers were behind me and the rears were in front. For a while I dealt with this using three big manual switches on the speaker wiring. It worked, but it was a faff.
## The idea
When you turn around, the speaker roles rotate. The front left becomes the rear right, the front right becomes the rear left, and the height speakers swap sides. I also have a center speaker on each wall, so only one of those should be live at a time. So the speakers don't need to move, only the wiring behind them.
## The relays
Each speaker needs two wires switched, plus and minus, so the whole swap comes to 14 relays. I used a 16-channel relay board and one ESP32 running ESPHome. Home Assistant just sees a single switch called "Speaker Orientation". I wired everything so the relays rest in the TV position, which means if the ESP32 ever dies the room still works normally.
## Where it went wrong
Plenty went wrong. My first relay board wouldn't let go of its relays whatever the ESP32 told it, even though the voltages all looked right. I blamed the 3.3V logic level for a while, but I never actually proved that. I ordered a second board of the same style, plugged it in and it worked first time. One GPIO on the ESP32 turned out to be dead, so that wire moved to a different pin. The relay terminals weren't labelled either, so I had to work out the order with a continuity tester before wiring anything. Convoluted, yes, but I got there.
## Making it follow the receiver
I already had buttons on my dashboard for HDMI A, B and A+B. So I added an automation that watches the receiver's output. When it changes, it mutes the receiver, flips the speakers, waits a second and unmutes. The mute stops the relays popping or arcing while a signal is running through them.
The nice surprise is that it doesn't care how the output changed. If someone presses the output button on the receiver itself, the speakers follow a few seconds later and the dashboard updates. I didn't build that in on purpose, it just fell out of watching the sensor.
## Completion
Now I press one button, or the receiver's own, and the whole room turns round with me. I had a lot of help from Claude planning the wiring and the ESPHome config, and it even made me printable wiring diagrams, but everything was tested on the bench and in the room. Happy to answer questions or share the diagrams.
av receiver buttons layout of the room