# Can a voltage divider be used for (input) jack detection?

I would like to detect when a jack is plugged into my connector. The circuit looks like this:

One end of the jack is connected to a speaker, and the other to an audio source, such as a phone or mp3 player.

Basically what is drawn is what I'm making. The main thing here is to connect the phone and the speaker, with the goal being to either use bluetooth or the jack connector in question based on whether the jack is connected or not.

So, a cable goes from phone to jack, jack is connected to speaker. Arduino needs to see whether jack is connected to phone or not.

Will this work for detecting if a jack is inserted, without damaging any components, particularly the audio source and speaker?

Note: I would use a jack connector with a detection pin. But with a 4 pole (TRRS) jack, I haven't been able to find any (or they don't exist...). PCs seem to use the codec for this purpose, and phones don't seem to have a detection pin either. I have a 7 pole jack connector for example, and it doesn't have a microphone terminal, it shorts ground and mic.

• There are schemes which could work but the one you have drawn would not. You're going to have to use the edit button and make this a lot more specific - which end of the connection are you implementing - are you the "phone" or the "speaker" or some speaker/mic combination, or what? Sep 10 '20 at 14:27
• And TRRS jacks with a switch are not remotely rare, a place like digikey has many to chose form. Sep 10 '20 at 14:31
• As well as sockets with a detection pin there are sockets with 2 pins that make contact with the tip, but not with each other (unless a plug is inserted). I've used them in TRS, (not TRRS) but the last phone I took to pieces either had one like that or a switch that had a common connection to the plug contacts. Unfortunately I couldn't find a replacement the right size (this aspect of the socket has failed). Sep 10 '20 at 14:43
• One scheme uses the fact that the mic pin usually has a bias voltage to power the mic; such as 5V via about 5 kilohms. Pull that pin to 0V via 1.6 kilohms and the system concludes a plug has been inserted. That's how the Ipad switches from its internal mic to an external one but you could use it for other purposes. Sep 10 '20 at 15:07
• @ChrisStratton I am the speaker. Basically what is drawn is what I'm making. The main thing here is to connect the phone and the speaker, with the goal being to either use bluetooth or the jack connector in question based on whether the jack is connected or not. So, a cable goes from phone to jack, jack is connected to speaker. Arduino needs to see whether jack is connected to phone or not (so whether cable is there or not, preferably cable is always there but phone not always). Sep 10 '20 at 15:07

TRRS jacks with a detect switch are not at all uncommon if you go to an actual electronics supplier, they may only be seeming hard to find if you are shopping hobbyist offerings on general ecommerce sites.

Doing electronic detection as the receiving end of an audio signal will not be easy, as you know extremely little about how the source works. For example, you cannot really use a DC test current from a pulling resistor, as don't know if the source presents a DC path at all, or if it relies on a DC blocking capacitor.

In theory, if you wanted to badly enough, you could implement some sort of threshold detection and pulse stretching with a comparator or MCU ADC input which would see the presence of an AC signal. But the problem with this is that it would treat silence as unplugged - which is probably not what you want.

If you absolutely had to do this electronically, you could do something really fancy, such as periodically injecting a weak ultrasonic AC signal and seeing if there was a source impedance loading it, but that's getting to the point of absurdity when there's a simpler way.

Realistically, just buy the readily available correct part, with a switch, and move on to the interesting parts of your project.

That's almost certainly what existing wired/BT dual mode speakers on the market do.

• So, detecting using a circuit is really only remotely feasible if you are the "sending" end of an audio circuit eg audio source? Sep 10 '20 at 15:32
• It might be better to say its moderately feasible for the sender and only remotely so for the receiver. Even sender circuits can cause issues though - I spent several fun days debugging the source of loud "thumps" on boot in a product which had an Android board permanently connected to an amplifier, turned out the stock audio driver was applying current pulses to measure the impedance of whatever was connected. Fixed it by adding a resistive load impedance and then replacing the testing code with a simple assignment of its result. Sep 10 '20 at 15:35