Go Down

Topic: looking for audio switching relay (Read 290 times) previous topic - next topic

carguy

Hello,

I am thinking about a new project where I would stream music from my Android phone via Bluetooth and an ESP32 board to my car radio's AUX IN connector.

So far so good, the setup that I have in mind so far is to use an ESP32 WROOM dev board, then an I2S decoder breakout with a headphone connector from Adafruit, and then connect all that up to my car radio's AUX IN.

But also, I would like to be able to alternatively feed music into the AUX IN connector on my radio via cable, i.e. by connecting my AUX IN to my phone directly with a cable.

To make sure only one source path is open at any one time, I was thinking maybe switch the audio source with some sort of relay or IC. That is, if there is no live Bluetooth audio connection between my phone and the ESP32, that audio connection is shut off and only the cable connection is open. And then when the ESP32 is paired with my phone, it switches off the "cable" connection so that only the Bluetooth audio gets through to my car radio.

Are there any low-footprint relays or DIPs that can switch a hi-fi stereo signal between two sources for that purpose and which I could control with the ESP32?

davetcc

I've used Omron G6K relays for this purpose before. They can be purchased with either 5v or 12v coil voltage and are quite low current.

You'd need a relay driver, but there are ICs to do that readily available such as the ULN2003A.
Long time Arduino user who enjoys DIY audio and AV equipment.

carguy

Can't the relay just be driven with an ordinary NPN transistor?

davetcc

A relay can be driven by a transistor but it must have a flyback diode across the coil, a base resistor of suitable resistance and also you must ensure the transistor is operating in saturation mode which requires quite a bit of current. AFAIK many 32 bit units have lower current capabilities. With the IC mentioned you can safely switch relays without considering either of these.
Long time Arduino user who enjoys DIY audio and AV equipment.

carguy

#4
Jul 19, 2018, 01:31 pm Last Edit: Jul 19, 2018, 01:33 pm by carguy
ok I have just had a look at the spec sheet for the Omron G6KU-2P-Y. That's probably what I would use so I can handily solder it onto a perfboard.

If I understand its internal schematic correctly, I could connect both stereo sources (Bluetooth audio / cable connection) to just this one relay, and then let that relay switch between them as needed?




The thing is, it says it's got a switching current of 1A. That in itself is not a problem, as my whole circuit including the ESP32 will probably be hooked up to the car's cigarette lighter lead, which can tolerate some 8.3 A (the cigarette lighter socket is rated for 100 W at 12V). Since I don't smoke, the only thing that normally draws additional current from that socket is a plug-in USB phone charger at some 1-2 A.

But because the cigarette lighter is "always-on", even when the ignition is off, a relay that would constantly draw 1A would drain the car battery dead in just 24 hours.

So my idea would be to switch the relay so that in its "switched" state,  the Bluetooth audio source path is open, and in its "unswitched" state, it goes to the cable connection.

Maybe allow a grace period of an hour or so after the ignition is turned off, and then the ESP32 terminates any live Bluetooth connection, and then unswitches the relay and goes into sleep mode, to be woken up again if a Bluetooth connection is reinitiated.

davetcc

One amp this the contact current. IE maximum allowed across the switch. The coil current is more like tens of mA.

It's probably still a good idea to have a stand by mode anyway.

Bear in mind that you don't want any DC build up on either input or the output side of that relay or you'll end up with a potentially loud thump when changing channels. Make sure you have suitable arrangements for prevention of DC at the inputs. Maybe Look into audio dc thump prevention.
Long time Arduino user who enjoys DIY audio and AV equipment.

carguy

#6
Jul 19, 2018, 07:11 pm Last Edit: Jul 19, 2018, 07:12 pm by carguy
I just did a cursory google search on "dc thump prevention", and if I understand correctly, this can be done simply by using pull down resistors to GND?

This is what I just read:

http://www.zen22142.zen.co.uk/Design/dcthump.htm

So how about if I just put 10K resistors both on the inputs and outputs for the two audio sources, i.e. four 10K resistors altogether?

davetcc

I'd try it on bread board first if you can. You will probably Only need DC suppression on the two inputs.

Something else I'd check on breadboard, is if the other line is attenuated enough when you switch with one relay. I normally use a relay per input, to avoid cross talk. The more physical separation the better.

However, IMHO Not even commercial amps costing high hundreds of pounds always achieve complete silence between channels.
Long time Arduino user who enjoys DIY audio and AV equipment.

MarkT

Audio signals (not power) can be switched with miniature signal relays, or reed-relays.  Typically a signal
relay has a smaller ac voltage rating for the contacts that a typical power relay.  For instance: http://uk.farnell.com/c/switches-relays/relays/signal-relays
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

davetcc

@MarkT good point to make and agreed, these miniature relays (and the G6K) is very, very small are only designed for signal level applications such as line level audio.

In this case @CarGuy is fine to use this relay as he is only switching two line level audio signals.

As an aside: Not all signal level relays are created equal when it comes to use in HIFI equipment. I use the G6K-2Y high isolation as many audio sites seem to recommend them as low distortion.
Long time Arduino user who enjoys DIY audio and AV equipment.

carguy

#10
Jul 20, 2018, 12:58 pm Last Edit: Jul 20, 2018, 01:28 pm by carguy
Thanks for all the input.

I don't think cross talk will be a problem, because most of the time I will probably just use Bluetooth Audio as a source. And having a connector for the other, cable based input is probably only going to be relevant when I want to connect other devices to my car radio. It will just be nice to have those two options, and the circuit for them seems fairly easy to build.

The bigger headache is going to be coding the whole thing on the ESP32. So far, a Bluetooth audio library does not exist for the Arduino ESP32 core, so it will have to be done setting up and using an Espressif based toolchain. And that's what I struggle with at the moment.


EDIT:

I just found a project on the Internet where the ESP32 is used exactly to switch audio sources. What do you guys think of the approach (and the hardware components) described in it?

https://hackaday.io/project/46280-muffsy-stereo-relay-input-selector


On this project, they essentially used Panasonic TQ-2 5V relays and  2N2222 NPNs.


MarkT

Looks reasonable.  Personally I'd be worried about the switching topology allowing two inputs
to be shorted together - a tree network would prevent that possibility, but require the signal path
to go through several sets of contacts.  Just be sure to program enough time between de-energizing
one relay and energizing the next to prevent overlap.  Tying each audio output to ground with a 1M
resistor would prevent retention of a DC offset due to the input capacitor of the next stage, prevent/reduces
some switching clicks/thumps maybe.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

davetcc

Long time Arduino user who enjoys DIY audio and AV equipment.

Go Up