Go Down

Topic: Switch audio sources (Read 3457 times) previous topic - next topic


I am trying to figure out the best way to use an Arduino to switch between audio sources. Say there are 4 audio sources and one amplifier... I want to be able to switch between sources given an input to a button or whatever. I would imagine this would be something to do with relays, but I am searching for a little more guidance, as I am not super knowledgeable. Thanks


You could use an analogue multiplexer. Normally they are used to allow you to switch between several different analogue sources into the Arduino's A/D inputs. But in your case connect the output to the input of the amplifier and the inputs to your different sound sources. Then the logic levels on each select line will select a different audio source to route to your amplifier. You don't even need an Arduino.

You have to make sure that the audio is biased and sized so that the peak amplitude is between the 0 and 5V rails.

This link might get you started :- http://playground.arduino.cc/learning/4051


4 DPDT* relays would work (assuming stereo), but you need a relay driver to drive each relay coil.

There are analog switch ICs.

You may need ~10K "pull-down" resistors on all outputs so the unused/unloaded outputs don't float-up and make a "click" when switched-in.

* Actually DPST relays would work, but DPDT relays are far-far more common.


Forgive my ignorance, but is a DPDT relay a latching relay?


DPDT - DP double pole, that is two sets of contacts. DT double throw, each set of contacts has a normally open and normally closed contact that a common connector is switched between. Normal means the coil is not energised.

Latching relay - one that only needs a short pulse to change the relay state. These sometimes have two coils, a turn on coil and a turn off coil. Once set to a state it stays there with no need to constantly apply electricity to it.


Most relays are not latching, any type of relay (except reed relays?) can have a latching version.

For audio switching with analog switches you can use a +/-5V supply and dual rail analog switch,
the extra -5V supply is extra complexity though, but avoids the need to level-shift which can reduce
switching transients (clicks).

There are probably some nice soft-switching audio switching chips which avoid the switching click altogether - worth googling for something like this, I have a vague memory of such devices.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


There are probably some nice soft-switching audio switching chips which avoid the switching click altogether
You  have :-

I2C three band tone control and 4 input channel stereo mixer - TDA7439


PGA2311 Stereo audio volume control


That TDA7439 looks perfect, although I haven't thoroughly perused the datasheet yet. I'll have to compare something like this to just relays like mentioned before.

Is there an advantage to using something like that PGA2311 to control volume instead of just a potentiometer? I guess the potentiometer route would require one knob to control two pots, one for each channel.


Depending on the quality you want to obtain, relays may work better than electronic switching, but not all relays are suited to audio. The Omron G6K range have worked well for me in the past and there is a 5v version too.

Again the pga231x range of digital volume controls are excellent for high quality equipment, but cost quite a bit. I've got a prototype preamp based on a 2310 with 14v rails, it works very well on my diyaudio honey badger power amp. Incidentally it uses g6k relays too for line switching.
Long time Arduino user who enjoys DIY audio and AV equipment.


Is there an advantage to using something like that PGA2311 to control volume instead of just a potentiometer?
The control in the chip is a proper audio response in decibels so each step change results in the same pecieved change in volume. The digital pots are often linear and so you don't have as much control over the pecieved change in volume. 


I am really liking the idea of using that TDA7439, but the one advantage I see in relays is that I could get some 5V ones. It looks like the chip wants 10.5V. The project in mind would be in an automobile, so getting the proper voltage from the car's 12-14.5V would be doable. Is there a "brother" to the TDA7439 that takes 5V? I tried to find something like that, but I am not well versed in searching out these electronics components. I apologize for my incompetence.


brother" to the TDA7439 that takes 5V
Not that I know of. Most audio works off 12 or 24 volts.


Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


This is going to be a really elementary question. I apologize. Whats the easiest way to hook that TDA7439, with it's pin spacing, up to a standard breadboard. I don't plan on making a PCB or anything.


. I don't plan on making a PCB or anything.
Then look on eBay for an adaptor board.

Go Up