Can I run 384 LEDs with an Arduino? make them chase each-other?


I am trying to run a mod project on my new PC and I am a total nOOb on arduino and electronics.

I have 24 fans, each fan has 16 LED, 4 on each side. Currently the LED's are run in series of 4, but they are always on. Now I was wondering if I could make them lit one-by-one, creating a moving LED ring around the FAN.
The LEDs are all 5mm, 2.1 V at 20 mA (L-7113CGCK).

So for this project I need to run 16 outs with 24 LEDs on each out and the outs need to cycle ON one after the other. I want to use the control software to manage the cycles.
As a side question, I noticed some Arduino's have PWM support on some outs, would that could also allow me to dim the LEDs then, that would be a nice bonus?

I started looking for a control board / chips etc... and came across the Arduino stuff and perhaps it can help me get this done :slight_smile:

So what do I need to run this? Which board would you recommend I use?
How do I managed the power? Can the board take the Amps?
Do I still need resistors on the out circuits, or can the Arduino manage the voltage?
Can I dim the LEDs and control that from the software?

Any other advice?

Thanks for your imput

At 20mA each the LEDs could be driven directly from an Arduino I/O pin. You would definitely need a current-limiting resistor in series with each LED. A standard Arduino UNO is always a good starting point for learning Arduino development. This has fourteen digital I/O pins and six analog input pins which can be used as digital I/O pins, so you have enough pins available to control sixteen LEDs individually. The 'chase' logic you describe would be relatively simple to code.

Only six of the digital I/O pins on a UNO support hardware PWM but that isn't a problem - the Arduino is easily fast enough to perform PWM in software so it would be possible to control the brightness of each LED independently, if you wanted.

Are you going to rewire the fan so the LEDs can be controlled individually?
Either unique anodes or unique cathodes?
You could use a MAX7219 to control 64 LEDs each, so 4 fans per chip, 6 MAX7219 total.
It would require LEDs to be wired as groups of 8 with common cathode, and anodes wired in parallel, and offers 16 levels of brightness control.
Only 1 current limit resistor per chip is needed.

Make up a break out board, with 9 wires going to each group of 8 LEDs (8 anodes, 1 common cathode). Still an 8x8 matrix, just spread out more.

MAX7219-MAX7221.pdf (451 KB)

At 20mA each the LEDs could be driven directly from an Arduino I/O pin.

@Peter: Rosh said "16 outs with 24 LEDs on each out", so that would be 24 x 20mA per pin, far too much for the Arduino!

@Rosh: if you connect 2 x ULN2803 chips to the 16 Arduino outputs, they will be able to handle the current, although if you run all 384 at once, there might still be an overheating problem, but hopefully your 16 fans should deal with that! You will need to feed 5V and Ground to the LEDs/ULNs direct from the PSU, not via the Arduino. If you attach a simple thermistor to one of the Arduino's analog inputs, you could vary the speed of animation according to the temperature inside the case.

@CrossRoads: Bob, you did not suggest TIPC6B595! Are you feeling unwell, my friend? :wink:

Not the right part for this application :wink:
Would need 48 of them, or some complicated multiplexing with additional transistors. Not a "total nOOb" way to get into electronics.

I'd suggest you start by controlling the LEDs for just one fan. Or, maybe even start with a 4 or 8-LED chase to get everything figured-out before you scale-up.

There are really two questions/issues -

1. How many "channels" do you need? If all of the fans have the same "pattern" at any one time, you just need 16-channels. If fact, you can do a nice "chase" with only 4-channels with the same LED pattern on each of the 4 sides. Or, you can go with 8-channels and two LEDs on opposite-sides of the fan will come-on together.

2. How much power/current do you need? 20mA x 384 is almost 8 Amps!!! (40 watts at 5V). You can reduce that if you can wire the LEDs in series and increase the voltage. (Wiring the LEDs for one channel, that all come-on together, in series.) i.e. If you wire the LEDs in series in sets of 4 (with the same current flowing through all 4 LEDs) and supply 12V (or more), you will cut your current requirement to than 2 Amps. It's another discussion, but you need more than the required LED voltage (more than 4 x 2.1V).

You'll need the power supply and some sort of driver chips or MOSFETs to handle the current. The more channels you have, the more driver-channels you'll need, and the fewer channels you have the more current each driver will have to handle.

A couple of other thoughts...

  • You can do a chase effect with just a shift-register chip (and something like an LM555 chip to generate a "clock" pulse to "shift" the data). No Arduino required! If you wire the output of a shift register back to the input, the data (or "pattern") will go in a "circle" and you've got your chase effect! It's called a "ring counter" because the data goes-around in a circle. You'll need to load the initial pattern into the shift register (which might require parallel-load shift-register and/or some inginuity). It's more work and a few more parts to do it in hardware, but the parts are cheaper than a microcontroller and no programming is needed! You can cascade as many shift-registers together as you wish if you want more channels.

  • Of course, you can reverse direction... You need a bi-directional shift-register if you want to do that in hardware.

  • You can do different patterns such as 2-LEDs (or more) chasing, or with only LED off "chasing around". The more channels you have, the more various patterns you can shift-around. (If you want that kind of variety, a microcontroller and software are an advantage over pure-hardware.)

  • By inverting the output of the shift register before feeding it back-in, you can get something called a "Johnson Counter" (AKA "Twisted Ring Counter"). Of course, you can do this in software too.

A 4-channel Johnson-Chase looks like this in binary (if you start-out with zeros):

It looks cool in reverse too.

Of course, you can do the same thing with more bits/channels. I've built an Arduino-controlled 24-channel lighting effect that can "ring" or "johnson" in either direction. It uses 3 special 8-bit LED-driver shft-registers, driving one LED (~20mA) per channel. Since it's controlled serially, it only uses 3 Arduino outputs. (Actually it's a "stereo" lighting effect, and there is a total of 6 driver chips and 48 LEDs.)

Several years ago, I built a 4-channel chase effect with shift registers that can ring or Johnson in either direction. It runs 8 or 16 strings of Christmas lights, or 16 floodlights. One of the set-ups is 16 floodlights in a square... just like your fan LEDs, only a lot "bigger" (and I don't have 24 of 'em). It switches randomly between ring & Johnson and it can ring in one direction and Johnson in the other. The speed is controlled by the loudness of the music, and the direction & ring/Johnson modes change randomly. You can get some strange random patterns in the Johnson mode (depending on when it switches direction & modes), but mostly the randomness makes it more intersting... And, it can get "stuck" for awhile in the ring-mode with all of the lights on or off so you can't tell it's "shifting"... But, it's still a cool effect, and any "weird modes" can easily be avoided if you build it in software.

At 20mA each the LEDs could be driven directly from an Arduino I/O pin.


You're right - I had missed the reference to twenty four separate sets of LEDs.