[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”
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?
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.
I think Hackerspacer is joking…
Actually, I hadn’t read the post.
Can someone say “overkill” ???
You would need a DAC as well to output the data, which an arduino lacks. Even so, the ADC available is nowhere near audio quality.
Where you have digital output pins you have a DAC, just add resistors. But.. yes, the sample rate would be no where near useful. I think…
I have a 50cm Y-cable…? Cost about 2EUR (~15USD)
Much cheaper on ebay if you can wait a few weeks for it to get here from china.
I’ve done that too. It changes the impedance though which messes up the frequency response. In other words… y-cables don’t sound as good.
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.
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.
Ingenious and well done!
Nice cans as well.
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.
A much better hack than the original post! Nicely done!
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.
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.
Because it’s in an Altoids tin!
Those “mints” are terrible.
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.
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 :)
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.
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.
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.
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?)
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.
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?
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?)
Taken up a couple notches for home automation.
Watch the video to understand its full effect.
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.
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.
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).
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.
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.
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.
Wow, this is the most overkill project since the Arduino water-cooled LED blinker.
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…
A simple 3.5mm spliter works just as well. Just turn off the speakers when you dont want them.
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 :)
Please be kind and respectful to help make the comments section excellent. (Comment Policy)