Can I have some help? I want to make a 12 by 12 RGB LED matrix and control it using as few Arduino Uno pins as possible. Most people will answer with multiplexing but I don't understand how to do that. My plan is to connect all the GND pins of the LEDs (I am using common cathode RGBs) to the GND of the Arduino via a 220/470 ohm resistor. The rest of the positives will be connected to .... I don't know. Because if I just use a Arduino pin, I will:
1.run out of pins fairly quickly (12 times 12 equals 144 RGB LEDs and 3 pins per LED = 144 times 3 equals 432. That may pins are'nt even available on a Mega.
2. complicate control
3. make it impossible to connect anything else to the Arduino. (want to use a speaker and a real time clock also, to make time setting and talking possible. may add a keypad to, so need very few pins. 8 is the most I can afford.)
NOTE: I want to use only one Arduino Uno/Leanardo. I don't want to use a Mega.
Any help / ICs / code would be helpful. Remember, 8 pins is the most I can have!
OK for a start we are talking about 432 LEDs, that is a big project for some one with so little knowledge.
Do you want the LEDs to be dimable?
The absolutely simplest way is to get some RGB LED addressable strips and you can get away with using just two Arduino pins.
Simple way is to use 2 shift registers (cd74AC164) to drive 12 common anodes in rows across the matrix, and 5 TCIP6B595 shift registers to sink current from cathode columns one at a time.
Someone else has almost the same thing in another thread, his is 5 rows by 15 columns; 12 rows by 36 columns is not different.
Your code will turn off the cathodes, set up the anode data, and turn on a cathode.
1150microseconds later, you will repeat for the next column.
1160 comes from 1/24 total refresh rate / 36 columns: (1/24)/36 = 0.001157Sec, or 1160uS. 24 frames/second is movie theater speed.
Use SPI.transfer to send the data to the shift registers at 4 Mbits/second (default speed), and pull the data to display from an array. 7 shift registers will take ~20uS to update, leaving you >1000uS to read buttons, receive data from serial port, etc. and make display data changes. Or you can pull data from PROGMEM, EEPROM, whatever.
I would use 4 pins: SCK, MOSI, and chip select each for each shift register bank.
Or 1 chip select for both, and 1 pin for the TCIP6B595 output enable, use that to disable the cathode drives while anode data is being shifted in.
See reply #6 here for the start of the 5x5 (5x15 with common anode RGB) matrix,
yours will be 12 x 36.
Most people will answer with multiplexing but I don't understand how to do that.
Then you are going to learn how to do the multiplexing. It should however, not be too painful.
Basically, no-one is going to tell you any other way to do it, as with the answers you have already received.
No, I don't want the lights to be dimmable. And where can you find one of those RGB LED addressing strips? Two pins for 144 RGB LEDs would be awesome.