Controlling multiple RGB LEDs with a 595 IC

Hello everyone!

I am planning a project to make a 10x10 RGB LED matrix that will allow control over every individual LED.

Currently I am testing two LEDs right now with a SN74HC595N shift register where I can change the LED's colors by turning ON/OFF certain "pins" through the serial monitor. For instance, if I typed '0' in the serial monitor, it would turn on or off the current for the red lead for the first LED, where 3 would do the same for the red lead for the second LED.

Note: I am only using the pins for output 0-5. I have nothing attached to 6 and 7.

I had it working somewhat earlier with entering a value 0-255 where it would change the colors of the LED, but I ran into an issue where if I entered a value more than 9 it would send, say for 234, 2 then 3 then 4. I was unable to fix that problem, so I tried using a boolean array, but I was only able to get the first LED to turn RED on/off and after trying to fix it, nothing works now.

Any help would be greatly appreciated,


//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;

byte LED = 0; 
byte LEDarray[6] = {0, 0, 0, 0, 0, 0};

void setup() 
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  Serial.print("Enter what pin to change state (0-5): ");

void loop() 
  while (Serial.available())
    int pinChange = - '0';
    if (pinChange == 0) //check to see what pin is changing and switch to opposite value
      LEDarray[0] = !LEDarray[0];  
    else if (pinChange == 1)
      LEDarray[1] = !LEDarray[1];
    else if (pinChange == 2)
      LEDarray[2] = !LEDarray[2];
    else if (pinChange == 3)
      LEDarray[3] = !LEDarray[3];
    else if (pinChange == 4)
      LEDarray[4] = !LEDarray[4];
    else if (pinChange == 5)
      LEDarray[5] = !LEDarray[5];
 for (int i = 0; i < 6 ; i++)
    LED = LEDarray[i]; 
  digitalWrite(latchPin, LOW);
  shiftOut(latchPin, clockPin, MSBFIRST, LED);
  digitalWrite(latchPin, HIGH);

What u started is fun as an exercise, but may not be where u want to go.
There exists RGBs with its own controller .. that makes this a bit easier.
search for "RGB led strip individual control"

Thank you for your quick reply.

I will keep those in mind for future projects knut_ny. Unfortunately I have already purchased 100 rgbs and would rather stick to trying to get those to word rather than give up on them. I am quite stubborn that way. I will take a picture of my wiring setup after I get off work tonight if anyone would like to look them over.


How about posting a schematic instead? That will be much more useful.
10x10RGB is like a 10x30 really with the 3 colors.
So you need either 10 anode drivers (current source) and 30 cathode drivers (current sinks) (common anode LEDs)
or 30 anode drivers and 10 cathode drivers (common cathode drivers).

Here's the start of a common anode 8 x 16 matrix to give you an idea - easily expandable to 10 x 30 with 3 more shift registers.
The anodes are all driven at one, while one vertical set of columns is enabled at a time.
Quickly scan across all 30 columns & let persistance of vision make it look like all 30 columns are on.
With 30 columns, each on for 1/30 of 1/30 of a second (30 Hz refresh rate) then each column is on for 1/30/30 = 1.11mS, or 1100uS.

cd74ac164 was selected as it can source 20mA, and tpic6B595 as it can sink 150mA.
10 LEDs, 20mA each, that's 200mA tho.
Perhaps TPIC6A595 would be better choice, with its 350mA capable outputs.
Or TPIC6595, with 250mA capable outputs.

Or stick with TPIC6B595 and increase the refresh rate, 100uS per column, then the TPIC6B can sink more current without overheating.
Might be okay anyway, you need 4 chips for 30 columns, so any one chip is only on 1/4 of the time.
If you find the chips getting hot at 1100uS refresh rate, increase the refresh rate to decrease any one column's on time.
Here's 3 chips controlling a 8x12 display as an example, with the arduino functionality built into the lower half of the card.

HC595 is not a good choice -current thru the entire device is limited to 70mA, so you need to limit each pin to 8mA.

Thank you for your reply CrossRoads. Very informative!

I will purchase a few TPICA6595's and try those out. I apologize as well for I actually am currently working with two RGBs at the moment as a test run so I can slowly increase the size of the matrix up to 10 while increasing my knowledge arduino and circuit design. So really I am doing a 2x1 right now, until I can get more shift registers to go up to say 2x2, 5x5, then ultimately 10x10 (or 10x30 like you said)

I am still very new to electronics and Arduino in general, but I assume the LED drivers are the shift registers?

But anyways, here is my current schematic for my 2 RGBs. It is my first schematic I've drawn, so it may be a little off.

That's not going to work.
LED anodes need to go to 5V, low out of the shift register will turn them on.
MR needs to go to 5V.
VCC needs a 0.1uF capacitor to Gnd.

Well that worked! I had the MR to 5V, but I messed up on the schematic.

So I am guessing that the reason why the LEDs werent working before with 5V is that there was not enough current outputed from the 595 for the LEDs to function. But I am confused to why and how the LEDs are able to be switch on and off although they have a constant voltage.

Now I just need to write a code that actually works (I used a 8-unicolor led example which worked, but mine did not).

Thanks again, and when I complete everything I will be sure to post it.