48 Individually controlled LEDs to create a blinking starry background

Hello Community, first I am very new to arduino and have a task to create a starry background for a marching band prop. I need a way to control a bunch of LEDs (48 or more) individually. Some LEDs will have different blinking rates, while others will be just on with various brightness. I was thinking of using an Arduino Mega controller to do this since it has a lot of digital outputs. I am not an electronics expert at all so need help in how I would design this from power to all components (resistors, transistors, etc). These are the LED lights I was thinking about using

Any and all help would be greatly appreciated as well as any other ideas that might be better to create this effect.

Thanks,
Paul

Something like a MAX7219 could do it easily together with a Arduino Nano. It can handle a array of 8x8 leds without any extra resistors or transistors, the Arduino then uploads a 8 byte bitmask to turn the individual leds on. You can upload a new bitmask many times each second to make blinking leds.
It do not have individual brightness control only a global one, with a optimized transfer you might be able to do a few brightness levels with PWM (A single MAX7219 can be updated in less than 0.001second or 1ms).

Thanks HKJ-lygte! So can you point me to how I would wire this up?

The idea is to make a matrix, this could also be done directly from a Arduino, but the MAX7219 can deliver much more current, i.e. ma the leds brighter:

You can also get kits, the are designed for 8x8 led modules, but with a kit you do not have to mount it, but can instead connect wires to your own leds:

It needs a 3 wire connection to the Arduino, in addition to GND and power.

OK, start by getting - I suggest two or three - of these module kits:

I would be suggesting you assemble one with the matrix provided so you can test your "star" coding.

Then you assemble (wire) your LEDs in a matrix so they correspond to the module.

So you can use another module kit - not soldering in the header sockets for the matrix itself but soldering the wires from your own array instead.

Note that for 48 LEDs, you use only the first six "column" (cathode) drive lines and set the Scan-Limit in the MAX7219 to 5.

Using the MAX7219 means that at each step of your "twinkle" you just code to set five bytes with the pattern you want to show on the LEDs, and write those five bytes to the MAX7219.

(You can use the kit HKJ-lygte cites, but it is somewhat obsolete, this one is actually cheaper!)

Thank you all for the help!!

Paul__B,HKJ-lygte
After looking at this one important part I forgot to say is the lights will be placed on a 16 feet by 6 feet board. It would be a lot of work to wire this matrix up. Is there a way to use the leds, resistors, and transistors to achieve less wiring. I would still have 48 "+" wires and 48 ground wires.

I am not sure you will get less wiring do it any other way, but another solution is a IO expander (PCF8574).
Each device can handle 8 leds and you can chain 8 devices. Again 64 leds, but this time with 8 chips.
The PCF8574 works best pulling low, i.e. the LEDs is connected to 5V and a series resistor to a PCF8574 output pin.

Another chip is the PCA9685, it can handle 16 channels with PWM, i.e. variable brightness and 16 leds. It also is best at pulling low.

HKJ-lygte, ok, let me look into this. Might have more questions for you.

pfulda:
It would be a lot of work to wire this matrix up. Is there a way to use the leds, resistors, and transistors to achieve less wiring.

google for WS2811, WS2812 LED Strips. They come in different LED's per meter. Each LED adressable. Yes they come with RGB, but you can use just one color also :wink:

Thank you noiasca

They are very useful, but you have to be careful with the distance between each and you also need a decoupling capacitor for each LED. A RGB led is not white when you turn all leds on, but it do probably not matter here.
If they work at the distances required here (Distance is between each led, not the total), they may be the easiest solution.
You can get small circuit boards with one led a decoupling capacitor and solder pads. You can also get them in round versions (Search PL9823, APA106), but some Ebay sellers will just ship ordinary RGB leds instead!

Some other considerations when using the WS2811/WS2812b/etc LEDs is that to get a white color, you will actually be using three LEDs (red/green/blue), so the current requirements will be higher than for a single LED. At maximum brightness, with 20mA per LED, that will be 2.88 amps at 5 volts. Typically power and ground need to be fed into the LED wiring at multiple points to prevent voltage drops.

You can get an RGBW version, which has an additional white LED, but that is probably a bit too much for this project.

The LED strips would be fairly easy to use, they include the decoupling capacitor for each pixel, and are made so they can be cut apart between LEDs, with copper pads at the joint to solder wires to.

You mentioned having some of the lights blinking at different rates - what would the fastest rate of blinking be?

What about a string of WS2811 LEDs, the kind that look like bulky christmas lights, with the wire chopped and spliced where needed (so if some of the "stars" are close together, you wouldn't need to cut/splice)?

Making a wall-sized piece of electronic art is almost by definition going to include a lot of wiring >.>

pfulda:
After looking at this one important part I forgot to say is the lights will be placed on a 16 feet by 6 feet board. It would be a lot of work to wire this matrix up. Is there a way to use the LEDs, resistors, and transistors to achieve less wiring. I would still have 48 "+" wires and 48 ground wires.

And that is exactly why you want to wire it up as a matrix. For a 6 by 8 matrix, no more than 14 wires need to go to any part of the matrix and for example, seven wires to a group or area of twelve. Much less wire involved.

Using "NeoPixels" (WS2812) would be a lot more difficult due to the need to "chain" the data wire - always along with the 5 V and ground wire as they cannot be separated - from one LED to the next. You encounter the "shortest path" problem. As well as the need to ensure you do not lose too much voltage along the wiring to ensure colour consistency and purity. The only advantage would be the ability to control individual brightness,

pfulda:
I need a way to control a bunch of LEDs (48 or more) individually. Some LEDs will have different blinking rates, while others will be just on with various brightness.

Just curious, is each LED’s function fixed or, can it vary between blinking/pulsating/steady/on/off/etc?

dougp:
Just curious, is each LED's function fixed or, can it vary between blinking/pulsating/steady/on/off/etc?

That brings up an idea. If some of the LEDs will always be on at a fixed brightness, those can simply be wired with a series resistor, between the power supply and ground, and will not need any connection to the arduino. The brightness can be set by the value of the resistor.

Again missing the point.

Using a MAX7219 module and wiring as a matrix is the outright simplest approach to construction.

You just wire it all up, and whatever you need to do is performed in code, easily changed according to taste. No extra parts, resistors or otherwise.

Why make it more difficult? :astonished:

pfulda:
After looking at this one important part I forgot to say is the lights will be placed on a 16 feet by 6 feet board. It would be a lot of work to wire this matrix up.

can you make a drawing, how many LED's per row, how many rows, distance between LED's horizontally/vertically?

Do you have specific equirements regarding brightness of each dot? You know there are options from a small SMD LED up to big high current LEDs or even multiple LEDs at each position.

I bet there are a lot of options to reduce your manually wiring effort if you can describe your project in more detail.

noiasca:
I bet there are a lot of options to reduce your manually wiring effort if you can describe your project in more detail.

I am not sure there are that many options, until now we have covered:

Matrix (MAX7219): Probably the least amount of wires.
Each led individually (PCF8574): This is a very easy design.
Each led individually with brightness control (PCA9685): As above, but with brightness control and half the chips.
Smart leds: Requires more wires, but everything is very systematic and you get full brightness for RGB and maybe W of each led. But it requires fairly short wires between each led to work reliable (Get some "servo cable" to connect the leds).

The best result would be smart leds, next would be PCA9685 and "worst" would be PCF8574 or MAX7219.
Even the worst result would allow blinking stars, but variable brightness and colors would both improve it.
The disadvantage with the the more advanced solutions is the time it takes to get the "best" result, because there are so many more possibilities.

I have played a bit with PWM on MAX7219. It works, but there is too much flicker and a 1:4 PWM is not really enough for good effect.