I have a few LED's near some guitar pickups. They work as a lighting effect when I play. I say "play" very loosely because right now it's unplayable. The circuit is by itself and uses a mic. It IS NOT plugged into the guitar system in any way. They are RGB's at 12v running off a Nano Arduino.
When I turn on the LED's I get a really bad, very audible hum through the guitar. It does not sound in any way like 60 cycle hum and happens on any pickup configuration which proves it's not 60 cycle coming from the pickups. Some colors (like red specifically) make almost no hum and green is by far the worst! I'm using PWM at full power of 255 for all colors. The frequency (the audible note it makes) does not change - only changes in intensity of volume with different colors.
With PWM, are the square waves slower and faster (1 to 255) or is it just the length of each pulse that changes. How do I stop this HUM!
Hum diggity dog it's bad!
You can't move the LEDs away from the pickup?
Can you put this thing in a metal-grounded box? If the LEDs are not in a box, you might try shielded cable for the LEDs.
As you know, guitar pickups are electro-magnetic pickups and they WILL pick up electromagnetic noise/interference. And, the fact that they are high impedance makes the situation worse. If you put a fluorescent lamp next to your pickup, I'll bet that's noisy too!
You can drive LEDs from with a constant-current (controlled current) driver. These operate above the audio frequency range and the current is filtered through an inductor so it's not as noisy as PWM. But, that's quite a bit more circuitry.
I'm using PWM at full power of 255 for all colors. The frequency (the audible note it makes) does not change - only changes in intensity of volume with different colors.
If it's always 255 or zero, that's NOT PWM and you shouldn't be getting noise (at least not noise from PWM). What happens if you just turn the colors on and off with digitalWrite?
With PWM, are the square waves slower and faster (1 to 255) or is it just the length of each pulse that changes.
The underlying frequency remains the same but the number of pulses per PWM cycle will vary. I've never listened to PWM! But pulses & square waves generally sound "harsh" (lots of harmonics).
Ok so I know PWM varies and it's specifically the pulsing at various rates which gives varying colors like (255, 80, 44) or any combination.
I just tried some different color combinations with different numeric values and it's always the same note. Just Varying amplification of the same note / frequency.
No PWM does not vary rates it is constant. It only changes the duty cycle of the wave which is hard to differentiate by ear.
Yes this will happen and there is not much you can do about it except perhaps reduce the impedance of the input of your amplifier. One way to do this is to put a resistor across the input and ground, but if you don't do it neatly then it will be worse.