Hello there.
I have a simple project using TMRpcm library (found here GitHub - TMRh20/TMRpcm: Arduino library for asynchronous playback of PCM/WAV files direct from SD card. Arduino Uno,Nano,Mega etc supported) that reads a wav from microSD card (a bell sound that is 2 seconds long) and plays it using the library on pin 9. Everything works great but I want to add 3W amplifier on the output. I am using PAM8403 amplifier module which is working great when I test it using audio signal from phone or from PC, also the wav sound plays great when I try attaching small old phone speaker to the pin 9 of the Arduino.
The problem is when I connect the Arduino and the amplifier, when the sound plays from the Arduino Uno there is a whistling noise that continues even after the sound of the bell finishes (please check the video link to see the result) and the PAM8403 starts heating up... I tried adding 1kohm resistor and 10nF capacitor in series to the output of the Arduino pin 9 and also 10kOhm resistor to ground, but I get the same result. I tried all values for the volume of the TMRpcm, what I found to work best for me is 3.
Any suggestion how can I fix this issue?
Schematic of my setup in the attachments.
Here is a link to a video of the result (ignore the additional components on the breadboard, they are just LDR and LED driven using NPN resistor and a RTC): VID 20190513 180950 - YouTube
In the video the whistling sound stops at the end but after few seconds starts again and is there constantly once the sound is played from the Arduino... Also notice the high pitch noise that is always there (maybe its the PWM frequency noise?)...
Have in mind, I dont bother the low quality of the sound, I just want to find a way to remove the noise that is produced after the sound is played. The speaker is 3W 4ohm one, as specified in the PAM8403 amplifier module.