DIY LED lighting Guide 24

Posted by Matthew Sun, 26 Feb 2006 04:36:00 GMT

LED lighting is becoming increasingly popular in fish tanks, case mods, and even household lighting. This article intends to be a comprehensive guide to their advantages, powering them, and creating dimming solutions.

Ultra-bright LEDs

Why use LED lighting?

LED lights are extremely efficient compared to standard incandescent lighting. No other lighting source outputs as many lumens per watt. They are particularly efficient at producing a single color of light. Other light sources have to produce the entire spectrum and optically filter out unwanted colors. However, LEDs can be manufactured to produce only one wavelength of light. This makes them particularly useful in stop lights.

Another advantage to LEDs is their operating temperature. Most available today can be function for hours and remain cool to the touch. Directionality is another key property. They only emit light over a relatively small angle. This can be advantageous for reading lights, but hinders performance when attempting to light an entire room.

If the advantages of LED lighting interest you, Myths Busted, LED Lighting is an excellent article by a researcher in outdoor lighting solutions. (And the source of most my information.)

Powering your LEDs with a DC source

Warning: Driving your LEDs with too much current will permanently disable them.

If you attach LEDs directly to an unlimited power source, they naturally draw enough current to blow themselves out. Therefore, the driving current must be limited with a resistor. The relationship as described by Ohm’s Law, is V = I*R where V is the voltage over the resistor, I is the driving current, and R is the limiting resistor. Two example circuits are shown below. These particular LEDs are rated at 25mA and are powered by a 12 volt regulated supply.

LEDs in DC circuit

Each white LED gives a voltage drop of 3.6 volts. As an example for a 12 volt light, you can run a maximum of 3 white LEDs in series at full power (3.6 x 3 = 10.8 volts drop). Subtract this from your supply voltage of 12 volts to get the additional voltage that must be dropped (in this case, 12 - 10.8 = 1.2 volts of additional drop needed). In this case, 1.2 volts of additional drop / .025 amps (25 ma) = 48 ohms… resistors are rated in watts. So in this case, 1.2 volts x .025 amps = 0.03 watts. A 1/4 watt resistor would work fine.

The tutorial above also explains how to construct a 12 volt voltage regulator from any 12+ volt DC source. Voltage regulation is highly recommended because large shifts in your driving voltage can cause the driving current to increase and burn out your LEDs!

If you are in doubt of your calculations, use one of the many LED resistor calculators.

Using an AC source to drive LEDs

It is also possible to convert an AC source to DC. My favorite way to accomplish this is with a bridge rectifier as shown below. As an added bonus, R is easily calculated using the method above.

25 LEDs power by an AC source

In operation, a DC voltage of around 170 is produced from the bridge rectifier and 50uF capacitor. The capacitor value is not critical and can be anything from 20uF or more… To find the resistor value and wattage, multiply the number of LEDs by the individual LED voltage. Then subtract this number from 170 and divide the result by the desired current (usually 20 milliamps).

Dimming your LEDs (with PWM)

Using pulse width modulation (PWM) to dim your LEDs is extremely important! Simply decreasing the input voltage yields unreliable results and potentially reduces their life-span. Pulse width modulation basically pulses the source voltage on and off so quickly that your eye is unable to distinguish the difference.

PWM can be implemented using a variety of methods. The simplest is switching on/off the output of a microcontroller. There are also several circuits that implement PWM. My favorite method uses two comparators. The details are excruciatingly painful and may deserve their own article someday.

LED PWM modulator

The first example uses the standard op-amp oscillator circuit to generate a triangular waveform which is level-shifted and fed to a comparator (e.g. LM339) to give the PWM waveform.

Purchasing LEDs

LEDs are available all over the Internet. Recommending a single source or particular LEDs is hard as prices, projects, and the LEDs themselves may vary. If you are planning on starting an LED lighting project, it is best to do some research. For smaller applications, like a reading light, it may be more cost-effective to skip out on the top-of-the-line and buy a few more (relatively) cheaper LEDs. If you want to build a moonlight for your fish-tank, then you don’t need all those lumens blinding your fish!

Digg! this article…


Leave a response

  1. Avatar
    onlyocelot Mon, 27 Feb 2006 14:17:30 GMT

    Not to stand on tradition or anything, but if, in the first quote, the current through the ballast resistor is .3W (i.e., 1/3W) then a 1/4W resistor is too small. In standard sizes, you’d need a minimum of a 1/2W resistor.

    Editors Note: The information in the quote was incorrect. The current through the ballast resistor is in fact 0.03 Watt. In this case, a 1/4 Watt resistor will suffice.

    Additionally, it’s common practice to “derate” resistors, and although it’s not as necessary now as it used to be (50 years ago, a 1/2W resistor might or might not reliably operate when drawing 1/2W) it is still a sensible thing to do. Derating means to presume that the power rating is conservative, and specify a resistor that can handle from 2 to 10 times more current than the most you will put through it.

    Part of the reason for derating is so that a component (like a series resistor, the failure of which will disable the whole string) will not fail if more than rated current is applied for a short time. This is not a problem with LEDs: they don’t have an inductive inrush or kick, the current through them rises almost instantly to the ballasting resistor’s E/R value and stays there. Hence, under normal circumstances, the resistor will see (in the quoted case) 1/3W when the string is energized, and won’t be subjected to high-rate-of-change or out-of-spec current swings (barring induced currents from nearby motors, power lines, or nuclear blasts!)

    On the other hand, running some resistors ‘full bore’, ie, at or near rated power, can change their values over time, and if the value decreases, the current will increase, resulting in premature burn-out of the LEDs. Things get more complicated with AC-DC conversion, since now you have diodes that can fuse or break, resulting in waveforms that the simple RC filter might not remove, resulting in rate-of-change effects that heat up the ballast resistor more than straight DC might.

    To properly ballast a string of three LEDs, as in the first stated case, then, a 1W resistor is advisable.

    In any case, the addition of a series fuse, rated at the acceptable current plus about 5% is wise: if one of the LED’s gets shorted, its 3.6v drop will disappear, and instead of 1.2V across the 50ohm resistor, you’ll get 4.8v, effectively quadrupling the current, and burning out the other two LEDs. With a fuse rated at 30ma (yes, they do make them that small), a short will not damage anything but the fuse. In the second schematic, with the parallel strings of series resistor and LEDs, one fuse per string is more advisable than one higher-rating fuse for the entire lot. A fast-acting fuse is appropriate. In singles from Newark, for instance, a 30ma fast-blow fuse can cost from 50 cents to 1.50 each, which, when compared to three high-output white LEDs is currently a good bet. (When the price of high-output White LEDs gets down to 10cents a piece, then it makes sense to use the LEDs as the fuse 8^)

  2. Avatar
    Matthew Mon, 27 Feb 2006 14:34:21 GMT

    Thank you for the extremely relevant comments. Great recommendations!

    However, the quote incorrectly calculated the power dissipated in the resistor. The voltage over the resistor is only 1.2V, not 12V. Therefore, the power dissipated by the resistor is only 0.03 Watts. (I have updated the quote and notified the corresponding site.) A quarter Watt resistor will more than suffice in this case.

    P.S. Sorry the ajax comments take so long to post. I had to turn on spam bot checking which added a ton of lag. I think I need to make the waiting indicator more noticeable (or add a dialog).

  3. Avatar
    Kevin Mon, 27 Feb 2006 15:49:09 GMT

    Where can you buy Bi-directional LED’s? Not the two color LED’s but the one’s that can be used for sensor applications. Thanks

  4. Avatar
    skc Mon, 27 Feb 2006 16:32:53 GMT

    << No other lighting source outputs as many lumens per watt. >>

    Fluorescent tube are better.

    << a four foot “cool white” or “warm white” fluorescent tube uses 40 watts and produces about 3200 lumens of light >>

    LED: 35 lumens/watt Fluorescence: 80 lumens/watt

    << Another advantage to LEDs is their operating temperature. Most available today can be function for hours and remain cool to the touch. >>

    Temperature IS a problem with LED, today we can not increase LED light because of temperature. If temperature is too high, the LED get permanent damages. LED build to light are bigger and bigger, with dissipators to evacuat heat.

    << A Luxeon star is a LED emitter bonded to a small piece of circuit board material with an aluminium backing designed to dissipate heat. >>

  5. Avatar
    Drew Mon, 27 Feb 2006 20:05:45 GMT

    I would point out that using a resistor to ‘ballast’ led is not the best way. In the top schematic, the resistor is dissipating P=I^2*R watts which comes out to 0.03 W which is 10% of the 0.3 W used.

  6. Avatar
    Swingheim Mon, 27 Feb 2006 21:38:25 GMT

    I am a programmer by nature, and have only dabbled in electronics, so forgive my lack of understanding.

    An obvious question comes to mind: Why not run the LEDs in parallel, and not a series?

    I would want to build a “track” that I could plug in any number of LEDs to my liking, without having to worry about changing out resistors, etc.

  7. Avatar
    Matthew Mon, 27 Feb 2006 22:19:52 GMT

    Kevin: All LEDs are ‘bi-directional.’ I may write a tutorial on the physics of this in the near future.

    skc: Good point on flourescents. Changed my wording a little. Temperature in LEDs is definately a problem. However, I meant that LEDs do not run as hot as incandescent lighting. This is very desirable around small children, animals, or for a reading lamp.

    Drew: Although resistors are by far the simplest solution, this is a great point. I may follow up on alternate solutions someday.

  8. Avatar
    DaveG Tue, 28 Feb 2006 02:28:16 GMT

    Swingheim: because LEDs are not all created equal, and in a parallel situation the current will take the ‘path of least resistance’ causing one of the LEDs to probably burn out.. followed by the next .. followed by.. you get the picture? Now if you can get your hands on very similarly rated LEDs (ie: same manufacturing batch) then you can do it, but it’s not that easy still. The best way to actually do it is to run a few in series (call it a chain), with a resistor for ballast, and then have multiple ‘tracks’ of these chains connected in parallel. This seems to do the job.

  9. Avatar
    Frac Tue, 28 Feb 2006 02:29:06 GMT

    As LEDs are diodes, could you not use LEDs on AC without a rectifier? In your example, put three forward facing and three backwards facing. Three will be on when the other three are off (more or less - it’s a sine wave, so they’ll all be off as the wave crosses zero volts). In many applications, the 60hz flicker would be inconsiquential.

  10. Avatar
    DeadlyDad Tue, 28 Feb 2006 12:46:07 GMT

    Frac: While I don’t consider myself any sort of electronics expert, wouldn’t you have to have 25 one way and 25 the other, otherwise wouldn’t you have 12 or 13 receiving 120 volts on each half of the cycle? I’m also not too sure what effect having the voltage cycle from 0-3.6V and back sixty times a second would have on the LEDs’ lifespan.

  11. Avatar
    Frac Tue, 28 Feb 2006 15:08:40 GMT

    DeadlyDad - you’re right, of course. I just went and took a quick peek at the diagram and saw the three LEDs drawn. The concept still seems sound, though, correcting it for 25 x 2.

    The flicker would actually increase the LEDs lifespan. They don’t really have a heating cycle like a bulb. Most electronics “flicker” LEDs to conserve battery life and, in the case of multi character displays, only light one character at a time.

    I now also realize that the flicker of the whole set of LEDs would be at 120hz, since each half is lit on half the cycle.

    I also think you could probably get the over all brightness very close to or slightly brighter than having them all turned on at once. Since each LED is off for half a cycle, you could probably drive it to a higher voltage (a little past its rating). Since it get’s the rest period every half-cycle, it’s life would not be significantly reduced.

  12. Avatar
    Matthew Tue, 28 Feb 2006 15:39:56 GMT

    One of the links in the articles points you toward AC Line Powered LEDs. This section of the article describes exactly how to run one (or two) ‘flickering’ LEDs from an AC line.

  13. Avatar
    onlyocelot Tue, 28 Feb 2006 15:54:57 GMT

    Ooops. Shoulda done the math! blush

    Frac raises the question of using AC and putting diodes on facing in opposite directions:

    If the string is across 12Vac (not that hard to do with transformers), and consists of a resistor in series with two strings of LEDs, one with anodes to the left and the other with anodes to the right, then, indeed, each substring of diodes will be lit for a half-cycle. Each of the strings will flash on 60 times a second, but because the other excursion of the AC power signal lights the other string ‘in between’, the actual pulse rate (assuming all 6 LEDs are in the same area, pointed in the same direction) will be 120Hz. Essentially, this is an interleave system like TV, at twice that rate, so as long as motion isn’t involved, it will appear solidly lit (ie, there won’t be a perception of blinking at all.)

    Now, there will be some effects from the fact that it is AC instead of DC (ie, rate-of-change), but since the current integrates to less than 1/2*RMS voltage (i.e. .707v average/2) and the frequency seen by each diode is 60Hz, the total effect felt will be considerably less heat than with DC, so you should be able to expect much longer lifetimes. In short, you’ll get less light, but stress the diodes less than with straight DC applied. Plus, the off-half-cycle allows for cooling!

    In essence, you’re applying a half-wave rectified current to each LED, which starts to flow at just over the ‘diode drop’ voltage * 3 (i.e., if the diode drop is .6v (good for most silicon diodes), then you have to get 1.8v across the three diodes to start conduction: the resistor will be dropping a voltage equal to flowing current times its resistance, so the conduction starts at an applied voltage just above 1.8v with very little current, and rises as the voltage rises to peak.) Power comes from V*I, but with half-wave rectified V and I, it is considerably less than 1/2 of the power you’d get from a constant DC.

    Ideally, you could maximize the light output from such an arrangement by simply clipping the applied mains voltage at 12V with a pair of zeners (they’d have to be pretty hefty ones!). This approximates a square-wave with about 10% of the sine wave as the rise and fall times on each excursion. The benefits of this are that the rise and fall times wouldn’t cause much greater rate-of-change problems than the half-wave rectified voltages do, the LED’s would be turned as on as they get very soon after the polarity change, and thus putting out light for very nearly the entire half cycle, at which point, they’d go dark for a short time and the other string would light up.

    There are better ways of getting a nice 24v p-p square wave to apply than using the power mains directly, and much safer ones. However they are also going to require enough parts that you might as well just throw a real regulated DC supply at it, or get the PWM dimmer ability discussed later in the tutorial.

    As for Swingheim’s track idea, if the track were driven by a constant voltage supply, and you put a resistor in series with one side of each LED, a track arrangement could be made to work.

    Here’s the design process:

    If the LEDs are 25ma, like the ones above, and want 3.6 volts to operate, and the constant-voltage supply runs at 6V (a not-very-hard to find value for regulated DC), then the resistor would need to drop 6v-3.6v=1.4v. R=E/I, so the resistor would want to be 56ohms. 56ohms is actually one of the standard values, but if you don’t want to spend a fortune, you’ll probably get 5% or even 10% resistors, which means (for 5%) the value can be as high as 58.8 and as low as 53.2ohms. In a simple resistor-diode string across a well-regulated voltage, the resistance voltage will be determined tightly by the LED voltage drop, so E is a constant for the resistor at 1.4v and the current will vary between 1.4v/53.1ohms=26.32ma and 1.4v/58.8ohms=23.80ma. The lower current means a dimmer LED (although not by much, just 5%, really) but the higher current means breakdown will happen sooner from overheating. To be safe, you should go with the next higher standard resistance, 62ohms, which at 5% will vary by +/-3.1ohm. The current extremes will be about 23.8ma to about 21.5ma. At the lower end, you’ll get around 86% of the average for 56ohm resistors, and a reliable operation for the normal life of the LEDs. (And if it’s noticeably dim, just put another light on the track!)

    The resistor’s power dissipation won’t be significantly different from the given DC example above, so it’ll be around 32mw, around 1/30thW. 1/8W resistors are perfectly fine for that power level. Just cut one LED leg to 1/8th”, cut one resistor lead to 1/8”, solder them together side-by-side, and use the other resistor leg and diode leg as the ‘hangers’ on the track!

    If you can get a good 4.5v supply, the resistor voltage will be lower (on the order of .9v), so the resistance can be lower (next standard size up from 36, which is 39ohms)and the current will average maybe a milliamp more, meaning more light from each LED.

    NOTE 1: Wall warts are notorious for giving their rated voltage under significant load, so a) going with a higher resistor value might make using wall warts safer and b) using wall warts isn’t really safe for this application, anyway. Either throw away the power needed to load the wall wart into good regulation when no LEDs are bridging it, or get/make a real power supply!

    NOTE 2: I didn’t mention it above, but if you have a well-calibrated ohmmeter, you may think you can just measure a bunch of 5% or 10% resistors at the 36 or 56ohm standard value, and only use the ones that are exactly right, but beware of the meter’s limitations. Analog meters are usually 5% full scale accuracy at best, so even if you’ve had it calibrated to a mark at 56.0000 ohms, the next time you read 56ohms, it may read anything from 52 to 60! Digital meters can be more accurate, but they still have electronics made up of 5% parts… so be conservative!

  14. Avatar
    Matthew Tue, 28 Feb 2006 16:51:15 GMT

    I just wanted to thank everyone for the wonderful comments again!

    Don’t worry about missing the math! I had already done the math and knew the offending quote was incorrect. Yet I failed to edit it out…

  15. Avatar
    mervyn Wed, 01 Mar 2006 09:54:36 GMT

    hi .. any one know how many volt battery need to light up luxeon led?? and what is the minimum volt and resistor need to light up 3 pcs luxeon V led in series with battery???


  16. Avatar
    onlyocelot Wed, 01 Mar 2006 15:05:05 GMT

    mervyn asks about specifics for driving ‘a’ luxeon led. There’s a bunch of different luxeon LED’s, and all sorts of free information about them in PDF’s at

    There are so many different configurations and individual emitters that it’s hard to generalize. However, in the sample led circuits, clicking on the resistor generally takes you to:

    which asks for how much battery voltage you are supplying, how much voltage wants to be dropped across the LED (from the data sheets) and what the operating current of the LED is. It gives back calculated values for standard resistance and wattage, actual resistance and wattage, and tells what the actual current that will flow in the LED and its power dissipation. Very helpful.

    You can get the answer to your questions by choosing which Luxeon LED emitter (or star or array) you want to use, mining the datasheet for the appropriate information as above, choosing the driving schematic you want to follow and calculating using their calculator. The rest is easy 8^)

  17. Avatar
    Tim Buchheim Thu, 02 Mar 2006 21:16:33 GMT

    You can indeed have two strands of oppositely-pointing LEDs in parallel connected to an AC voltage source. I have some LED Christmas lights (made by Phillips) which are constructed this way. (Had I known in advance that they were built this way, I probably wouldn’t have bought them.)

    The flicker is a bit annoying, though. (It’s fine at a distance .. such as on your roof. But for indoor use it can be annoying if you’re sensitive to flicker. (It’s not quite as annoying as a CRT with a 60 Hz refresh rate, but it’s still pretty annoying.)

    I imagine the flicker would be quite a bit worse for those in Europe who have 50 Hz AC.

  18. Avatar
    njh Tue, 28 Mar 2006 22:34:00 GMT

    Could you use a normal light dimmer with the mains powered circuit to dimmer the LEDs? (I have neither the LEDs nor the dimmer to try it, but the only objection I can see is that the tail of the cycle may not provide enough voltage to light the leds.)

    A capacitor before the bridge rectifier would have the same effect as the resistor, but not waste any (much) power.

    There are plenty of circuits floating around to deliver constant current using a transistor or two, which might work better with the standard dimmer.

  19. Avatar
    homemade power Mon, 26 Jun 2006 14:35:32 GMT

    Really detailed info Thanks. My experience - LED’s are great put only for certain purposes. Most people make the mistake of trying to light a room with them which they are always unhappy with.

  20. Avatar
    jo Mon, 17 Jul 2006 14:52:55 GMT

    can you suggest an electonic diagram for pulser which I can control the time and the hight (voltage) of the pulse to operate several LED lines jo

  21. Avatar
    Hogan Thu, 26 Oct 2006 10:36:19 GMT

    What a fascinating read this is. My electronics knowledge is limited but nevertheless I have got the gist of this. The use of opposed polarity LED strings is particularly interesting. Does anyone have any ideas for employing this technique for bicycle lighting using a hub generator? The one I have in mind produces 6vAC at 3w.

  22. Avatar
    J Sun, 05 Nov 2006 18:35:33 GMT

    If a resistor is dissipating 1/4W, it can it supply 1/4W to the load?

  23. Avatar
    FryGuy Sun, 25 Feb 2007 05:25:22 GMT

    Resistor power dissipation is just that. Its is the power the resistor has to get rid of for the given current flowing threw it. So depending on the resistors value and the current flow, determines the resistor wattage you need.

    Basically the lower the resistance the lower the wattage of the resistor can be for a given current. The resistor is acting as more of a conductor then a load so it don’t need to get rid of power (P= V x I).

  24. Avatar
    Chadd Fri, 23 Mar 2007 05:39:35 GMT

    If you are looking for PWM LED circuit, I would suggest using a micro controller, such as the PIC16505. This will allow you to control your pulse width and duty cycle as needed. I have seen one company who works with the PIC Micro ( ), but if you have training in electronics technology you might be able to implement a simple PIC circuit on your own!

  25. table layout Mon, 28 Apr 2008 09:22:23 GMT

    Ah, that happy morning ritually shrank over some closed matter. A action is forthrightly flying. Surprisingly, a woman is much less emotional than some ultimate year. It’s surprised to be smooched! This fortunate street repaid against some straightforward web bingo. I learned that mother in this lot. The project has this giant bingo. A fair cost floated between some organisational internet bingo sites. Some service has the preferred bingo sites…