Driving 32 Led without multiplexing

Hello everyone,, Im doing a DIY proyect and i would like to keep it as simple as possible. I need to drive 32 (20mA) leds in a line. Not a matrix. I have read that the max power of the Arduino Mega is 200mA global, so im way over it as they will be all turned on at some point.

Is there an IC that could get 32 inputs from the arduino and output them without the limited power of the motherboard?

I'm a noob, and even with all i read about multiplexing it seems to be too much for me.

Thanks in advance

You could cascade four SN74HC595s and drive them with shiftOut().

The MAX7219 is mentioned often for driving LEDs.

Two things:

Do you really need to push the leds to there max?

Please explain "leds in a line". All in series? Do you need individual control? Only on/off or also dimming? (Yes, I count this as a single thing ;) )

Ressler: I'm doing a DIY project and i would like to keep it as simple as possible.

Then as a "noob" you are approaching it completely in the wrong manner. :astonished:

Ressler: I need to drive 32 (20mA) leds in a line. Not a matrix.

Then you do not comprehend what a matrix is electrically. It is in fact, the simple approach. Easier to wire and actually somewhat easier to program!

Ressler: I have read that the max power of the Arduino Mega is 200mA global, so I'm way over it as they will be all turned on at some point.

Fine. Not a problem.

Ressler: Is there an IC that could get 32 inputs from the Arduino and output them without the limited power of the motherboard?

No. And yes. Obviously you do not get 32 inputs from your Nano (waste of time using a Mega 2560) to one chip but there is a proper way to do it.

The chip you want is the MAX7219 matrix driver. This will drive your 32 LEDs to maximum brightness - though desiring to do that is in itself, a fundamental mistake. You wire your 32 LEDs as a four (cathode) by 8 (anode) matrix. This is actually much simpler as only twelve wires run into your line of LEDs, not 33! You program the MAX7219 for a scan limit of four (Value 3 in register 0xB) and the bit patterns for your 32 LEDs are written into the first four digit registers.

Just buy two or three three of these kits: |500x500

Or these ones |500x500 which used to be more expensive but are now actually cheaper and more useful if you wish to stack matrix arrays.

The point is that you do not install the matrix arrays themselves - or their socket pins, but just solder to the positions on the PCB and you have a durable and reliable assembly to drive your own arrays of LEDs wired as a matrix.

Why did I say two or three? Well, you can fully assemble the first one as the matrix with which it comes and practice programming it. Then the second one for your current project and the third one - for the next! :grinning:

And what was your mistake as a "noob"? Thinking in a "linear" fashion - one LED connects to one pin, two LEDs connect to two pins, three LEDs ...

Once you exceed about ten, the landscape changes. For "bulk" problems, you swap to hardware designed specifically for the task and software to match. And you save 31 resistors!

And a Mega 2560 is mostly useful not for more wires (pins), but for its additional memory which in this case I am pretty sure you do not need. A Nano - and not a UNO - is more practical.


dougp: You could cascade four SN74HC595s and drive them with shiftOut().

But they would not drive the LEDs to 20 mA.

Or one of these, and have a pair of wires to go out to each LED if that is easier to wire up. http://www.crossroadsfencing.com/BobuinoRev17/ |500x374 Also available with male headers, or just holes.

Ressler: Is there an IC that could get 32 inputs from the arduino and output them without the limited power of the motherboard?

you could use some driver IC. i.e. ULN2803 - it has 8 inputs and 8 outputs.

As others have already explained, there are dedicated LED driver ICs. like the MAX7219 or the HT16K33 without the need of having 32 inputs. There are also Backpacks available with the HT16K33, and also some variants with this 8x8 LED display which could be used for a quick "proof of concept".

An alternative you should consider are addressable LEDs, which are wired from LED to LED only. Either as WS2812 LED-Strip or as single APA106 LEDs . They look like common 5mm LEDs but you can daisy-chain these LEDs and drive all pins by only one "data" pin.

Paul__B: But they would not drive the LEDs to 20 mA.

Missed that. :(

That’s the big problem. 74HC595s are just digital logic chips, not intended as current drivers. The ATmega chip arguably is, rated for at least 20 mA, reasonably safely up to 30 mA for a few pins only.

But the MAX7219 is specifically designed to drive LEDs, and in quantity. It basically has no other purpose.

dougp:
Missed that. :frowning:

Add additional driver like ULN2803 or use a different chip (maybe MAX6971). I think there are a ton of possible options…

Paul__B:
But the MAX7219 is specifically designed to drive LEDs, and in quantity. It basically has no other purpose.

Also they add flickering… don’t know if this is a problem for Ressler

Rintin: Also they add flickering... don't know if this is a problem for Ressler

Obviously unsuitable for POV indeed, but this was (as usual) not specified.