I've got astripboard with 6 RGB LEDs assembled on it. Each set of 6 Red, 6 Green, 6 Blue are controlled by an NPN tranistor, from a PWM pin on the MCU.
I've modified the fade sketch to test PWM and I'm fading each one up and down between 0 and 255 with a 30ms interval.
The only difference is they are out of sync. Red starts at 0, Green starts at 100, Blue starts at 200.
If I have an LCD still active, from a previous sketch so no LCD reset, I notice the LCD flicker. This is to do with the way the 3 signals are out of sync as it goes at a slower rate than any individual LED, but you can see the effect as regular, so it's some kind of modulation or harmonic issue with the three PWM's out of sync.
The LCD is mounted on an I2C backpack with a PCF8574.
Now, I have 0.1uF caps on across the MCU supplies right next to the pins. I've also tried 0.1uF cap across the supply to the backpack/LCD (where the leads plug into the breadboard).
This seems to have no effect.
I don't have access to an o-scope.
Could it be that I need a decoupling cap closer to the PCF8574 on the backpack and/or decouplng on the supply lines at the stripboard with the LEDs on?
It's just occured to me that it may be to do with different PWM frequencies too. This is on a 1284P and I'm using PIns 30, 8 and 9 on Bobuino variant. That translates to PD4 (OC1B), PD5(OC1A) and PD6(OC2B) Could it be that the two timers are different PWM frequencies and it's interacting?
I'll have a try with different PWM pins ot see if it makes any difference too.