How to do simple headphone detection?

Hi,

I have some stereo headphone jacks with 3 terminals (no 4th terminal just for headphone detection).

How is it possible to detect the presence of headphones (or other equipment) plugged into the jack (with as little (extra) hardware as possible)? The plan is to either drive the jack directly from the Arduino, or use an LM386 amplifier.

Maybe connect a digital input with pullup resistor enabled to one of the jack pins. It will read HIGH with no headphones and LOW with an 8-ohm speaker pulling it to GND.

If there's an audio signal stopping it from reaching 0v use an ADC input and test for < 5v.


Rob

Yeah... I'm thinking something like a 10k pull-up too. 10k to 5V will have very-little effect on the audio, since headphones are typically less than 100 ohms. You do need the audio signal to be capacitively coupled (an LM386 usually is). And, you might need a capacitor to ground on the "other" end of the pull-up to form a low-pass filter and prevent the audio signal from "fooling" the headphone detection.

The plan is to either drive the jack directly from the Arduino, or use an LM386 amplifier.

Don't connect directly to the arduino. The heaphone impedance is too low (typically 32 or 64 ohms) and it will draw excess current from the Arduino and potentially damage it.

Another advantage to a 386 (or something similar) is that it's easy to add a volume control pot. It's a good idea to have a regular 'ol volume control so that you don't accidently get the volume too hig and blow your ears out! :smiley:

10k to 5V will have very-little effect on the audio

That was my thinking, and if you don't need to detect removal you can turn the pin off anyway.

Also the internal pullups are about 20k+ IIRC and they would have less affect.


Rob

Thanks everyone for all the answers.