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:
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:
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?