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]

37 thoughts on “Audio Output Selection Courtesy Of The Internet

  1. 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?

    1. You probably wouldn’t get anywhere near the required sampling rate from an AVR microcontroller. If you wanted to make it solid-state you could consider using something like a CD4066 analogue switch IC though which you could control directly from the Arduino for up to 4 sources, but a relay will always give the best audio performance since it is completely passive in the audio path.

  2. 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.

    1. That is actually a fantastic way to do that.

      Though this is what i don’t like about Arduinos. They are being used when they are incredible overkill. Have a 1/8′ jack that when you plug into it the speakers become disabled. The jacks he is using can be wired this way. 99 cent part.

  3. 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.

  4. 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.

    1. 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 :)

    1. 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.

      1. 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?)

      2. 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.

      3. 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?

  5. 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?)

  6. 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.

  7. 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.

    1. 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).

  8. 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.

  9. 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.

  10. 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.

  11. Wow, my shameful past as caught up with me :)

    Seen this linked on another article. Think I may still have that bit of veroboard lying round somewhere.

    Totally agree it was overkill, but in my defence I was bored and it was raining, dammit :)

Leave a Reply to GarbzCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.