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!
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.