I'm maybe missing something really obvious.... MAX7219 vs 595

So for the next step of my project I'm looking at lights, and ideally I want a tonne of lights as this would look cooler!

I've been looking at the whole Shift Out thing using the 595 chips and if I use two of these I can drive a "whopping" 16 LEDs...

But... The MAX7219 chip can drive 64 LEDs, I appreciate the layout of these LEDs is usually in the form of a dot matrix display, but surely, it's just LEDs wired up in a slightly different way to the average LED.

I accept I'm speaking from total ignorance newbie here, and I'm guessing it if made sense nobody would be talking about the 595 chips, but I'd love to hear an explanation to why not.

So what was your question?

I think the word you are looking for is "multiplexing".

Sorry, I thought the question was implicit...

What is the point of using a 595 chip to drive 8 LEDs when a MAX7219 will apparently drive 64.

It feels like there should be an inherent problem with using a MAX7219. If not, why aren't people doing this more often. I've not been able to find any wiring diagrams or tutorials on this, everything I've found on a MAX7219 appears to only talking about driving a prebuilt matrix, what I want to do is basically have 128 wires (+/- x 64) coming off the chip that I can stick an LED on the end of each one.

Cheers, Rob

Moreover, in theory I could hoof the matrix display off the max7219 breakout board I've already got and poke wires in the holes where the matrix display sat before, but this feels a bit clunky.

Actually just found this...

Which contains this diagram which looks like what I might need...

OK, I appreciate I'm answering my own questions here...

Did you read the article?

What did it tell you?

The max7219 not only handles 64 leds by multiplexing, it handles also current limiting. To achieve all that using 595s you’d need two 595s, 8 current limiting resistors and a program to handle the multiplexing.

6v6gt:
The max7219 not only handles 64 LEDs by multiplexing, it handles also current limiting. To achieve all that using 595s you’d need two 595s, 8 current limiting resistors and a program to handle the multiplexing.

And eight buffer transistors to handle groups of eight LEDs in parallel. Or use a TPIC6B595 instead of one 74HC595.

Hi Rob.

74hc595 is a general purpose logic chip. It was not designed specifically to drive LEDs, and in fact it is not particularly good at it. It's maximum current is rather limited, for example, and series resistors are needed. But it can perform a huge range of other logic tasks that have nothing to do with LEDs. And it is very basic and easy to understand and use.

Max7219 was designed for driving led displays, 7-segment, matrix or whatever. It has built in series resistors which automatically adjust to the type of led (constant current drivers). It takes advantage of the "persistence of vision" effect that our human eyes have, combined with multiplexing, to drive 64 LEDs with only 16 pins. But it's useless for anything other than driving LEDs, and it's a much more complex chip to understand and use, especially for beginners (although various Arduino libraries make this easier than it would otherwise be).

So that's why beginners are encouraged to try using 74hc595 first. But once you have moved beyond that, then yes, it would seem pointless going from max7219 back to shift registers for driving LEDs.

But if you want to control 64 relay modules, max 7219 would be completely unsuitable, it just wouldn't work. You would need 8 x 74hc595 or similar.

PaulRB:
(MAX7219) and it's a much more complex chip to understand and use, especially for beginners (although various Arduino libraries make this easier than it would otherwise be).

I dispute that!

Its interface is identical to a chain of 74HC595s and multiplexing is extremely difficult for "beginners" to implement. You do not need any library that you do not need for the chain of 74HC595s (if you call "shiftOut" a library); you just set a number of registers and write the data in where you want it.

PaulRB:
Max7219 was designed for driving led displays, 7-segment, matrix or whatever.

It is. There is sometimes confusion and suggestion that it cannot drive common anode displays - clearly it has no trouble doing that.

PaulRB:
It has built in series resistors which automatically adjust to the type of led (constant current drivers).

According to the datasheet, that is not actually correct. You are supposed to match the current defining resistor to the LED voltage. In practice, it is unlikely to matter (if you choose for red LEDs at the maximum rated current).

So, just to throw this out there I'm going to be using the MAX2719, I took a look at the breakout board I've got with an 8x8 matrix on it and realised I could just pull the matrix off it which exposed two lovely lines of 8 holes perfect for jumpering across to a breadboard for experimentation.

I'm actually going to try and drive 4 LEDs instead of one off each "port" so to speak.

The plan is to create a quarter of a circle with 4 x Red / Green LEDs (dual colour ones), so the ground will obviously go to the centre pins and then first 4 pins to the reds and 4 to the greens, allowing me to colour Red, Yellow and Green. Then each of these quarter circles will be duplicated 3 more times to create a full circle of LEDs (hence driving 4 LEDs per "port" [what is the correct term?]).

This whole shebang will then be duplicated a further 5 times for each of my targets (see blog thingy below).

This will leave me opportunity to drive a further 16 LEDs if I feel the urge!

Hopefully this kind of thing isn't going to draw too much current and pop the chip, the majority of the time there won't be much going on and very very rarely (if at all) will everything be lit. But hey, try it and see eh!

Any advice on how stupid I'm being here is always welcome.

Cheers, Rob

Blog Thingy

So these look like they'd do what I want...

So the MAX7219 has a 40mA output.

Those LEDs have a 20mA forward current, does this mean they draw 20mA? If so what does this mean if I wanted to drive 4 of these from 40mA. Simple maths says I can do 2 but not 4? Is this correct logic?

RobFarley:
So, just to throw this out there I'm going to be using the MAX2719, I took a look at the breakout board I've got with an 8x8 matrix on it and realised I could just pull the matrix off it which exposed two lovely lines of 8 holes perfect for jumpering across to a breadboard for experimentation.

That is exactly what I regularly recommend for experimentation and for the final assembly. If you buy the kits unassembled, you don't fit the headers for the matrix and solder your wires directly to the holes, The boards you have are otherwise pretty useless as they do not stack properly, the other "FC-16" designs are stackable.

RobFarley:
I'm actually going to try and drive 4 LEDs instead of one off each "port" so to speak.

Put the LEDs in parallel? Not such a good idea, just give each LED its own position in the matrix.

RobFarley:
The plan is to create a quarter of a circle with 4 x Red / Green LEDs (dual colour ones), so the ground will obviously go to the centre pins and then first 4 pins to the reds and 4 to the greens, allowing me to colour Red, Yellow and Green. Then each of these quarter circles will be duplicated 3 more times to create a full circle of LEDs (hence driving 4 LEDs per "port" [what is the correct term?]).

Four red/ green LEDs takes half a row and two rows high. Four of these will therefore take four rows, half of a matrix. I am presuming common cathode LEDs.

RobFarley:
This whole shebang will then be duplicated a further 5 times for each of my targets (see blog thingy below).

If the targets are separated by any distance, you want to use one MAX per target, even if only half used.

RobFarley:
Hopefully this kind of thing isn't going to draw too much current and pop the chip, the majority of the time there won't be much going on and very very rarely (if at all) will everything be lit. But hey, try it and see eh!

If you were to connect LEDs in parallel, it would be a wasted effort. You would be sharing the exact same current over four LEDs and it may be quite uneven. The chip would know no different. Just don't do it.

But if as I say above, you only have one module per target, you would use 16 LEDs as four columns only of four row pairs, and reduce the scan count to four so that it would multiplex by four, not eight. This doubles the drive to the LEDs. It is generally OK to drive 20 mA LEDs at 40 mA for one quarter of the time or less in multiplexing. As you have illustrated your use of the MAX7219s already, it is clear you already understand the multiplexing and coding for them.

Just a couple of questions...

Put the LEDs in parallel? Not such a good idea, just give each LED its own position in the matrix.

Why is running 4 in parallel a bad idea? I appreciate it's going to have more power draw but if it works it works surely? What is the bad part of it?

If the targets are separated by any distance, you want to use one MAX per target, even if only half used.

What is "any distance" everything is going to be within 1 metre, surely the electrical signal isn't going to drop out over that distance?

I'm trying to avoid using a MAX7219 per target mainly for cost reasons, that said when I was considering cost the price of each 7219 looked to be about £5 per hit (for a chip on a board so it's easy to mount and solder), subsequently I've seen them for a little over £1, but I did consider chaining one per target, would actually make the wiring and coding easier!


Link!


RobFarley:
Why is running 4 in parallel a bad idea? I appreciate it's going to have more power draw but if it works it works surely?

No, it does not have "more power draw".

Just an update if you're interested...