how do i drive a dual color led display with an arduino?

i bought a dual color RG 8x8 LED display from sparkfun, and how do i use it in an arduino project with MAX7221 controllers? it is a coomon cathode display with 24 pins. here is the item page:

and here is the datasheet:

i am trying to make a simple 3 color clock (or something like that) with a dual color RG led matrix and an arduino.

can someone tell me how to wire up the matrix to the arduino, because the arduino doesn't have enough pins to run 2 colors of 8x8's

more than 3 colors ( R , G , RG ) would also be nice with the arduino :)

sort by: active | newest | oldest
andy8 years ago
I'm doing the same thing currently. I recommend using shift registers.

Use one shift register per set of pins, one for red anodes, one for green anodes and one for cathodes.

I'm using 74HC4094 shift registers and have had no problems with them.

what I have been doing is setting output enable to false (OE low) while strobe (basically an input enable) to high (that one is hard wired). I have linked all of the clock lines together and basically send out 3 bits (red anode, green anode and cathode) for each clock pulse. after i have put out all three bytes of info i raise the output enable again (thus displaying the image for a perceptible length of time) then lower the OE then repeat.

If that sound like gibberish I suggest getting hold of a shift register and just hacking around with it, get some LEDs on the outputs and get a Cylon thing going maybe. There's always the doco but it made little sense to me personally until I had something physical to relate those concepts to and try out stuff.

The problem with this approach is that basically your output image must be a series of squares. The reason for this is that basically a cathode switches on a row and an anode switches on a column, when a row crosses a column that LED is on. It sounds complex but it really isn't; it makes sense if you have the 8x8 bread boarded and plugged in right.

You can still display your clock, it just might need quite a lot of code to get from a time to an image of that time. You can layer the images, basically one after another quite fast so that it looks like one image, much like a TV works.

If it helps I'll code you up a working example and you can see how I'm interacting with the registers.
andy andy8 years ago
Sorry to double post I just caught sight of the last line of your question. Three colors could be accommodated with another shift register. With three shift registers (two colors) I find that they fit nicely under the actual display. so when soldered up it makes a neat package. Again if your interested in this implementation ill post some info, pics, etc.
frollard andy8 years ago
isn't the max 2771 chip he's looking to use already a shift register? You can gang many of them together.
andy frollard8 years ago
Oh yeah, thanks frollard, My only excuse is that it was the middle of the night :( this site seems to provide a good deal of helpful information.
kroq-gar78 (author)  andy8 years ago
the problem with the matrix is that there are 12 pins on each side, and it seems that there is no other cathode pin besides one of the 24 pins i'm really confused on which pin goes where, and which color is which
kroq-gar78 (author)  kroq-gar788 years ago
sorry :( i just read part of the link, and realized it stated where the connections should go. sorry. but i have a question about the current and resistance in the circuit. the regular 5V output by the digital pins would fry a regular led. does the MAX7221 regulate that voltage so that it wouldn't fry the LEDs? or do i have to put resistors somewhere in the circuit
put resistors between the outputs of the MAX7221 and the matrix
i am sorry i do not know
read top comment
kroq-gar78 (author)  kroq-gar788 years ago
i have been very stupid and just realized what "common" is in this case. you have to switch it with the IC (thanks andy :) ) but i have encountered a problem, green and red anode pins together should account to 16 of the pins. they do have the pin numbers marked on the datasheet, but they go in a strange order. if i can find out which pin is which, that would solve this part of the problem. another problem is where do i wire the data, clock, etc. pins? analog or digital??????
I bought the same kind of red/green 8x8 led matrix modules on ebay and was a bit confused from the data sheet as well. Think 8 + 8 + 8 = 24 pins. So you have:
8 common anode or cathode pins for red and green
8 green anode or cathode pins depending on what is common
8 red anode or cathode pins depending on what is common

Now as far as the pin out goes you have to figure out where pin 1 is then the pins are numbered as follows. In most cases from pin 1 (left to right) numbers go up 1-12. Then the numbering should follow from top right to the left 12-24. Please don't quote me as this may or may not be how your led modules are.
 Hi There,

I'm just chiming in here. I bought 12 of these a few months ago to make a traffic light for my kids.Three matrixes on all 4 sides. I was just going to make the top one hard wired to always be red, the middle to be yellow (red AND green on) and the bottom to be green. So I originally was just going to use the 6 pwm pins on an Arudino to make it work, since I only needed 6 different things going on (3 lights on each of 2 sides).

But now I'm thinking it would be better to have individual control and be able to do lots "cooler" stuff. I could still do the red, yellow, green thing for the traffic, but could also make different words or whatever for them to learn. So I picked up some 7HC595's to shift out to the 12 matrixes but then I thought about if I did PWM with them then I could have many different colors besides just red/yellow/green. I was messing around in photoshop to see the different possibilities using only the red and green sliders.

Anyways, so how can I do PWM with an Arduino Mega using shift registers? Or that isn't possible? I need to control a grand total of 288 pins (12 matrixes X 24 pins per matrix). Anyone have any suggestions?

kroq-gar78 (author)  purpulhaze8 years ago
thanks, that might help a little. and i do believe that's how it is, and that's also how ICs are pinned, so i think you're right. thanks!
kroq-gar78 (author)  andy8 years ago
but the website is very helpful:)
frollard andy8 years ago
Yeah, the max is a great current regulated chip for all sorts of things matrix related.
kroq-gar78 (author)  andy8 years ago
it's a COMMON cathode display, so can't i just hook that up to ground instead of whole new registers????
That last register connects the whole row to ground. That way, it lightsthe individual LED rather than an entire row. Lets say you did hookthem up to ground, when you would use the shift register, the entirecolumn would light up. Not just the individual pixels.
andy kroq-gar788 years ago
From the diagram provided I guess the "common" phrase refers to how the Red/Green LED's share a common pin for the cathode of each pixel (and indeed each row of pixels). In terms of control it isn't much harder to interface with.
also when looking at bottom row of pins below WLG writing on back pin 1 is bottom right pin. see diagram

|     12                               1              |
|         .  .  .  .  .  .  .  .  .  .  .  .              |
top pins 13- 20 are RED
bottom pins 5-12 are GREEN
pins 21-24 are lower row ground
pins 1-4 are upper row ground 
i have the same display and have been wondering this for a while too.