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
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
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?
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).
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?)
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.
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.
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)
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...
Please note, my project is long from finished, I've just received my Arduino Mega yesterday and a bunch of piranha leds is on their way.
But I've already figured out most things in my head.
I'll use the mosfets that were recommended here ( still have to order them ) and an external PSU to power the whole project.
As for the resistor values, I'll wait another week to order those until the LEDs arrive and I can test the correct values to use. ( Because in my case I'll need around 600 of them, so I don't want to end up havig bought the wrong ones. )
If you've got any more questions or suggestions, by all means post 'em
Hmm it seems you know more about it than I do ( but then again, I'm just a novice in electromechanicals )
What exactly does the gate to source voltage do? Does it mean it needs a gate voltage of 20V to fully open/close (?) the circuit?
I never really wondered what it did, I suppose I was just going to wire it the way somebody would tell me to.
About the Arduino Mega, actually it's a Roboduino Mega (a fake yeah .. :p) but it was only 30 euro including shipping so I couldn't resist it