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

  • \$\begingroup\$ Why not use a 5-pin jack that will switch it for you? \$\endgroup\$ Commented Nov 7, 2017 at 16:55
  • \$\begingroup\$ The 3.5mm jack I'm using is a 5 pin. The problem I'm faced with is I don't have a clue as to what circuit I need to make for it to work. \$\endgroup\$ Commented Nov 7, 2017 at 16:58
  • \$\begingroup\$ A 50K pot definitely won't work as a volume control for a speaker - you need something under 20 Ohms or so. The two 10 uF capacitors may be useful, but you don't need the rest of the RC network you show in your edit 2 - they will only attenuate the signal. \$\endgroup\$ Commented May 9, 2018 at 1:21

3 Answers 3


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.


The 5-pin jack should have 2 pairs of contacts that are shorted together when there is nothing plugged in and are disconnected when something is plugged in. On of each pair will connect to the plug and the other will be left floating.

Connect the speaker across to the common pin and the pins that end up floating (using a few resistors to create a rudimentary mono mixer) and the audio output to the pins that will connect to the plug.

  • \$\begingroup\$ Do you happen to have an image / video I can use to look at this? I sort of get it in my head but need to see a visual example to confirm it. @SimonB this also applies to your comment. \$\endgroup\$ Commented Nov 7, 2017 at 17:47

You don't need a fancy circuit. The extra terminals in the 3.5mm socket do it for you.

With no plug in, the "left" and "right" inputs just connect through to the "output" pins opposite - wire those output pins to the speaker(s).

With a plug in, the outputs are disconnected, and the inputs connect to the plug instead.

It's that simple.


Your Answer

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

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