Hello everybody,
I'm Flo and quite new in the ARDUINO community and now have a problem I couldn't solve so far.
I'm building a LED light for my reef aquarium, consisting of a ARDUINO Nano, 6 CCS and 33 high power LED's.
The LEDs are arranged in six groups, five of 6 LEDs and one group with just 3.
This setup is ment to simulate sunrise, sunset and moonlight.
So here comes the problem, I control the CCS with the six PWM-PINs provided on the NANO / ATMega328P. So far everything works, except that the LED start flickering at about 1Hz, if I turn on more then two CCS. If I activated only one or two, doesn't mater wich of the six, everything is fine. I checked the PWM signal with an oscilloscope and found out that the frequency of PIN 3 and 6 are half then the other four PWM PINs. About 220Hz, PINs 5,9,10 & 11 about 440Hz.
Also the current limiter at my power source started blinking the same frequency as the LEDs. It's set to 24V and current limiter max. (3A) because the CCS control the current. Even if I reduce the power to 20% on all six CCS the LEDs still have that flickering
So I checked the 24V with the osci. There we have a rattling.
Checking the net I found out there is different modes for PWM. After spending a lot of time searching the net, I found the following line to change the PWM mode on the other PINs. Due to mentioned problems with changing the mode on Timer one, I decided to set Timer two and three also to "Fast PWM mode"
int brightness = 40;
int fadeAmount = 1;
void setup() {
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
bitSet(TCCR1B, WGM12);
** bitSet(TCCR2B, WGM12);**
}
void loop() {
// analogWrite(3, (brightness));
analogWrite(5, brightness);
analogWrite(6, brightness);
analogWrite(9, brightness);
analogWrite(10, brightness);
analogWrite(11, brightness);
}
So, that made the light perfect, no flickering, but PWM-PIN 3 now has the problem it still has a different frequency and stays on 5V all the time. Is this maybe caused by the second red line? I only found the first line at the net and then just expected it'll work for timer two the same way, just by changing the into a two.
The second idea was to put a small capacitor in line with the PWM+ line ore parallel between PWM+/-.
So, a lot of information, don't know how clear I made my problem, as I've spend the day on this and mind might be a bit twisted ![]()
Any help apreciated, also totally different solutions are welcome.
The final setup will also have an RTC and LCD via I2C. At a certain time the sunrise starts with fading in group one then two, three ..... jump in. All groups 100% during the day and in the evening groups are faded out one after another. Only group six (just three blue LEDs) stays on as night light.
Alright, while thinking about it, I more and more think it's probably the easiest way to add the capacitors :~
Thanks the everybody!

