Help needed with a common anode 8x8 rgb led matrix

Hello,
I'm a programmer and want to step into the world of electronics and microcontrolers. So I bought myself an arduino mega and two led matrices: first 8x8 single color, second 8x8 RGB. Both are common anode matrices.
I have driven the first one by multiplexing: took the anodes as rows and the cathodes as columns. I set one row to high and the cols that I want to light to low. then switched to another row... so far so good.
After I played around with it, I wanted to drive the rgb matrix. I left the code and first drove the blue color. it worked as before. Then i wired the other colors up, where I start facing problems. I first realized that in this way I could only possibly get 7 colors by mixing (r, g, b, rg, rb, gb, rgb). The second issue I face iwas: if I power the red led, the others don't light up, as if the red is stealing current. I googled a bit and found out, that i could get different colors by using pwm, using this tutorial, but I don't quite get it. The code in page 5 of the how to it uses pwm for the cathode part. Mustn't it be negative pwm values as it is the cathode part? How am I supposed to apply this to my matrix? Using this method I must use 24 pwm pins which I don't have. Or can I use only the anodes as pwm pins? But then again I cannot use different color values for each of my leds in a row. Or am I supposed to multiplex every single led using 64 cycles for one image, instead of only 8? Do I get the concept of multiplexing wrong somehow? what am I supposed to do? Any hint is appreciated :sweat_smile:

Ruffman:
The second issue I face iwas: if I power the red led, the others don't light up, as if the red is stealing current.

Sounds to me like somebody didn't put any current-limiting resistors in their circuit...

You are right, I don't put in resistors to limit the current, but if that helps I have a lot of them lying around... I thought my matrix has its own resistors for each row, because the datasheet says something about "5V ReverseVoltage"... but If you say that I should insert them I'll do it.
I guess 8 330 OHM Resistors on the anode part will do it?
My main problem is now how to get different colors for each row. How to get around the need of using 24 PWM pins?

I've built up a I2C driven 8x8 RGB matrix. Maybe you'd like to take a look.

Thanks, but it already got 4 8x8 RGB matrices bought on ebay for 6$ each... so its about 6,5 times cheaper than yours :stuck_out_tongue:
Also the learning experience is one of the main goals I play around with the arduino, so maybe you like to give us the circuit design of your I2C driver, so I can built one myself.

$6 for a 8x8 RGB matrix is incredibly cheap. Can you share me the link for that?
Actually my module is an Arduino (atmega168) itself.

Ruffman:
You are right, I don't put in resistors to limit the current, but if that helps I have a lot of them lying around... I thought my matrix has its own resistors for each row, because the datasheet says something about "5V ReverseVoltage"... but If you say that I should insert them I'll do it.
I guess 8 330 OHM Resistors on the anode part will do it?

Do it (before you hurt the LEDs!)

The red LEDs might need a bigger resistor because they need less volts. If you use the same on all three colors the red will be brighter than the other two.

Ruffman:
My main problem is now how to get different colors for each row. How to get around the need of using 24 PWM pins?

There's no way around that with one of those matrices. You'll need 2x TLC5940 or something like that. The TLC5940 has built-in current regulation, too, so you won't need resistors.

stanleyhuang:
$6 for a 8x8 RGB matrix is incredibly cheap. Can you share me the link for that?

You can get them even cheaper. Just search for "rgb led matrix" on eBay.

stanleyhuang:
$6 for a 8x8 RGB matrix is incredibly cheap. Can you share me the link for that?

of course i can:
here, but as fungus stated: just search yourself on ebay. There are sometimes even cheaper. The downsite is, that you have to wait for about 2 weeks for the delivery

fungus:
The red LEDs might need a bigger resistor because they need less volts. If you use the same on all three colors the red will be brighter than the other two.

so you mean putting resistors at the 8 anodes is wrong, and I should use a proper resistor for each color? The datasheet gives me no information about the different led colors, and how much they source. I guess I'll have to find that out myself.

fungus:
There's no way around that with one of those matrices. You'll need 2x TLC5940 or something like that. The TLC5940 has built-in current regulation, too, so you won't need resistors.

They only way I can think of saving pwm pins, is multiplexing each pixel inside the matrix. Is the Arduino MEGA capable of doing so in terms of speed?

Ruffman:
so you mean putting resistors at the 8 anodes is wrong, and I should use a proper resistor for each color?

Yes.

Ruffman:
The datasheet gives me no information about the different led colors, and how much they source. I guess I'll have to find that out myself.

The datasheet assumes people are going to use proper constant-current drivers, not resistors.

fungus:
They only way I can think of saving pwm pins, is multiplexing each pixel inside the matrix. Is the Arduino MEGA capable of doing so in terms of speed?

Maybe, but why bother?

You'll have to add external shift registers to be able to connect 24 LEDs to an Arduino so why not use shift registers with built-in PWM and constant-current control? (ie. TLC5940 or similar)

fungus:
maybe, but why bother?

You'll have to add external shift registers to be able to connect 24 LEDs to an Arduino so why not use shift registers with built-in PWM and constant-current control? (ie. TLC5940 or similar)

Hmm the TLC5940 is hard to get in germany. It is also very expensive, because 1 has the price of one of my matrices, and I'll need two of them for each. Isn't there a cheap chinese replacement :roll_eyes: $)

Ruffman:
Hmm the TLC5940 is hard to get in germany. It is also very expensive, because 1 has the price of one of my matrices, and I'll need two of them for each. Isn't there a cheap chinese replacement :roll_eyes: $)

Search for "TLC5940" on eBay...you can get them for about $1 each from China.