I made this project by shajeeb (linked below), and I am having trouble with noisy ground lines. The circuit I made is the same as the diagram below except for where I connect the speaker and amplifier board to the audio input breakout board. The schematic stub for that is below as well.
The problem is that, when the potentiometer is configured to connect the audio input to ground, I get electrical noise out of the speaker. I believe this is because it is picking up the noise from the LED switching from the LED matrix. When I unplug the power from the matrix, the noise stops. I have tried adding a large electrolytic capacitor on the power line to diminish the noise, but it does not help much. If I could just isolate the LED matrix ground from the ground that the audio input uses, I think that would fix it. I want this to run on only one power supply (5 volt wall-wart). How should I puzzle this out?
If the image of my breadboard isn't good enough, I'll get a better one if needed.
https://projecthub.arduino.cc/shajeeb/32-band-audio-spectrum-visualizer-analyzer-924af5
EDIT: I am going to put a few notes here.
The LED matrix itself makes a small amount of noise when the LEDs are turning on and off. The digital signal lines from the Arduino also make audio-frequency noise. Then, the power draw from the LEDs (a heavy load) causes some instability on the power line as well.
It took me forever to find a way to isolate this, but I finally found something. When I connect the ground of the amplifier audio input closer to the ground of the arduino (digital ground) and further away from the ground of where the audio jack enters the board (analog ground), the noise is worse. When the analog ground stays away from the digital ground, the noise is less. This is tricky because all of the grounds need to be connected for the system to work together, though the physical proximity makes a difference.





