ESP32 audio amplifier

I want to be able to play short soundclips via an ESP32. I got it working using a DFPlayer mini but i prefer to have the files on the ESP32 instead of an external sd card (to update OTA and ease of use / don't have SD card corruption).

I bought a PAM8403 which i kind of got working but it has a terrible amount of noise.
I directly connected the PAM8403 to 3.3V, Left signal to the DAC25 on the EPS32 and the ground pin to the ground rail (this is correct?)

Is there a good way to play short audio clips directly via the ESP32 without an SD card and with good quality? I plan to use a 3w speaker

It needs to work on 3.3v since i am going to make a custom PCB which only needs 3.3v

Thank you

I use the this i2s audio amp and it sounds just fine

Thank you for the reply. The only downside is that i can’t find the single chip. I want to integrade it on my own pcb. My selected chip is easely findable and integratable on a custom pcb.

I noticed that if i disconnect the dac cable to the esp32 i have noticably less noise. I think even my PAM8403 should be able to work without noise right?

...Our ears are very sensitive to noise, and building audio electronics can be frustrating!

And just so we are clear - "Noise" is unwanted sound that's always present (usually-hopefully in the background) and most-noticeable with quiet sounds or when there is no signal.

"Distortion" only exists when there is a signal and the most common type of distortion is clipping, which happens during loud parts like when you try to get 2W out of a 1W amplifier, etc.

And since microprocessors can't directly put-out the negative-half of the audio waveform you can get rectification-distortion (at all levels) if you don't properly deal with that.

You should test the amplifier and ESP32 separately. i.e. You can test the ESP32 by with powered computer speakers or by plugging-into a low-power stereo, etc. (I wouldn't plug anything "unknown" into a good hi-fi system. :wink: )

And you can test the amplifier with your computer's sound card or with your phone, etc.

The amplifier probably has WAY too much gain. Is there a volume control? Any noise will be amplified and the amplifier can easily be driven into clipping. If the processor and amplifier are sharing the same power supply you essentially need zero (voltage) gain. (You do need power/current gain because the processor can't drive an 8-Ohm speaker.)

Low-pitch hum is power-line hum. That can come from the power supply, or it can be "picked-up" electro-magnetically if the circuit isn't shielded, or it can sometimes be a ground loop.

High-pitch whine is some kind of switching noise. That's usually from a switching power supply. But it can also come from the processor.

Hiss is "normal" analog-amplifier noise. It's usually more of a problem in preamps (where you have a weak signal and high gain) than in power amps.

1 Like

Thank you for your reply. I have uploaded some short recordings from the output:
Filebin | 7quk9cwp3uomwad1

The sound is way too loud, i tried to lower the gain and export another wav file which i converted to c code, the noise still remains and the clip is really bad in quality.

There is no volume control, i think i saw some people use a potentio meter but i don't prefer this because the device is going to be placed in a public place and a volume knob is not desired.

If i connect an elco between the Left signal and GND signal (which probably shouldn't be done), almost all the noise will be gone but the output is really low as well.

If the processor and amplifier are sharing the same power supply you essentially need zero (voltage) gain. (You do need power/current gain because the processor can't drive an 8-Ohm speaker.)

They share the same power supply, but how can i prevent that?