Electrical – Electronics Newbie – How to mute speakers when 3.5mm is plugged into female jack? (with volume control)

audiomosfetraspberry pi

So I'm a recent newbie to the world of electronics and have been working on a personal project using the Pi Zero W but I've reached a snag when it comes to sorting out audio.

I have 2 problems I'm trying to figure out:

1) Mute speakers when 3.5mm male is in female jack and vice versa.
2) Control the volume for both speakers and 3.5mm.

Now I've seen tutorials online on how to create an amp op circuit using a 3.5mm plug for amplifying a internal speaker but seen nothing so far online in regards to using a 3.5mm jack.

I was told by an electronics buddy I could use an audio switching MOSFET and to look at differential OP amps as circuit boards but still alot of it confuses me.

At current my project is using a piezo speaker with the goal of simply playing single notes. Although for other parts of my project I will be using sound files and want to also eliminate any loss of sound quality when transferred between speaker/3.5mm.

Any help will be appreciated if able to help. Remember I'm newbie to this so apologies if I don't pick up answer straight away and know exactly what you're talking about.

Edit: I see answers I can understand the 5pin jack and the pins shorting out stuff. What I'm more concerned about is forming the circuit itself. As in are any helpful videos or images that you could point me? Cause there's 1 thing saying it but to be actually able to see it then makes all the better sense to myself.

Edit 2:

I think I've managed to understand it all correctly and following google searches as well got the circuit wired for potentiometer and speaker but could do with a checking with to see if I've got it all right (See image below).

enter image description here

Best Answer

This question is pretty old, but I can maybe elaborate on what the other answers are saying.

The socket has five pins - You might think this is odd, because your stereo plug only has three connections: Left, Right, Ground. What are these strange extra connections?

The symbol you have shows two connections with weird angled parts at the end. Those are the bits that actually interface with the plug. The top one is the tip, and the bottom one is the ring. The sleeve is connected to gnd. The other two connections are the ones that act "odd". Each of these is normally connected to one of the angled contacts, except when a plug is inserted. When the plug is inserted, they are not connected to anything.

This means that you can use these connections to detect if a plug is inserted or not. Going even further, you can use these to directly solve your problem. If you connect your audio source to the two angled pins, when nothing is inserted, audio will come out of the two non-angled pins, so you should connect those to your speakers. When the plug is inserted, it will disconnect those two pins, muting the signal to your speakers.

You shouldn't need any of those other components, except the potentiometer, which will need to be far smaller, around 20 ohms as Peter says. If you want to control the speaker and the jack with the same potentiometer, it should be in series with the audio, and you'll likely need two of them, or a dual one (to control both channels). Dont be tempted to put a single pot between the jack and ground, because you'll get strange sounding music as the common signals start to attenuate.

Related Topic