What's new

Need help with setting up my amp to switch from speaker to headphones when plugged in.

Joined
Jan 31, 2018
Messages
17
Likes
5
Hello people of bitbuilt. I come to you guys with what should be a simple question: How would I go about making it so that when I plug headphones into my project the audio will stop coming out the speakers? I am currently working on newer version of my raspberry pi zero portable and plan on using this amp: https://www.ebay.com/itm/Adafruit-I...-Breakout-MAX98357A-Amp-Arduino-/182162777898 as I am a little familiar with it and how to set it up. I do not currently have one on hand as the one i ordered will come in on the 3rd so I haven't got to test anything yet which is why I am asking here. If its of any relevance I plan on using a gameboy speaker or ds lite speaker as I have access to a ton from dead handhelds.


Sorry if this is in the wrong category. I am new to the site as a contributor but I have been lurking for awhile. I hope to one day build a n64 portable but I am starting small with raspberry pi portables so I don't screw up something too bad. I have already completed a nes portable and a raspberry pi portable in the past so I have a basic understanding as to what to do. I can post pics of my older raspberry pi portable as well as my new design if anyone is interested :D
 
Joined
Jul 9, 2016
Messages
37
Likes
15
Portables
9000+
You will need to buy normally closed switching audio jacks. These jacks usually have 5 pins: a common ground, a left in, a right in, a left switched, and a right switched. Connect the audio out from the pi to the left and right in (and ground of course) and then connect the amp to ground, left switched, and right switched. When nothing is plugged into the jack, the amp will be connected and audio will come out the speakers at speaker volume. When headphones are plugged in, audio will come out through the headphones at headphone volume instead of the speakers. Note that you will need some way of controlling the audio output level on the Pi (simple software here).

Also, you did not need to waste your money on an Adafucker product. (They rape your money away from you with outrageously high prices.) Chinese boards using the PAM8403 can be bought through ebay at outrageously low prices (I got a 10 pack for 5 USD), and these little PAM8403 board work wonderfully. Chinese products do have a general bad name, but I can say that the small startups going on over there really do crank out reliable, dependable products at a good price.
 
Joined
Jan 31, 2018
Messages
17
Likes
5
This helped me out a lot. I am currently waiting on my case to arrive (should be here tomorrow!) so I haven’t got to wiring yet but I now know how to go about it thanks to you :D


1 more question before I start this: My case is somewhat small so I am afraid of using wires that are too thick which would eat up all my space. What would be a good gauge of wire for power as well as the 7~ wires its going to take for the amp/audio situation?
 

Stitches

2 and a Half Dollarydoos
Staff member
.
.
Joined
Feb 5, 2017
Messages
4,181
Likes
3,279
Location
Banana Bender Land, Australia
Portables
6
This helped me out a lot. I am currently waiting on my case to arrive (should be here tomorrow!) so I haven’t got to wiring yet but I now know how to go about it thanks to you :D


1 more question before I start this: My case is somewhat small so I am afraid of using wires that are too thick which would eat up all my space. What would be a good gauge of wire for power as well as the 7~ wires its going to take for the amp/audio situation?
22/24 AWG for power, data/audio/video can be as small as you want. I like 30AWG stranded for audio and video.
 
Joined
Jan 31, 2018
Messages
17
Likes
5
Damn. Im out of 30 awg but I have a ton of either 32 or 33(not home to check right now). Think that will work for audio/video?
 
Joined
Jul 9, 2016
Messages
37
Likes
15
Portables
9000+
32 guage wire is great fo small signals like bluetooth or wifi. But speakers aren't just receiving data; they are being physically driven by current flow. Keeping this in mind, you need wire that can handle at least as much current as what your speaker is rated for. If your wire is too small, you will have a voltage drop across it (due to higher resistivity as more current than the wire can handle is being driven throigh it), which is not good for maximum power transfer to the speakers. Personally, I'm using 22 guage wires to my speakers in my current WIP, but they were designed to be TV speakers. (Oh boy do they get loud!) If you have wimpy speakers like whats in the 3ds, then you're probably fine with 32 guage wire. But if you are using large speakers like me, don't expect peak or even good performance with 32 guage wire, as large speakers will need more drive current even at the same volume.

TLDR
32 guage wire with wimpy speakers :)
32 guage wire with hefty speakers :(
 
Top