# Mutually exclusive headphone and speaker

I have a device that has only one set of analog audio out signals that are amplified for headphone usage. I want to be able to use these signals to output to a set of speakers OR a headphone jack, but not both at the same time.

The headphone jack has a detect pin that goes high when a jack is plugged in.

I have found a simple amplifier circuit for amplifying a headphone signal for an 8 ohm speaker.

I have created a test circuit (image below) with the headphone jack and the amplified speaker circuit on the right and the output for the right channel of the audio on the left. My thinking was that when the detect signal goes high, the LM386 Vs pin would receive voltage from Vcc. Feel free to delete parts of my circuit that are bad.

Using the detect signal from the headphone jack, I would like help designing the circuit that fits the following truth table:

Detect | Speaker | Headphone
0   |   1     |    X
1   |   0     |    1


If you know how to use 123D Circuit you can fork my circuit and pick up where I left off.

Edit 1: Turns out this isn't as complicated as I thought because I (finally) found some information about the detect switch states:

"The switch is closed when headphones are absent. The switch opens when headphones are inserted."

Here is the (presumed) working photo:

• Someone will probably come up with a solution that works with your chosen speaker amp (LM386), but the easiest thing would be to use an amp chip that has an enable/disable pin. Commented Jan 16, 2015 at 6:46
• @Respawned Fluff Good point. I'll keep an eye out for one.
– Nate
Commented Jan 16, 2015 at 6:47
• Related question: electronics.stackexchange.com/questions/31442/… Commented Jan 16, 2015 at 8:12

You could attach the +Input pin to Detect instead of R, and connect +Input to ground with a large resistor so that the input voltage is zero when the switch is opened, but equal to Output_R when closed.

• Isn't that the opposite of what I want? Then when the headphones are plugged in the switch closes and the speakers will turn on. When the headphones are unplugged the switch opens and the speakers turn off.
– Nate
Commented Jan 16, 2015 at 5:41
• I am wrong. Editting my post.
– Nate
Commented Jan 16, 2015 at 6:44
• I was working under the incorrect assumption that the switch was open when when headphones were absent, it is the opposite.
– Nate
Commented Jan 16, 2015 at 7:22
• @Nate: there are actually some jacks that operate like that, i.e. by closing a switch, but they are a rarity. It is mechanically much easier to have the plug insertion open a switch. Commented Jan 16, 2015 at 10:14
• And as a comment on the solution: this works, but I suspect it be might noisy because the switch contact is likely not a high quality one. Also you might get some pops out the speakers when plug/unplug the headphones. Finally, the LM386 may saturate or even oscillate when you plug the headphone. Ideally you want the +pin to be grounded to turn off the speakers, not left in the air. (That's why there's usually an enable/disable pin on the slightly more expensive amp ICs like this.) You could fix that here by adding a high-value resistor (100K or more) from +pin to ground. Commented Jan 16, 2015 at 10:22