# How to detect whether an audio output jack is connected to a headphone or an aux input?

IS it possible for the source device to detect what's connected to the audio output jack? Perhaps by exploiting the presence of the headphone's speaker coils and its response to oscillations?

• Long shot, because you'd probably thought of it yourself if there was ... Sometimes there is a small integrated switch on the chassis part. Aug 6 '12 at 8:06
• Why do you wish to detect this? Aug 28 '15 at 15:23

What you want to detect is the impedance of the "load". In one case the load is the headphones. In another case the load is the aux input of the device.

With the headphones, the impedance will typically be less than 1K Ohm (and as low as 4 ohms). If it is feeding an aux input then the impedance will be greater than 1K, and possibly as high as 1 mega-ohm.

Measuring the impedance is difficult, since the impedance changes depending on frequency. And frequency depends on the music or audio program that is being "played". The normal way is to measure both the voltage and current to the load and then do some crazy complex math to calculate the impedance. Most of the time this is done by feeding the voltage and current into an ADC, and then to a DSP.

There might be a way to do a cheap and dirty version that doesn't require an ADC or DSP, if all you want to know is if it's greater or less than 1K Ohm. I haven't given this much thought, however, since everything I've done has focused on the accurate version and not a quick and dirty version.

• Is it really necessary to measure the impedance? Would it not be possible to measure only the DC resistance or alternatively the resistance (i.e. not complex impedance) at one single frequency?
– ARF
Aug 6 '12 at 11:19
• @ArikRaffaelFunke The DC resistance would be problematic, since for headphones it could be very low and for an Aux input it could also be very low for a while (depending on how long it takes the DC blocking caps to charge, and how big the caps are). Measuring it at a single frequency is much better. If your frequency (called a pilot tone) is above 20 KHz then nobody would hear it, too.
– user3624
Aug 6 '12 at 13:31
• Can't you just measure the average current consumption of the driver amp? Aug 6 '12 at 20:06
• @Rocketmagnet Maybe if you're trying to do something quick and dirty. The usual method would be with a current sense resistor on the output. If you place the resistor immediately at the output of the opamp, before it branches off for feedback, then the opamp itself will compensate for the voltage drop and increased output impedance of the current sense resistor. Then you just create a difference amp, fed with both sides from the current sense resistor, to get a current measurement.
– user3624
Aug 6 '12 at 22:29

If you are free to choose the receptacle in the device yourself, you could use a plug with a split ground connection or mechanical detector pin.

1. With a split ground connection: You can then measure whether a small DC current can flow between the two parts of the ground connection. If there is no plug in the receptacle, the two parts of the ground connection will be isolated and no current can flow and vice versa. Note: this will give the attached speaker a slight DC offset.
2. With a mechanical detector pin: with these receptacles, insertion of a plug will break a link. With a pullup/pulldown resistor you can feed this to a logic circuit.