I would like to setup an audio solution for Raspberry Pi Zero that consists of a headphone jack and a speaker. The goal is that sounds will be played through an internal speaker, and when a headphone is connected, the speaker shuts off and sound is switched to the headphone instead.

My design consists of two amplifiers.

The first one, a TDA1308 class-AB headphone amplifier, gets raw signal from the Pi via some filters; the output goes to one of those headphone jacks that has "insertion detection contacts".

When nothing is inserted into the jack, the amplified stereo audio signals get combined to a mono signal and is sent to a second, NS4150 class-D amplifier to drive a 4 Ohm, 2W or 8 Ohm, 1W speaker. (the datasheet for NS4150 is in Chinese. I found this English version, but details may differ.)

Here's my schematics draft for my particular project, built up from application circuits suggested by the two datasheets. RAL and RAR are Raw Audio Left and Raw Audio Right, respectively. enter image description here Here is a link to that schematics draft.

My problem: when a headphone (or anything that can go into that hole, really) is inserted, pin 3 and 4 of the jack disconnects from 2 and 5, respectively, and my speaker amp's input will be hanging. I do not know if it can handle that. My speaker amp does have a Control pin to shut off itself completely, but I am not positive how to utilize it without messing with the rest of the audio signal. I know that amplifiers are sensitive and testing them on breadboards might not be a good idea (everything here is SMD anyways), so I want to see if I can get a word of wisdom from everyone here.


Run resistors from pins 3 and 4 of the headphone jack to ground. You may need to experiment, but you should be OK with 220\$\Omega\$ or so. The idea is that when the jack is unplugged, the resistors won't matter (because the class AB amp is used to lower headphone impedances anyway), and when it's it's plugged in the resistors will act to ground the input to the class D amp.

Or look around for a jack that has a separate pair of contacts that opens when a plug is present, and use that to disable the class D amp.

  • \$\begingroup\$ Would the signal not get overpowered by the pull-down resistor, though? They are coming to the class D amp via some 30K Ohm resistor. Ground via 220 Ohm would dominate over that signal. Could I potentially use a very large resistor instead? \$\endgroup\$ – Bz16 Aug 9 '19 at 23:04
  • \$\begingroup\$ They are coming from the TDA1308, which should have quite a low impedance. That's what matters. \$\endgroup\$ – TimWescott Aug 9 '19 at 23:28
  • \$\begingroup\$ Oof... Pardon me, I somehow saw the 30K resistor as an indivisible part of the input to the class D amp. Pull down resistors placed before those large resistors should not have matter. \$\endgroup\$ – Bz16 Aug 12 '19 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.