Go Down

Topic: Big LED Ambient System (Read 4979 times) previous topic - next topic


Oct 12, 2009, 09:43 pm Last Edit: Oct 12, 2009, 09:44 pm by Youran Reason: 1
Hello everyone,

After admiring arduino board projects for years, I've finally made the jump to get started myself. I was hoping to build a series of LED bars to put up all around my room and be able to control them with the computer (changing color, cycle through a color range with fade effects, synchronize my music to the blinking of the LEDS, using Boblight to imitate the Philips Ambilight, ..). Similar to this project: http://www.instructables.com/id/LED-RGB-controller/

Now, what's bugging me is that I don't really know if this is possible with an arduino board? (I was thinking of the Duemilanove)

Will I be able to power +- 200 RGB leds using an external power supply or is this impossible?

PS 1: I don't really need to control each and every bar on its own, but I'd like to have 2 groups that I can control independently.
PS 2: Any recommendations on which leds I need to buy? I was thinking of 5mm RGB piranha's (aka superflux) common anode. (I heard common anode was better, can anyone verify this?)
PS 3: Can I wire my leds in a combination of parallel and series? http://ledcalc.com/ show exactly what I mean (try inserting some values in the boxes, make sure The Guru is selected). I'm asking this because wiring them like that consumes far less power.

I know these are a lot of questions at once, but I'm having this project in my head for quite a while now, and I know exactly what I want :)

Thanks in advance,


Oct 13, 2009, 04:09 am Last Edit: Oct 13, 2009, 04:13 am by ajb Reason: 1
1: Two RGB groups fit perfectly within the Duemilanove's 6 hardware PWM pins, so you're good to go there.
2: Depending on how much you want to spend versus how much work you want to do in wiring/mounting, you can find pre-build RGB LED units at places like dealextreme, allelectronics, etc.  I've got some of these on my desk right now that work alright.  Or you can build up your own out of discrete R, G, & B LEDs (though you will need to choose exact wavelengths carefully if you want an optimal gamut) or RGB LEDs.  The disadvantage with single-device RGB LEDs is that you can't wire them in series, so you need to use a lower supply voltage and many more current limiting resistors which makes the whole assembly drastically less efficient.

3: If you use discrete R, G, and B, you will want to wire them in series strings to match your supply voltage.  Higher voltages make for more efficient arrays (more LEDs in wach series string means fewer current limiting resistors), and means less current for you to control.  If you buy premade RGB assemblies, go by whatever voltage they're spec'ed for.

Common anode assemblies are preferable because you can tie the anode to a higher voltage supply and use a logic-level N-channel MOSFET (like an IRF510) with the gate wired directly to an Arduino PWM pin to control the cathode.  This is much easier than trying to use a MOSFET at the anode.

You can control as many LEDs as you want!  Of course you will need a supply that is suitably sized, and suitable switching devices.  12V supplies are readily available, look for one that is rated for at least as much current as your entire LED array will draw when all colors are at full blast.


Thanks a lot for the quick reply, I'm glad it's possible and can't wait to begin :)

I intend to use RGB leds (one physical led) and will probably solder them myself, as I want it to be fully custom :D

I still had a few questions regarding the wiring of the LEDs:
Do I need 3 resistors for each LED? And how do I wire them up? Connect all the anodes in series/parallel? And what about the anodes?
Do you think the combination of series and parallel to reduce power consumption would work?

I'm used to working with regular LEDs, so this is kind of new for me :)

Another thing about the MOSFET: Do I need one for each color? and how would I go about connecting this? You don't happen to have a simple schematic lying around? ::)

About the power supply, I'll probably be using an old computer PSU. Should I use the 12V or 5V rail (as you said I needed a lower supply voltage?)

Can this system be used even when the computer is turned off? With a simple push button or something or does really need the computer output?

Another thing I noticed when I was looking at an Arduino tutorial, they had to load the code to the chip every time and this took a few seconds. If I would click another color on my screen, would the LEDs adjust instantaneously or does it take a few seconds?

A lot of questions again, I know :D

Really appreciate your effort !


Yes, you need three resistors per RGB LED.  Or use a constant current chip.  This latter choice is preferable since it stops burnouts if one LED shorts, and also makes color intensity matching easier.

You'd hook the anode to the positive, and then each cathode line (R, G and B) to a separate resistor and then to the Arduino.  You can hook a couple of these up in parallel (the anodes together) and the all the R's together, G's together, etc.  Of course, you can't exceed the amount of current you can sink.  

You can't hook the RGB LEDs up in series... to do that you'd need separate R, G and B LEDs.

With a constant current chip like M5451 (allows 35 separate control lines), you leave out the resistor.  

WRT the power, use the 5v rail, because you can't hook the LEDs up in series and they take less then 5v to turn on.

Yes, the Arduino can be used when the computer is off.  It will run thru the sketch you last uploaded.  Every time you change the sketch you have to upload new code.  That takes time.  So don't change the sketch.  Instead use the Serial library to get data from the computer.


I like the idea of the constant current chip, but after some research I found out that it's extremely hard to get here in Belgium. I've also noticed that it allows you to control 35 separate control lines, but to drive +- 200 LEDs, a total of 6 chips would be needed? Does my Arduino have enough ports to control all of them?

Regarding the other option, using a logic-level N-channel MOSFET: I would wire it to the PWM port of the Arduino and the all of the cathodes of the LEDS (one color), but what is connected to the third leg?


Regarding the other option, using a logic-level N-channel MOSFET: I would wire it to the PWM port of the Arduino and the all of the cathodes of the LEDS (one color), but what is connected to the third leg?
The negative supply (ground).  Basically, the MOSFET is a switch, with a voltage at the gate, current can flow between the source and the drain.  In your particular case, during the high portion of the PWM signal current will be allowed to flow between the negative supply and the cathodes of your LEDs.  

Since MOSFETs are voltage controlled devices, you will want to put a pulldown resistor at each gate, otherwise when the Arduino is off or executing the bootloader the gate can float high enough to turn on (since all of the IO pins are in high-impedance state at that point).


Oct 16, 2009, 08:47 pm Last Edit: Oct 16, 2009, 09:24 pm by Youran Reason: 1
Got it now : )
Is there anything else I need besides 6 MOSFETS, my RGB LEDs and matching resistors (do I calculate this value like I would with a normal LED?), Arduino board, power supply and 6 pulldown resistors (what value would you recommend?)

Do you think a +- 300W PC PSU can handle this amount of current on its 5V rail? Or should I go for the 12V instead? I'm kind of worried because I thought it didn't have that much power on the 5V rail. (and which would be the most power friendly?)


Oct 16, 2009, 10:45 pm Last Edit: Oct 16, 2009, 10:46 pm by ajb Reason: 1
Nope, that's all you need.  

Whether or not your PC PSU can handle it depends on how many LEDs you're using and the PSU itself.  Figure at least 20mA per junction so at least 60mA per RGB LED--although you may be able to drive them at higher current; check the datasheet--times however many LEDs you plan to use.

You definitely want to use a 5V supply; a 12V supply will have you dumping an additional 7W straight to heat via the current limiting resistors for every amp your LEDs consume.  So if you have 100 RGB LEDs at 20mA per color, you'll be drawing 6A.  At a 5V supply that's 30W, with say (3.4+3.4+2)V * 20mA * 100 LEDs = 17.6W consumed by the LEDs, and 12.4W by the current limiting resistors.  At a 12V supply, LED current is the same (6A), so you'll be consuming 72W.  The LEDs are still only using 17.6W of that, so the current limiting resistors eat up the remaining 54.4W.  

Check the specs of the PSU you want to use.  Newer models have shifted more of their capacity to the 12V line since newer motherboards and video cards have shifted to deriving their low voltage/high current power from the 12V bus via switching converters rather than the 5V or 3.3V lines.  If you're hoping to piggy back onto your computer's PSU, you'll also have to figure how much of its capacity you're currently using.  The quality of the PSU also becomes important, since lower quality units will get flaky when loaded near their ratings.  

I'd recommend getting a separate 5V supply for any sizable array, though.  You can find switching supplies in a variety of form factors and capacities at decent prices at most electronic surplus sites.  This also gives you the added ability of easily divorcing the lighting system from the PC if you choose to do so at any point.



I've sent my boards to the UK, Canada, etc... I don't see why Belgium would be an issue.  Here's a link my blog about the new board http://effluviaofascatteredmind.blogspot.com/2009/10/lightuino-design-thoughts.html.  

These boards let you control 70 current sinks separately.... But you can always hook more than one LED up in series to the same current sink!  The chip takes 13volts maximum so you can do maybe 4 to 6 in series (depending on the voltage of the LED) without any other parts.  But if you put an NPN or N-channel MOSFET transistor between the current sink chip and the LEDs then the transistor will protect the chip from higher voltages so you can essentially put however many LEDs as you have voltage for in series (of course the transistor has to be able to handle the voltage).

But if you really just want all LEDs on or all off then the MOSFET + resistor is the simpler solution.

In terms of wattage, its best to try to use a combination of LEDs in series and parallel to consume as much of your voltage as possible (because as ajb said, what is left over is just dissipated in the resistor as heat).  For example, if you have an LED that uses 3 volts, then if you use a 5volt supply you would put the LEDs in parallel and the resistor would consume 2 volts; so 2/5 of your power is going into heat (at least -- the LED also generates heat).

But in that case, if you used 4 LEDs in series, that would sum to exactly 12volts, so in theory you would not need any resistor, and not lose any power in the resistor.  But of course, the LEDs aren't perfect so in practice you'd probably burn them out... instead in this case you'd need to drive them at slightly less than 3v and put some small value resistor in there so that the circuit has a linear (v=IR) component

This example was totally fabricated to show how using the 12 volt rail might be better than the 5 volt... in practice you'll need to see what voltage your LEDs dissipate (and it varies by color).

Also I think that computer power supplies generate -12 volts as well, so you could conceivably get a 24v out of it.


Oct 17, 2009, 11:07 am Last Edit: Oct 17, 2009, 02:41 pm by Youran Reason: 1
Thanks for the suggestion, but I'm afraid it's not really what I'm looking for. I'm going to put LED bars all around my room, and having to run 70+ wires all over the place would be kind of messy : )
You also suggested to wire them in series, you're talking about regular LEDs right? I thought RGB's were impossible to wire this way.

What about a voltage regulator? If I were to convert the +5V from the PSU to about 3.5 and use that to power all the LEDs? Or would the voltage regulator dissipate a HUGE amount of heat then?
EDIT: just found out a PSU also has a 3.3V rail, isn't this exactly what I need?


3.3V is probably a bit low for the green and blue dies in the RGB LEDs.  

But a 4V supply can be more efficient IF you use a native 4V adapter or use a switching DC-DC converter to derive it.  Linear regulators, however, dissipate excess power as heat and won't be any more efficient.  So using an LM317 to step your 5V supply down to 4V before feeding to the LEDs, for example, isn't any more efficient than simply using larger current limiting resistors.  In fact with a large array of LEDs you will quickly exceed the current and power dissipation ratings of the regulator, and you'll be concentrating power dissipation in the regulator as opposed to having it distributed though all of the current limiting resistors.  So if you can find a suitably sized 4V switching power supply, go for that, otherwise just stick with a 5V supply since those are so readily available.  

You actually could wire the RGB LEDs in series pairs with a common anode device at the top and a common cathode device at the bottom and switch each color in the middle, but then you'd need a ~7.5V supply which isn't terribly common, and you'll still need 3 resistors per RGB LED.  Really, discrete R, G, and B LEDs are the way to go if you're concerned about efficiency.


I get it now :)
But I'll stick to the RGB LEDs. I've seen some videos of discrete RGB LEDs and didn't quite like the color output, you could actually see that the color was made by more than one LED.

Regarding the resistors, the guy on eBay states that the forward voltage for all three colors is 3.2V. I'm not quite sure if this is correct, and after some research I found another guy who sells them, saying forward voltages are: RGB 2.0/3.2/3.2 ..
Can anyone shed some light on this? I thought both red and green were 2.0?

The resistors I would use when using 2.0/2.0/3.2
180 ohm for red and green (16.7 mA)
100 ohm for blue (18 mA)

Are those good to go?


When you get them, just test them, it'll be more reliable than "some guy on ebay"  ;D


Also you might be a bit disappointed by the color "mixing" with RGB leds.  They really are just 3 leds in one package and in most cases you can very much see distinct red, green and blue circles if you turn them all on and shine the result on the ceiling.  But don't worry, this is easy to fix with a diffuser -- trivially a piece of white paper will do the trick, but there are better choices...


hmm, you've got me convinced :p
I'll buy some from both and see how it goes
I'll keep you posted :)

Go Up