What's new

Anyone know how to connect an audio amp to a raspberry pi zero?

Joined
Apr 8, 2020
Messages
98
Likes
6
Anyone have anything on connecting raspberry pi zero to an audio amp? Sorry if these seems like a simple question, but I've been searching online and don't understand anything. I want to solder a pam8403 directly to the raspberry pi.
 

Retro95

.
2023 3rd Place
Joined
Mar 29, 2023
Messages
180
Likes
241
Location
Oregon
Portables
2
Omar did you get this working?

I too am trying to get analog audio out of a pi zero. I am gonna try stitches forum link after work one of these nights but was curious if you got it working yourself.
 

Stitches

2 and a Half Dollarydoos
Staff member
.
.
Joined
Feb 5, 2017
Messages
4,172
Likes
3,268
Location
Banana Bender Land, Australia
Portables
6
i think you just use pwm
My guy you really need to think/research a bit more before posting. The Pi zero doesn't have filtering components on its PWM audio output pins. The low pass filtering circuit I linked is required to clean the signal to get usable audio, otherwise I would have said "use PWM lol it just works"
 

StonedEdge

a.k.a. ClonedEdge
.
.
Joined
Nov 16, 2018
Messages
384
Likes
1,551
Location
Japan, Tokyo
Portables
2
i think you just use pwm
Yeah, please stop posting for the sake of posting. What’s worse is that you may mislead people into damaging their hardware. Do your research and only then post on the forums. “Just do it” doesn’t count as advice either FYI.

Final warning.
 

Adan

.
Joined
Aug 27, 2022
Messages
47
Likes
35
Location
USA
Portables
0.5
I was replying to Retro95s post where he said he was trying to get analog audio out and I said I think you just use PWM. As far as I know, PWM with a filter is as close to analog audio as you can get directly from a Pi.
 

StonedEdge

a.k.a. ClonedEdge
.
.
Joined
Nov 16, 2018
Messages
384
Likes
1,551
Location
Japan, Tokyo
Portables
2
“Just use PWM” is far from contributing anything useful to the OP. How about providing a link to an analog audio amplifier? A link to a guide to getting PWM out of the Pi Zero, something like this:

How about a software setup to get GPIOs libraries setup or configured? It isn’t just this post by the way…you’ve been warned (again) :rothink:
 

Stitches

2 and a Half Dollarydoos
Staff member
.
.
Joined
Feb 5, 2017
Messages
4,172
Likes
3,268
Location
Banana Bender Land, Australia
Portables
6
I was replying to Retro95s post where he said he was trying to get analog audio out and I said I think you just use PWM. As far as I know, PWM with a filter is as close to analog audio as you can get directly from a Pi.
Yeah that's the problem in a nutshell. StonedEdge's objection is that your post contributed nothing to the conversation. I had already listed i2c and PWM with a filter as the two available options to get analog audio out of a pi zero. You didn't add anything useful, like additional filtering options, a tutorial, or a different available off the shelf product to achieve the end goal. You just said "use PWM", which again, was already a stated option.

Retro's question was to Omar, asking him if he'd assembled that filter circuit himself yet, and if so, how well did it work? There are a few iterations of the low pass filter that can be used. The one I linked is a bare bones one for simple perfboard hand wiring, so the question is very specific to Omar, and silently extended to anyone who has also assembled a filter of the same design or similar and can provide insight into its performance and assembly.

If you want to contribute to a discussion, or answer a question, great! More eyes on a problem leads to speedier solutions, but, you have to ensure that what you're contributing to a thread is exactly that: a contribution. Add something. A new option, an article with more detailed steps and information (like StonedEdge did as I was typing this), some personal experience of how you solved a similar issue, something. What you posted was not helpful, is not the first time you've been unhelpful, and such posts are very much frowned upon here.
 

Adan

.
Joined
Aug 27, 2022
Messages
47
Likes
35
Location
USA
Portables
0.5
RP2040 Hardware Design datasheet
This data sheet lays out how to get stereo audio out of 2 PWM signals on pages 23 and 24. It is the same filter used on larger Pis with native audio. It goes in to a bit more detail and it could be useful. I’m sorry that I am cluttering the forums and I will try to do better.
 
Joined
Apr 8, 2020
Messages
98
Likes
6
Omar did you get this working?

I too am trying to get analog audio out of a pi zero. I am gonna try stitches forum link after work one of these nights but was curious if you got it working yourself.
Sorry for my late response. I was told that I have to use an I2S DAC hat similar to this one:
1687192955872.png

You can see a guide for connecting it here: https://raspberrypi.stackexchange.c...o-make-pcm5102-dac-work-on-raspberry-pi-zerow
My only problem now is figuring out how to wire a speaker to it, since the audio output is through the headphone jack.
 

Retro95

.
2023 3rd Place
Joined
Mar 29, 2023
Messages
180
Likes
241
Location
Oregon
Portables
2
After doing some research I decided to go with the MAX98357. I got a 4 pack of on amazon for like 11$. They're meant to be connected to a speaker, but lack a headphone jack. I don't really need a headphone jack for my project but I can always add one in the future.

Screenshot_2023-06-19-09-55-11-051.jpg

I'll let you know when I get it working and provide some steps on how I got there. But honestly after watching a few YouTube videos it seems pretty straight forward using the MAX98357.

EDIT: I'm debating using this in conjunction with the 4layer U-AMP board since the MAX98357 converts the I2S audio to analog. You can plumb the analog right into the U-AMP which can then output to the speakers, and also have a headphone jack with automatic switching. Plus the U-AMP has superior volume controls compared to a lot of these pi hats/using the pi software to control volume.
 
Last edited:
Top