LED matrix : common anode vs common cathode is there a difference?

I was about to order some MAX7219 that are to be used with common-cathode led displays and I suspect the led matrix I have is common-anode (I have to find it and check). So that got me worried, but then I thought what if I interchange the rows and columns pins? will it not be the same?

If the led display is of the 7-segment type, then this obviously cannot work. But in the led matrix case all leds are 'equal'. For example suppose we have a 4x4 matrix and we want to turn on only the top leftmost led, then the pin voltages will be like this:

					columns				columns
					
				common cathode		common anode
					H L L L					L H H H
				L					H
	rows			H					L
				H					L
				H					L

so if we interchange the rows pins with the columns pins, a common-cathode matrix becomes common-anode and vice-versa, is this right?

and if it is, doesn't it mean that the MAX7219 can work with a common-anode led matrix just as well?

I just found a this comment from an older thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234734485:

For a single color matrix, there is no "common" anything. A row of anodes and a column of cathodes, one-for-one. You just have to put the cathode pins LOW and the anode pins HIGH and be able to source and sink enough current through the LED without frying it.

The only meaning the "common" has is when you're talking about multiple colors. You show an RG matrix with common anodes (each cell has two LEDs wired to the same anode).

so the answer is yes, for single-color matrix only
if the matrix has more than one colors, then the number of the row pins is NOT the same as the number of the columns pins and no interchange can happen...

Alas it's not a simple job of swapping the anode/cathode (segment/digit) wires over at the fundamental way the LED's are wired to each other must also be changed or the LED's must be individually turned round.

Look at this image
Swapping segment and digit will not work because the LED is a one way device. Because it's a matrix though the Anodes and Cathodes are both common to each other.

hmmm....but I think that the correct polarity still applies
this is the "interchange" I have in mind:

so for example if on the left of the above picture we have a MAX7219 that is connected to a common-cathode matrix led, its top leftmost led is lit. Now if we connect them to a common-anode matrix of the same physical orientation but swapping the row pins for the column pins, its top leftmost led will also light. The same happens for the other leds, so they are equivalent (I think)

about the colors: since a separate chip will be needed for each color anyway, that means that a multi-color common-anode led matrix can also be used with a couple of MAX7219

I don't know if I'm confused because I hope I'm right and so that I don't have to order another led matrix lol

I think if you have 2 MAX7219 trying to drive a 16x8 matrix (2 color) or 3 driving a 24x8 matrix (RGB) there would be a lot of interference between chips as they each try and drive the anodes or the common cathodes for their own 800 Hz multiplexing.

CrossRoads:
I think if you have 2 MAX7219 trying to drive a 16x8 matrix (2 color) or 3 driving a 24x8 matrix (RGB) there would be a lot of interference between chips as they each try and drive the anodes or the common cathodes for their own 800 Hz multiplexing.

yep you got a point there, because each color matrix will share either the column or the rows with the other...which in turn are driven by separate MAX7219, so this will need a scheme to multiplex the 7219s. I haven't looked in the datasheets if they have such capability, my first though is to switch them on/off alternatively fast enough to get the colors multiplex...but that sounds like a punishment to the chip lol

A better solution would be to use one MAX7219 and connect the anodes (for common-cathode) or cathodes (for common-anode) of each color maxtrix alternatively to it, by using an arrangement of transistor and logic gates that acts as a SPDT switch. That will be interesting to try. (EDIT some 4066 bilateral switches could take care of that, although not in the most efficient way perhaps)

back to the main point though, it seems you agree that a MAX7219 will work with common-anode led matrix just as well? :slight_smile:

I did not say that, no.

However, if the MAX7219 multiplexes by driving current into one Digit line and sinking current into 1 Segment line at a time, then electrically you would be okay.
If you ran in no-decode mode and defined your fonts you'd be okay, otherwise things could rotated 90 degrees, or maybe flipped somehow, from what you are expecting.
It would be easy to write a sketch to turn on 1 segment at a time, one register at a time, to see where things ended up.

CrossRoads:
I did not say that, no.

However, if the MAX7219 multiplexes by driving current into one Digit line and sinking current into 1 Segment line at a time, then electrically you would be okay.
If you ran in no-decode mode and defined your fonts you'd be okay, otherwise things could rotated 90 degrees, or maybe flipped somehow, from what you are expecting.
It would be easy to write a sketch to turn on 1 segment at a time, one register at a time, to see where things ended up.

bingo
that's a good question, HOW does MAX7219 does the multiplexing?
in my simple example, everything seemed to be fine. And what works for one LED works for any other, so the two matrices are identical...nope! That would work if only one LED is lit at a time, which I'm sure is not the case, without even having to refer to the datasheet, because
-it's hard to imagine the professionals would design it in such an inefficient way
-it's hard to imagine that only I discovered that MAX7219 works with common-anode while everywhere is written specifically "common-cathode"

To be more specific, if we want to switch the two leftmost leds in the upper row, then for the common-cathode it's
ROW1,2,3,4 = L, H, H, H
COL1,2,3,4 = H, H, L, L

if we do the swapping the way I suggested, for the common-anode it will be:
ROW1,2,3,4 = H, H, L, L (the COLS from above)
COL1,2,3,4 = L, H, H, H (the ROWS from above)
and this will result in lighting leds {row, col} = {1,1} and {2,1}
(rows run from top to bottom and cols run from left to right)

even if we rotate by 90 degrees the resulting image will be the mirror of the desired one...yep it's gonna take some software fiddling which I'm not willing to do (I love programming but I'm currently working on other projects), I prefer to buy another led matrix.

I'm just gonna check if there's any library that supports common-anode

nah, I don't think there's something available right now.
I went here http://arduino.cc/playground/Main/MAX72XXHardware and checked each entry, they all mention common-cathode. It was too good to be true lol

Maxim has other parts.
http://datasheets.maxim-ic.com/en/ds/MAX6960-MAX6963.pdf
This could be good for another thread that was discussing 2 color & RGB matrices.

They also have this one that does common anode matrices

CrossRoads:
Maxim has other parts.
http://datasheets.maxim-ic.com/en/ds/MAX6960-MAX6963.pdf
This could be good for another thread that was discussing 2 color & RGB matrices.

thanks, I'll keep those in mind
I see that ICM7218 is much more expensive than MAX7219 in ebay. Actually MAX used to be rather pricey last time I checked, but today I found two pieces for about 3$ from many sellers.

How much on e-bay?
You can get from distributors new for $4.40 & $5.11
https://avnetexpress.avnet.com/store/em/EMController/LED-Drivers/Maxim-Integrated-Products/ICM7218CIPI/_/R-1324507/A-1324507/An-0?action=part&catalogId=500201&langId=-1&storeId=500201&listIndex=-1&page=1&rank=5

https://avnetexpress.avnet.com/store/em/EMController/LED-Drivers/Intersil/ICM7218AIJI/_/R-2065563/A-2065563/An-0?action=part&catalogId=500201&langId=-1&storeId=500201&listIndex=-1&page=1&rank=0

http://www.ebay.co.uk/itm/10pcs-Original-MAX7219CNG-DIP-24-MAX7219-MAXIM-LED-Display-Drive-NEW-m-/390357314467?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item5ae31beba3 works out about $1.56 per chip.

The MAX7221 has been used in multiplexed displays and I recall a forum discussion on it. Another cheap chip to consider is the WS2801 with a shift register.

CrossRoads:
How much on e-bay?
You can get from distributors new for $4.40 & $5.11
https://avnetexpress.avnet.com/store/em/EMController/LED-Drivers/Maxim-Integrated-Products/ICM7218CIPI/_/R-1324507/A-1324507/An-0?action=part&catalogId=500201&langId=-1&storeId=500201&listIndex=-1&page=1&rank=5

https://avnetexpress.avnet.com/store/em/EMController/LED-Drivers/Intersil/ICM7218AIJI/_/R-2065563/A-2065563/An-0?action=part&catalogId=500201&langId=-1&storeId=500201&listIndex=-1&page=1&rank=0

the cheapest ICM7218 I can find on ebay is at 9$ with shipping costs. It's cheaper from distributors as you say but I usually buy almost exclusively from ebay because I don't want to wait to make a big order and save on the shipping costs from a distributor. MAX7219 is as cheap as 1.5$ on ebay. It's just so seducing lol

But anyway, I decided to refrain from buying another led matrix now just to use a MAX, I think I'll use what I have: 595's and 2803; that is the good old way.

Riva:
Another cheap chip to consider is the WS2801 with a shift register.

yeah I saw this chip recently and it seemed pretty cheap, especially considering it provides I2C. But is it suitable for the application? It has only 3 channels, so to deal with a row or column (8 leds) at a time, I will need 3 of them (?)

WS2801 was a typo on my behalf I was trying to type WS2803. It's the same as the WS2801 but has 18 channels.