20

I have an android phone to which i have plugged an earphones. So at the top of the phone, I get the headphone symbol which indicates that the earphone is connected (In other words, the circuit at the 3.5 mm jack is closed).

Then I cut the two earphones (transducers) from it, and still the headphone symbol shows. When I later cut this cable, below where it branches out, even then it shows circuit completion.

So my question is this:

How does the phone detect circuit completion at the 3.5 mm jack and thus trigger all sound and music to be directed through the 3.5mm jack?

Gautham
  • 347
  • 1
  • 2
  • 8
  • 4
    It probably depends on the phone. – endolith Sep 01 '16 at 20:20
  • 2
    Funny thing - after reading all the answers the comment by @endolith above seems to be **most precise** one :) Mechanical switching of audio lines was used before and probably still used somewhere. Mechanical switching of digital presence signal is newer but also obsolete. Electrical detection of TRRS insertion and headset function is current but plagued by many competing standards. The idea of detection chip in old Apple headphone plugs is probably urban legend, though – Maple Sep 03 '18 at 16:56
  • 1
    Maple, there was an identification IC in Apple headphones from very early iterations on. The iPod 3G had an inline remote control on the headphones, where the buttons would simply impose a resistance between ground and what now would be a microphone pin (the iPod headphones didn't have a microphone). However the functionality was disabled unless the IC in the headset gave an ultrasonic identification chirp when initially connected. The chip is not the fundamental method of identifying that headphones or headset is connected though, it's only needed to distinguish genuine headphones. – Siana Nov 08 '19 at 08:29

6 Answers6

27

Headphone jacks have extra contacts inside, which act as switches. The the drawing below, pins 4 and 5 are intended for sensing that the plug was inserted. They are not intended for audio signal. When the plug is not present, the switche, which are formed by 2 & 4 and 3 & 5, are closed. When the plug is inserted, these switches are open. The plug flexes 2 and 3 slightly, and they break contact with 4 and 5. You could insert a 3.5mm plastic rod [a dummy] into the jack, which will open the contacts, and the phone might think that earphones are plugged in.

enter image description here

Source: datasheet for a typical stereo jack.

Nick Alexeev
  • 37,739
  • 17
  • 97
  • 230
  • 1
    So then, the circuit completion is *purely* based on the girth of some material inserted into the jack socket, rather than any electrical circuit attached to the 3.5 mm jack? – Gautham Jan 06 '14 at 07:04
  • 2
    @Gautham Surely that was the way that was done in older devices, these switches basically muted the speakers when the headphones were plugged in. I'm not sure if smarter devices like Android actually test the resistance or other parameters to detect the headphones rather than rely on these switches but it is certainly possible. A search showed that there are several (program) events and properties in android to detect if earplugs are plugged in like noise in the mic line but I don't have any hardware links. – alexan_e Jan 06 '14 at 11:00
  • 3
    @Nick Alexeev: What you have sketched is a switched jack plug which, on older equipment would have had the internal speakers connected on 4 and 5 to 1. Plugging in headphones would connected them to 2 and 3 while disconnecting the internal speakers. It _could_ be used to electrically detect change in resistance but it may be easier to use the movement of 2 to actuate an isolated switch contact. – Transistor Oct 21 '15 at 17:12
  • @alexan_e Here are some hardware links for you - [plug](https://source.android.com/devices/accessories/headset/plug-headset-spec), and [jack](https://source.android.com/devices/accessories/headset/jack-headset-spec). Note this: "Plug insert notification must be triggered only after all contacts on plug are touching their relevant segments", which implies more than pure mechanical insertion detection. – Maple Sep 03 '18 at 16:27
  • 1. This detects if a plug is inserted, but doesn't distinguish between TRS headphones and TRRS headset. 2. "They are not intended for audio signal." In other contexts they do carry audio signals. Insert points on mixing consoles, for instance. – endolith Nov 10 '21 at 21:00
19

On Android phones, on iOS devices, and on HD Audio PCs, no mechanical switches in the socket are used. Instead, the headphone socket has 4 contacts instead of 3, and accepts both 4-contact headsets and 3-contact headphones. The sleeve of the 3-contact headphone audio jack connects two of the socket contacts together.

One of the contacts is responsible for microphone and usually feeds 1.5-3.3v of voltage through a current limiting resistor (2-10 kOhm), which is necessary to bias a JFET transistor in the microphone capsule of a headset. DC resistance measurement between the microphone pin and the ground pin of the socket can be used to detect the kind of device plugged in - it will be 0 Ohm for a headphone, infinitely high for no device connected, and about 2 kOhm thereabouts for a headset with microphone.

The bias current limiting resistor forms a part of voltage divider network, with the other part being the above mentioned DC resistance. Voltage measurement on the microphone pin is taken to both determine the sound pressure on the microphone (through a 100hz high pass filter thereabouts) and the kind of jack or device inserted (through a low pass filter or noise rejection logic), allowing this design to be implemented without extra parts, if the filters are implemented digitally. Corresponding to the above DC resistances, you will measure about 0V on the microphone pin if headphone is connected, the full mic bias voltage in case nothing is connected, and something in between in case a headset is connected.

Switches in the audio jack like in the answer above were common in older electronics, but are incompatible with headsets and are just too bulky for a high-tech handset.

Siana
  • 414
  • 3
  • 7
  • not only android top boxes, but simple amplifiers does also use this method. They are used to identify the errors in speaker lines. When the speak line is disconnected it won't let the amplifier main output stage to power on. something like CD ERROR like error message would be shown on the front LCD panel. – Standard Sandun Aug 23 '14 at 14:52
  • Standard, i don't think it's the same method, because you can't rely on an extra pin to signal the function. I think current sensing would be the way to implement that in a power amplifier. However, it's useless in a handset because it's a valid use case to connect the headphone output of a handset to a line input of another device. Line input has impedance of about 50 kOhm, making current very small and current detection useless. – Siana Aug 23 '14 at 15:04
  • 3
    At least some Android devices do inject a test current into the speaker lines to detect the impedance of what is connected there. Had several interesting days tracking down a "thumping" on boot when a device being customized was connected to an external amplifier, and finally traced its time coincidence to a kernel routine which ran this test. Driving only the high impedance amplifier input, the test current was quite audible. Adding some dummy load resistance made it quieter and gave the internal amp something to do, but commenting out the test was what fully solved it. – Chris Stratton May 20 '20 at 05:22
5

There have been quite a few answers on this, but still some additional clarifications may be helpful:

  • yes, quite a few headset jacks include still an insert detect switch, which may also be a signal switch for simple (mono) headsets.

  • when the insertion is detected by some means, the headphone amplifier may enter a detection mode (see e.g. WO 2006045617 A3 patent application) where the host device detects what is connected (stereo headphones, mono headset with mic, stereo headset with mic, video connector, etc.) and in which order the ground and microphone wires are. This is included in the latest revision of the OMTP headset standard. This kind of detection wouldn't be fooled by a non-connected plug in the original question.

  • Apple 3.5 mm jacks employ a proprietary device identification chip connected across the microphone line. This performs a handshake when the accessory is inserted and headset controls use this for controls. If an Apple device doesn't find this chip in a headphone it assumes that it is a basic stereo headphone without a microphone or any controls.

Juha Backman
  • 59
  • 1
  • 2
2

As an example, TI's TPA6166A2 uses the JACK_SENSE connection to first detect the presence of a plug, and then, after plug-in, it measures the impedances between the different rings to distinguish what is connected to it, including 14 different wiring variations of these devices (Table 6):

  • Stereo Headset (HP with mic)
  • Mono Headset
  • Stereo Line Out Audio Cable
  • Stereo Headphone

By default, it needs to see 8-700 Ω on one of the headphones pins to detect a device, and looks for 1.5 to 20 kΩ between R2 and S to detect a headset. It can also check whether it's OMTP or CTIA headset wiring.

endolith
  • 28,494
  • 23
  • 117
  • 181
  • 1
    Thank you, this is exactly the information I needed. I converted a USB headset to TRRS, but when I muted (an on-cable make-break switch in series with the mic), android phones couldn't detect the mic any more, so they switched to the internal mic, making the mute switch ineffective. Adding a 10K pull down from R2 to S fixed this issue. I could solder a 0402 between the wire terminals on the volume/mute pcb, going to the plug. – cheater May 22 '22 at 13:32
1

There is definitely an additional contact (and in some jacks, two!) that is connected to ground when the jack is empty, and is mechanically lifted from ground as soon as a plug of the proper diameter is inserted. This extra, non-audio circuit is opened as soon as the tip of the plug acts on the contact mechanism, and remains actuated until the plug is completely removed.

What I just described is called a "normally closed" switch. Some jacks contain a "normally open" switch instead, which is the opposite of what I just described, as it connects to ground only when a plug is in the jack.

In either case, the additional mechanical switch has nothing to do with the audio signals, and does not make any contact with the wiring connected to the plug. This additional mechanical switch is very well-insulated from all the wires and contacts that are connected to the audio circuitry, as it could really mess things up if it wasn't! This additional mechanical switch simply provides a signal to the equipment to allow it to sense when something has been inserted into the jack, and then act accordingly.

It's a relatively recent development, say no more than 20 years ago. The "inserted" signal pretty much needs to be acted upon by digital circuits like computers and sound cards, so it's not very effective in an old-school, pure- analog device.

Back in the pre-computer/smartphone days, some jacks included mechanical switching to disconnect the signal flow from it's normal destination and instead direct it to whatever was plugged in. This usually served to disconnect the speakers when headphones were plugged in, but with modern, high power amps, it is more than a little dangerous to do that, as it could blow up headphones, amps and eardrums. A previous comment included a schematic diagram of that kind of jack.

bummi
  • 148
  • 2
  • 2
  • 7
  • 2
    If the contact only provides a digital "presence" signal, what is the reason to make two contacts? – Dmitry Grigoryev Dec 13 '15 at 15:59
  • Why two? a. One is NC, the other NO b. One operates a high-current device like a status LED – Joe Shupienis Dec 14 '15 at 18:18
  • "This additional mechanical switch is very well-insulated from all the wires and contacts that are connected to the audio circuitry" This isn't necessarily true. Jacks can be made in both ways. https://electronics.stackexchange.com/a/95578/142 Connecting the jack detection contact to the actual jack terminal is cheaper and smaller. – endolith Nov 10 '21 at 21:04
1

Most jack sockets include a switch that is opened when a jack is inserted.

Wouter van Ooijen
  • 48,407
  • 1
  • 63
  • 136