I've been fighting a hum in my amplifier circuit on my Raspberry Pi -but only when my Pi and the amplifier are powered by the same battery.
If I plug a speakerbomb into the Pi which is powered by its own battery - it sounds great.
If I power my amplifier with anything other than the Raspberry Pi battery and plug the Pi's headphone jack to it - it sounds great
It only sounds bad when both the Pi's switching regulator and the amp circuit are powered by the same battery. The amp is powered upstream of the switching regulator
I've tested many ranges of caps at the LM386-N4's power pin to no avail. I tried different speakers. I tried different LM386N-4LM386N-4 chips. Same behavior.
I have a cap in the signal line from the headphone jack that helped a little, but not enough.
Any thoughts on what could remedy this behavior.