Electronic – How to detect audio plug type to distinguish microphone/headphones by pin configuration

audio

I'm looking for a way to detect microphone/headset/headphones. How I can detect if two pins of audio jack has been shorted? This is the easiest way to check what kind of equipment has been plugged in.

In this situation I would check short circuit between pin 2 and 3. I'm using ADAU1761 and 4 pin jack.

  1   2   3   4
|-----------\\\\
|GND|GND|GND|MIC
|-----------////

|-----------\\\\
|MIC|GND|RHP|LHP
|-----------////

|-----------\\\\
|GND|GND|RHP|LHP
|-----------////

Any idea?

Best Answer

It seems the ADAU1671 does not include a device detection feature. You need an analog switch to switch the microphone connection between pin 4 and pin 1 anyway, if you want to support standalone microphones as well as headsets. You can toggle the microphone bias voltage on and off. As the bias is current limited, it can easily be pulled down by a short circuit or a low-impedance headphone coil. So I would try it this way:

Couple MICBIAS via R and/or L to a comparator or Schmitt trigger, and its output to a general purpose input. Switch microphone to pin 4, enable bias. If the bias is not pulled down (so you detect high on the GPI pin), it's a headset. If not, toggle microphone to pin 1 (and remove headphone out from it), and check again. If it is pulled down, it's a headphone, if it's not pulled down, it's a standalone mic or no device at all (e.g. just an extension cord).