Controlling 32 powerful leds via 5 digital pins

Hello all,

Sorry for the newbie question/style... I need to control 32 powerful leds (I don't know the exact type, but this is less significant, it could be any module that requires an external power supply) via 5 digital pins. I know a multiplexer will do the opposite thing, but instead of "querying" for a specific value, I need to set it (led on/off).

Thank you,
Superware

do you mean that you need to control them separately?

do you mean that you need to control them separately?

Yes.

do you want to turn each one on/off, or to indivudually control their intensity?
If it's on/off then you just need multiplexing; see this post on the Max 7219... you would wire your leds in a matrix. The datasheet says the chip will drive LEDs up to 40ma.

But.. that's probably not what you mean by 'high power'. If you need more than 40ma of current per led, then you need two things: a chip or chips to spread out the digital outputs from 5 to 32, and then a transistor on each output/LED to switch the current required by the LED.

There's a tutorial here on using a shift register (8 leds, but you just cascade it...) and here's a diagram for driving LEDs with a transistor. a 2n2222 will drive up to about 800 milliamps happily; a TIP102 will drive several amps worth of LEDs. For 32 big LEDs, you'll need a pretty big power supply too!

hope this helps

D

Thank you for your most useful answer!

So, the basic steps are: connecting each led to a transistor (TIP102) to form a complete (independent of the Arduino and it's power supply) circuit running on external power, connecting each transistor to the display driver (MAX7219) and connecting it to the Arduino. Is this right?

Thanks!
Superware

hi,

the answer is easy, no sweat! Welcome to the Arduino community.

Basicaly you have got two design tasks: to figure out how to spread out the outputs, and to figure out the appropriate circuitry for amplifying those outputs to be able to drive the appropriate LEDs.

Multiplying your outputs: For low current LEDS ( i.e. about the usual 20ma/LED), you can use the MAX7219, or the 4794 shift register described in the tutorial above. There are other chips available: the basic idea is that you use a limited number of pins to address the LEDs.

Driving high-power LEDs: If you're driving big LEDs (>20ma), then the multiplexing chip or shift register won't be able to drive them directly. In this case you need to add a driver transistor (e.g. 2N2222 or TIP102) or driver chip (e.g. ULN2803) to control the high-current load that the big LED represents. Note that while it might be possible to use transistors on the row/column outputs of the MAX7219, I haven't tried this. Maybe Massimo or someone has... The usual solution would be to use a bunch of shift registers or similar, each with its own transistor on the output pin.

In any case, you probably need to get a hold of the LEDs, or at least figure out their current requirement before you can figure out what circuit you'll need.

D

PS: When you get a working circuit, don't forget to post the fruit of your research to the Playground :slight_smile:

Daniel

Thanks for the great answers you always provide on this forum:)

Once i've tried to increase the power of a max7219 with external transistor and it was a nighmare... the circuit was working in a breadboard and never worked properly on a pcb... i'm sure there was something wrong with it but 3 of u never found out....

superware
hve a look at the TI TLC5940... 16 LED outputs up to 120 mA per channel with constant current drive... can be cascaded and uses a simple SPI like interface... each channel can be controlle with 4096 brightnes levels... it's also available in a 28 pin DIP package that you can solder yourself.

massimo

Wonderful answer :slight_smile:

You are right, the LEDs are the big issue here, but what I know for sure is that the amount of light I'll be needing is very big (maybe 1A per channel/led-strip x 32). The idea with the max7219 and the transistors sounds like the best solution yet, this will allow me to switch any current (?). I hope it's doable.

Thank you for your time,
Superware

Hi massimo,

As you can tell, i'm kind of an electronics newbie... a common opening sentence :slight_smile:
Sorry if I was unclear before (Daniel), I'll try to better explain my needs: ability to separately control the state (on/off) of 32 led-strips (let's say 1A each).

Superware

Wow, 32 amps! You are going to either need to get the circuit breakers on your house rewired, or get a whole bunch of gerbils running on the generator wheels! :slight_smile:

Seriously though, I would be curious to hear what this project is... or is it TOP SECRET?

Once i've tried to increase the power of a max7219 with external transistor and it was a nighmare... the circuit was working in a breadboard and never worked properly on a pcb... i'm sure there was something wrong with it but 3 of u never found out....

This is good avice from Massimo... the multiplexing is complicated enough as is, but when you add the fact that potentially 32 amps will be running through your matrix of LEDs... which means one wrong move or wiring error, and it will be kaboom!

If I were you I would get start by prototyping a few channels of LEDs, to get a feel for the complexity. If you are new to electronics this might be the best strategy, as each channel is independent and can be troubleshooted separately. With the 7219 matrix, the LEDS and transistors are inter-related, so it will likely give you many headaches in troubleshooting if you are new to this kind of thing.

So, why not try the shift register in the tutorial, and connect each output to a big transistor driver TIP102. Start small and build on what you have. Massimo can probably suggest a good MOSFET also, or the european part number for a TIP102.

D

hey, @superware, are you taking about led strips wired in series, or parallel? What voltage do they take? Do you have a link for them?

D

The leds are just a small part in the project, once it's finished I'll publish the complete story. Regarding the 32A, I might have exaggerated, and besides, the strips won't be on all at the same time so it will be much less.

Using the arduino (or any other microcontroller for that matter) to switch/control other circuits sounds like a very useful idea, think of the possibilities... :wink:

Superware

For that many leds - parallel I guess, they will be identical (white). I'll meet a light technician later this week or early next week, after we select the best lighting solution - I'll know the exact details.

Btw, what about cascading HEF4794B/HEF4894B (how/why does the cascading work?) AND using some kind of a relay to the other circuit? maybe without multiplexing the transistors solution might just work...?

Thank you for your help,
Superware