Arduino LED sync and speed issues

I've put together a circuit to control two LEDS (datasheet) with two Picobuck PED drivers (product page , datasheet ) controlled by an Arduino nano clone. I'm powering the Picobucks and Nano with a 12v 5A power supply, Fritzing sketch attached. (EDIT: there's a 10uf cap on the power to the Picobuck and Nano)

The setup gradually changes the LED colour in a loop, but for some reason the speed of transition has become much faster (like less than a second) than the expected programmed rate (over 20 seconds). It does this occasionally from startup when the power is turned on, but not always. I am wondering if this is somehow a coding or hardware issue?

Additionally, when working correctly, the colour changes of the two LEDs are not synchronised and appear to be at different rates. Is this a coding issue?

Furthermore the two LEDs, even though identical and driven by identical drivers, have a marked difference in brightness. Could this be a limitation of the circuit?

Code attached.

const int redPin = 6;
const int greenPin = 5;
const int bluePin = 3;
const int redPin2 = 11;
const int greenPin2 = 10;
const int bluePin2 = 9;

void setup() {
  setColourRgb(0,0,0);
}

void loop() {
  unsigned int rgbColour[3];

  rgbColour[0] = 255;
  rgbColour[1] = 0;
  rgbColour[2] = 0;  

  for (int decColour = 0; decColour < 3; decColour += 1) {
    int incColour = decColour == 2 ? 0 : decColour + 1;

    for(int i = 0; i < 255; i += 1) {
      rgbColour[decColour] -= 1;
      rgbColour[incColour] += 1;
      
      setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
      delay(75);
    }
  }
}

void setColourRgb(unsigned int red, unsigned int green, unsigned int blue) {
  analogWrite(redPin, red);
    analogWrite(greenPin, green);
      analogWrite(bluePin, blue);
  analogWrite(redPin2, red);
  analogWrite(greenPin2, green);
  analogWrite(bluePin2, blue);

 }

Thanks for any advice!

The wiring looks odd. Can you post the link to the pic buck.

There's a hyperlink to the product page plus the datasheet for the AL8805 step-down DC/DC converter the Picobuck utilises in the original post.

You can check coding issues by using the serial monitor and adding serial prints in strategic places. I don't have your hardware but by doing that I can see that your outer for-loop runs at about 19000 milliseconds and your inner for-loop at about 75 milliseconds.

===
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

Links to sales sites telling the price is not a link to the data sheet. Helpers like to use their time for thinking, not digging. You do the digging.

Sails sites?


Data sheet?

Yeah. Sites like that shows no engineering data..

Sales maybe...?

:+1: