I have a standard SMD5050 LED strip from china that came with a 44key remote and a small RGB controller. I wanted to replace the RGB controller with an Arduino Nano however I have now have a fast flickering problem with PWM driven RGB lights.
Using an Arduino Nano + IRLB8721 Mosfets to drive 12v non-addressable RGB SMD5050 led strip. Using FastLED Example called "AnaogOutput.ino" and these PWM pin assignments.
define PIN_RED 3
define PIN_GREEN 5
define PIN_BLUE 6
- individual non mixed colors are fine with no flicker on their own. e.g. only red, or only blue
- red+green solid color - high frequency flicker
- red+blue solid color = high frequency flicker.
- green+blue solid color = smooth with no flicker.
Is the flickering caused by PWM pin 3 runs at 490Hz and pin 5,6 run at 980Hz?
Can I make pin 3, 5 and 6 have identical PWM? Is there a recommended PWM frequency for AnalogOutput?
Additional testing with PWM:
TCCR2B = TCCR2B & B11111000 | B00000111; // for PWM frequency of 30.64 Hz pin 3 11 made flicker much worse
TCCR2B = TCCR2B & B11111000 | B00000011; // for PWM frequency of 980.39 Hz pin 3 11 made flicker a bit better
There seems to be various modes for the timers. How do I get pwm on pin 3 have the same pwm settings as pin 5 and 6?
I've also read that there may be a way to calculate the optimal PWM frequency for the mosfets and LEDs - however I have no idea how to figure that out.
==== Additional background. The reason why I'm switching from stock RGB controller to a Arduino Nano is so I can add MySensors + custom lighting animations.