Problem with ShiftPWM

Hi, I need help to figure our what is wrong…

I’ve download the ShiftPWM library and build something similar to Layout.png - Google Drive but using only 2 shift registers connected to 3 sets of led strip (total of 9 channels).

When I’m using the examples from the library, the results are far from what I was expecting.

The color are all mixed up and I can’t control the led I want to turn on.
As an example, doing the following code

#define SHIFTPWM_USE_TIMER2  // for Arduino Uno and earlier (Atmega328)

const int ShiftPWM_latchPin=8;

const bool ShiftPWM_invertOutputs = false; 

const bool ShiftPWM_balanceLoad = false;

#include <ShiftPWM.h>   // include ShiftPWM.h after setting the pins!

unsigned char maxBrightness = 255;
unsigned char pwmFrequency = 75;
int numRegisters = 2;
int numRGBleds =  numRegisters*8/3;

void setup(){
  Serial.begin(9600);

  // Sets the number of 8-bit registers that are used.
  ShiftPWM.SetAmountOfRegisters(numRegisters);

  ShiftPWM.SetPinGrouping(1); //This is the default, but I added here to demonstrate how to use the funtion
  
  ShiftPWM.Start(pwmFrequency,maxBrightness);
}

void loop()
{    
  // Turn all LED's off.
  ShiftPWM.SetAll(0);

  // Print information about the interrupt frequency, duration and load on your program
  ShiftPWM.PrintInterruptLoad();


    for(int led=0; led<numRGBleds; led++){
      Serial.println(led);
      ShiftPWM.SetAll(0);
      ShiftPWM.SetRGB(led,255,25,255);
      delay(8000);
      ShiftPWM.SetAll(0);
    }

}

should turn the red-green-blue led on each strip 1 at a time, but the results are:

led=0: green+blue on 1st strip with green on the 3rd strip
led=1: green+blue on the 2nd strip + red on the 3rd strip
led=2: red on the 2nd strip + blue on 3rd strip
led=3: red on the 3rd strip.

I’ve redone my wiring many times, change both shift registers and even try with 2 differents Uno board with the same result…

Any idea of what I could be doing wrong or what I should try?
Any other suggestions?

Thanks for your help.

Hey azzabcd,

You say you are building something similar to the diagram you provided. Is it the same or different? Because what you are describing sounds like a wiring issue. Using the diagram from google docs LED1 would be the outputs on the right hand top. If you look at that it is not in your standard RGB arrangement, it seems to be BGR. I am at work and can't check but I think the standard ShiftPWM expects that you are using RGB and just groups the pins together. So what would have been pins 1, 2 and 3 now represent LED1 RGB.ShiftPWM.SetRGB(led,255,25,255);I assume this is meant to be: ShiftPWM.SetRGB(led,255,255,255);Setting each colour to max value.
You describe colours on different strips lighting up. If you are using a similar setup to the diagram then I believe this is because of wiring being wrong.
Check that pin grouping is working properly. Possibly try going back to individual outputs and test that each output is working the way it should without grouping. If that works properly as expected then it has to do with the grouping function.

I will check my notes at home on this and confirm if there is further testing that could be done.

Hi,

I redid everything one more time and I've been able to confirm the layout I was referring to is wrong (at least for me...)
After some trial and error, I've been to make it works when I'm doing the following:

I'm using the pin on the shift register like this:

SR Pin Strip Color
1 1 0 Green
1 2 0 Blue
1 15 0 Red
1 3 1 Red
1 4 1 Green
1 5 1 Blue
1 6 2 Red
1 7 2 Green
2 15 2 Blue
[/table]

This layout is really giving me a "RGB" pattern.

Thanks