Audio output selection courtesy of the Internet

[Peter] was tired of crawling behind his desktop computer to switch between headphones and speakers. We feel his pain, as the headphone port on our computer speakers has its own demonic hum rendering the jack useless to us. His solution was to build this output selector board, then control it via the network.

A relay is responsible for routing the single input to one of two outputs. One output is wired to the normally closed pin on the relay, the other to the normally open pin. The important thing here is to make sure you have a separate audio ground so as not to pick up noise from the rest of the hardware.

What you see above is only the switching circuitry. This is where [Peter] went a little overboard, using an Arduino along with an Ethernet shield to drive the relay via a transistor. For this particular application there must be an easier way. But if you’re working on home automation from your smart phone, this might be just the thing to make your audio setup browser-controlled.

[via Build Lounge]


  1. Hackerspacer says:

    Isn’t it possible to just use an Arduino and ethernet shield to accomplish this? Why involve a relay at all? Just use the Arduino to buffer and “stream” the inputs? The voltage range and sampling rate should be sufficient?

  2. pascal says:

    I have a 50cm Y-cable…? Cost about 2EUR (~15USD)

  3. Bogdan says:

    As he is probably using a desktop, a parallel or serila port might be available. With 5 V from a usb port all you need is basically the relay driver he used for the adruino. Usb probides the power, the parallel/serial port provides the control.

    There is no need for ethernet or anything… since he is using the audio from the pc, a pc will always be on and available.

    Or you can take the simple route that i did:
    Bring the jack on the desk and use the jack itself to switch to the headphones when you plug them in. Or use switches to turn on/off the headphones/amplifier as source. Whichever fits you better, the bottom line is using just some jacks and cable, cheaper than anything.

  4. sneakypoo says:

    I went with a somewhat more low tech approach. It’s simply two limit-switches being tripped by the weight of my headphones. Works well enough for my non-audiophile ears.

  5. HackTheGibson says:

    I ran my audio through an extra stereo receiver I had. With an A channel and B channel I just swap to which one I want to listen too with the remote. I know it isnt a hack, but it costs about the same and gave me a better quality.

  6. wartron says:

    I needed something like this a few years ago, and took a very naive approach.

    Just upped some pics.

    Basically a double pole switch connected to 1 input for 2 outputs.

    Again I made this ~6 years ago, please tell me why what i did is a bad idea.

  7. fdawg4l says:

    Wouldn’t a well chosen small value decoupling cap on the audio ground to the headphone jack of his PC have fixed the hum? Chances are the grounds are close together or, worse, tied.

    Just trace back the leads to the chip amp from the audio out, find the white paper w/ pin out, and check the grounding. My theory is A_GND is tied to the powersupply ground without a decoupling cap.

    • jordan says:

      I was about to say something along those lines!
      My desktop’s front panel audio shared a common ground across the audio and usb and anything else I could connect up there. the interference was horrendous!

      I simply cut the ground trace between the audio and everything else. It worked perfectly with my sound card :)

  8. Evan B says:

    Instead of, say, a headphone jack with a passthrough to the speakers if the headphones aren’t connected? Or just a DPDT mechanical switch?

    We need a new tag, ArduinOverkill.

  9. Mark Roy says:

    You could also accomplish this quite easily using a cheap USB pic. Gets power and interface via USB.. still probably overkill for something that could be accomplished by a y cable.

    • ScottInNH says:

      You can’t really equate a PIC as an alternative to an Arduino -unless- you completely ignore the usability and programming baggage and learning curve that the PIC choice would entail. It’s like saying you can replace a minivan with rock climbing. :-)

      But yeah, Arduino overkill. All I did to solve this exact problem was run an extension socket to the front of my desk, underneath.

      • diego says:

        Well to each there own. I have no idea how to use an arduino, all I’ve ever used is PIC and assembly language. Never learned C, although I would like too soon, as it seems most projects are in C. (arduino uses C right?)

      • ScottInNH says:

        Arduino is most commonly coded in Wiring (C without pointers etc.), but you can use straight C, or assembly.

        The real usability of Arduino isn’t so much the language, it’s more the integration and documentation and somewhat standardized mass produced system board. It’s almost an embedded computer, rather than a MCU target.

        I’ll happily use one of the PIC-based Arduino clones once they’re fully supported by the Arduino IDE and common libraries, and I wouldn’t ever know the difference when they sufficiently abstract the micro beneath.

      • Evan B says:

        I think you’re taking the PIC comment a little too seriously. Embedded systems design is all about determining what is _appropriate_ for any particular problem, and the minimalist solution is often the most elegant.

        To use your example, the guy needs to climb a wall to get to the other side, not drive cross-country to get around the wall. Would you give him a Minivan or Rock Climbing equipment?

  10. I’ve considered doing the exact same thing with my home automation audio setup so I could route music (from the same channel) through different speakers. Or even enable them all at once.

    But is the audio quality acceptable? I’m not an audiophile, I can’t even hear the difference on most Youtube 480p and 1080p videos? (As many say you should be supposed to do?)

  11. Taken up a couple notches for home automation.

    Watch the video to understand its full effect.

  12. Asshole says:

    Hum… this gave me a idea, i will use a arduino to act as a controller on my flush toilet.

    So when i press a button on a breadboard, the arduino makes something move the flush mechanism.

  13. vlad says:

    This got me thinking. Wouldn’t it be possible to make a very simple circuit that would be triggered by a very specific frequency sent through the audio? And then trigger the relay.

    • Absolutely says:

      Yes there’s a very easy circuit that’s triggered by a specific frequency. As others said it’s called a “DPDT Switch” and the frequency is pretty tolerant – any old rising or falling edge at any speed will do.

      Seriously folks, this is crazy talk and gives things like the Arduino a bad rep. Fun little project maybe, but about a gazillion times overkill and takes orders of magnitude more time to switch the audio (move away from your game or work, launch program/browser, click buttons).

  14. Garbz says:

    MY GOD!

    Ok quick though of ways to do this sorted by easiest to most difficult, and similarly sorted from cheapest to most expensive:

    – Use a y-splitter
    – Use a simple switch wired to the front of the chassis to switch the audio lines
    – Use a switch to switch the relays if need be
    – Use 2 opamps configured as simple buffers giving you 2 dedicated outputs

    Ok ok I get it Aduino.
    – Use the Parallel port
    – Use the serial port
    – Use the USB port

    But really? An Ethernet shield? For something local?

    I REALLY hope that this was nothing more than an educational experiment to do something with Ethernet.

  15. KillerBug says:

    I tried this a while back and I see he made the same mistake I made the first time…his wires are not shielded. I bet his speakers make a terrible noise when he makes a cell phone call.

    I later came up with a better idea…using high resistance pots let me mix and swap channels; I can use the right channel from one source with the left from another, I can mix the stereo channels together at various volumes, and I can shut off channels too.

  16. marsrover says:

    I use a Y splitter, the sound quality is fine. Unless your driving huge studio speakers (if you are you should have headphone out and line out on your computer) It’s fine.

    That, and I have a headphone port on the front and back of my computer, so it’s not that hard to reach up and swap them.

  17. GameboyRMH says:

    Wow, this is the most overkill project since the Arduino water-cooled LED blinker.

  18. erich says:

    Audio coupling transformers will eliminate ground loops. Google packet or psk or data interface for amateur radio for design ideas.

    Perhaps an i2c controlled AV switch as well…

  19. Dylan says:

    A simple 3.5mm spliter works just as well. Just turn off the speakers when you dont want them.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,687 other followers