Grumpy_Mike:
It is always vital to post the schematic of what you have, who knows what changes you have made.
As you are having problems with the LED and amplifier interacting we need to see these as well as the Arduino on the schematic.
Thank you for the patience, and sorry for not reading as carefully as I should’ve.
I’ve taken the time to bring my board into a schematic of my own. It IS based off the design I posted but slightly different (there’s no speaker or its capacitor).
I’ve attached the schematic to this message.
Grumpy_Mike:
This is not your problem but this is wrong. You want a resistor in the cathode of each element. The way you have it there are some colours and combinations you will not get. I would put a 220R in each cathode.
I’ve taken the time to fix my small RGB LED board to add the 250R resistors at each cathode, and remove the resistor I had at the common anode.
It’s working nicely as far as I can tell. I hope those values are good? (I didn’t have a good assortment of resistors to combine 220R).
DVDdoug:
The PWM noise (now that we know you are using PWM) is probably getting into the amplifier though the power supply.
So, tell us about your power supply. Are you using a 5Vor 12V wall wart? USB power?
As an experiment, you can try a separate power supply for the amplifier (if you have one) or try a 4.5V battery pack. Or try a separate 5V regulator if you’re running from a 12V power supply. (It’s not unusual that a preamp will have it’s own regulator.) Or, try a “big old” capacitor (1000uF or more) across the power supply to improve the filtering
…I’ve got a couple more suggestions for your preamp circuit, but later… I gotta’ get back to work.
USB power at first.
I also tried hooking up an external battery (12v regulated down to 5v) only for the amplifier, and hooking up the ground terminal to the Arduino’s, but that didn’t change the result. I’m not even sure if hooking up the battery’s ground to the arduino’s ground was a safe thing to do.
This was advised to me by an electronic engineer I know. He’s not available enough to count on his help unfortunately.
DVDdoug:
Ok… Your amplifier…
The 220uF DC blocking capacitor means you don’t have a DC reference for the Arduino analog input and the input will “float” to an undefined voltage. If you don’t already have one, you need a resistor to ground on the Arduino’s input (maybe 10K).
But… The DC-blocking capacitor also means that the amplifier’s AC output voltage swings negative. You want that with a normal audio amplifier but negative voltages can damage your Arduino. If you remove that capacitor (replace it with a short) you’ll solve both problems, but the input will be biased at about 2.5V and the ADC should read about 512 with silence, so you might have to subtract-out the bias in software.
Sorry about posting the schematic I based my amp off. I’ve now posted a schematic made by myself - the 220uF capacitor isn’t there. Again, sorry.
EDIT: fixed an error in the schematic