0
\$\begingroup\$

I'm using a simple DPDT 3.5 audio jack to attempt to switch between two audio outputs - speakers with a built in amplifier and headphones. The speakers work just fine, but when the headphones are plugged in, my current design leaves the signal floating on the speakers so naturally there is quite a hum, even as far as still being able to hear the music.

This is the type of switch I'm using:

5 pin switching audio jack

The jack is wired:

  • Grounds all tied together to pin 1
  • Audio in from the sound card to pins 2 and 3
  • Speakers on pins 4 and 5

And the overall diagram of how things are set up:

project diagram

What should I do to eliminate this noise?

I've tried adding a large resistor between ground and speaker signal but I found that if the resistor was small enough to be effective it caused noticeable problems when the headphones were unplugged. My other thoughts were: should I have a capacitor somewhere? Or instead of switching the signal directly, could I detect the plugging in of the headphones and switch off the power to the speakers completely?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

When you say speakers you mean "amplifier + speakers". Regular speakers won't hum when disconnected.

You need to short the amplifier inputs to ground when you plug in the headphones. It looks as though that socket has auxiliary contacts 6/7 and 9/10 which may perform this function. (You forgot the datasheet link so I can't check.)

Try a continuity test between 6 and 7 while plugging the headphones in and out and the same with 9 and 10. You'll be hoping the contacts close with the headphones plugged in.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for this - I hadn't really thought about what the extra 6 pins were for, but as you suggested they do switch when you plug in a jack, so the easiest thing is to run the power for the speakers through them. Now it gets switched off completely when not needed. \$\endgroup\$
    – pjrharley
    Jan 22, 2021 at 11:02
  • \$\begingroup\$ They might not be rated for that much current. Normally they're used for switching audio and grounding the amplifier inputs (to prevent hum) would be a typical application. \$\endgroup\$
    – Transistor
    Jan 22, 2021 at 11:05
1
\$\begingroup\$

If you put a good ground between all USB ports and rPi it will work. Then a cap to earth ground to suppress CM noise.

It might be the floating speaker is radiating Class D noise so the inputs with shared ground currents that amplify the noise as the cross talk at high f is more pronounced .

Perhaps an RF cap on the speaker port may attenuate the radiation when off. But not big enough to attenuate 8 Ohm speaker.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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