How to make LEDs light up

If you're looking to make your own night cam, you'll need an infrared illuminator. You can buy them ready made, but they're hideously expensive and generally designed for wide areas - i.e. they will be too bright to use to illuminate a nocturnal animal at close range. So, I make my own. This page explains the methods I use to do that. You can, of course, use these identical methods to make a visible light illuminator. Now that white LEDs are available, it might be a fun thing to have around!

Radio Shack and Digi-Key are good sources for the parts and tools that are needed (or at least nice to have - that's up to you to decide), which are:

And now on to the mind-numbing detail. I suggest you read it all before beginning, in order to reduce the risk of letting the magic smoke out of your LEDs... ;)
  1. Electricity Basics

    Here are some basic electronics terms and concepts that will come in handy for this project:

    Note: You'll hear lots of people use water as an allegory for electricity. There are enough similarities to make the comparison useful at times, but don't expect perfection. In reality, the behavior of water and electricity are quite different.

     

  2. Power Supply

    There are two power supply specifications that you care about: Voltage and Current.

    I feel that the ideal power supply is 12VDC (VDC="Volts Direct Current"). It is relatively safe and commonly available via "wall wart" power supplies. (You know, those annoying brick supplies that take up two or three outlets on a power strip?)

    The current rating of the power supply must be sufficient to handle your entire illuminator. I've never seen a power supply so wimpy that it couldn't supply enough current for a project like this, but if you're attaching multiple illuminators to a single supply or are building your illuminator from some beastly super-bright LEDs and have a particularly small power supply, you could run into trouble. It wouldn't hurt to check.

    You can generally find out what you need to know by looking at the label of the supply for a rating in Amperes (A) or Milliamperes (mA); 1500mA (which is the same as 1.5A) is great, and 500mA (0.5A) is sufficient for most projects of this nature. Anything smaller could be trouble - double check your calculations!

    Warning: If the total current drawn by all of the items attached to the supply exceeds the rating of the power supply, the supply may fail or even catch fire.

    Later, I'll bore you beyond tears with more about current.

    I like 12VDC, but anything that exceeds the voltage rating of the LED can be made to work. I've plugged LEDs directly into 117VAC wall sockets (with the appropriate resistor) and they work fine. Don't try this at home! Just because I do stupid things doesn't mean you should, too. If you burn your house down or shock yourself, don't say I didn't warn you, because I'm warning you right now: Don't play chicken with electricity!! If you have enough doubts about your knowledge of electricity that you need any help at all (e.g. from this document), then you really should stick to low voltage. If you insist on trying a power supply higher than 24V, email me so we can discuss safety precautions! Also note that the calculations I describe below don't work exactly the same way for AC power supplies. I assume that you'll use DC.

    If you are using batteries, their rating in Milliamp Hours (mAh) will allow you to calculate how long they will run your device before needing to be replaced. A 1000mAh battery will run a 10mA illuminator for 100 hours.

    Like plug-in power supplies, each type of battery has a maximum amount of current that it can supply. Unless you are using extremely small batteries or making large illuminators, you won't need to worry about this, since LEDs require so little current. Your primary limiting factors will be voltage and runtime.

    Caution: Some batteries, like the Lead-Acid batteries used in cars, can supply hundreds of amperes - enough power to spot-weld metal tools or cause sparks or flame in the blink of an eye when connected improperly. Lead-Acid batteries contain (surprise, surprise) sulfuric acid which can leak if the battery is damaged or tipped, and they can contain and emit highly explosive gases (a combination of hydrogen and oxygen) even when stored properly. Together, these characteristics can result in an explosion promptly followed by a shower of sulfuric acid. This sort of event usually ends up harshing one's mellow, so to speak. ...If you didn't already know all of that, then I'd suggest more study before messing with large batteries.

    Two more things to be aware of:
    1. If you have a wall wart, then there might not be any clear marking of the "+" and "-" terminals - especially if you've already clipped the connector off and tossed it. ;) If this is the case, check the wire that leads out of the brick. The "-" wire is often marked with a ridge or a groove along the length of the jacket. Other times, it's some sort of painted on mark. You can also use a multimeter to figure this out. If none of this helps, then don't worry about it. For this particular project, you don't really need to know.
    2. Inexpensive power supplies often put out more voltage when little or no load is placed on them. In such cases, the voltage rating printed on the device will be correct only at or near the current (Amperage) load that the original device demands. If your inexpensive power supply came with a device that draws a lot of power and you attach an LED illuminator to it (i.e. very low power demand), the supply could put out quite a bit more voltage than its label says it does. This will throw your calculations off, which may result in damage to your circuit. Choose one of the following solutions:
      1. (Not so great...) When doing your calculations for the current limiting resistor (explained below), assume that the power supply puts out 15-30% more voltage than it says it does.
      2. (Better...) Use only power supplies with a guaranteed constant voltage. Look for "regulated" or "switching" power supplies. Some switching power supplies (such as those from many computers) shut themselves down when the power demand is too small, making them unsuitable for LED illuminators.
      3. (Best...) Use a multimeter to measure the no-load voltage of the power supply

     
  3. Connecting the LEDs

    To get enough light for your Infrared camera, you're going to need more than one LED in your illuminator. (I have several illuminators totalling 30 LEDs in mine.) While it is possible to build an army of single-LED illuminators, those of you who are not gluttons for punishment will want to build a small number illuminators, each with multiple LEDs. I highly recommend wiring the LEDs in series (end-to-end, like christmas tree lights) rather than in parallel (all LEDs attached directly to the power supply.) There are reasons for this that I will not bore you with. Just trust me.

    LEDs are, of course, polarized. Polarized means that electricity can flow through them only in one particular direction. In other words, one leg of the LED (called the cathode) must be attached to the "-" terminal of your power supply, and the other leg (called the anode) to the "+" terminal. If you plug them in backwards, they will not work.

    ...They don't work when plugged in backwards, but (in my experience) they are not damaged by it. This means that when you go to plug it in, you can use trial and error to figure out what the polarity should be.

    So, you don't really need to know which leg is the anode and which is the cathode, as long as you can make sure that the two legs you're soldering together are different. When wiring LEDs in series, the cathode of one LED must always be attached to the anode of the next LED. As long as you can determine that you are joining one of each, you don't need to know which is which. Anode-to-anode or cathode-to-cathode leads to eternal darkness. (Okay, not quite "eternal." You just have to fix the wiring.)

    If data sheets for your LEDs are unavailable, study your LEDs for physical features that will allow you to wire them anode-to-cathode every time. Most PC mount LEDs (i.e. with wires sticking out of them, rather than just small metallic pads) have one wire slightly longer than the other to mark the anode. (Or is it the cathode? I forget.) Round LEDs often have a flat spot on one side near the base. Other LEDs have other lumps, dents, grooves, or other marks that allow you to tell one terminal from the other. If that fails, hold the LEDs up to a light and look at the guts - one wire is attached to a thing that looks like a little bowl, and the other side to a little wedge tucked under the bowl.

    Again, as long as you can establish any sort of consistent orientation for your LEDs ("long/short", "wedge/bowl" - it doesn't matter), you don't need to know which is the anode and which is the cathode. As long as you don't hook two "longs" or two "bowls" together, you'll be okay. When you're completely done with your illuminator, plug it in one way. If it doesn't light, unplug it and reverse the wires.

    But, before you plug it in, make sure you have the correct...

  4. Current Limiting Resistor

    A current limiting resistor is always required to prevent damage to the LEDs when power is applied. (Actually, "damage" is the wrong word. What I really mean is "guaranteed instantaneous annihilation.")

    The current limiting resistor is connected in series with the LEDs. It can be placed anywhere in the chain of LEDs. As long as there is no path from the power supply's "+" to "-" that skips any of the LEDs or the resistor, it's okay. The order is unimportant.

    To select a current limiting resistor, follow these steps:
     
    1. Determine the appropriate Current (Amperage) for your LEDs

      Current refers to the amount of electricity flowing through an electrical device. It is is measured in units called Amperes (often labeled 'A'). In the case of LEDs, the allowable current is so small that Milliamperes (labeled 'mA') are used. One mA is one one-thousandth of an Ampere.

      Each LED is rated by its manufacturer for current. Two common ratings (the precise wording may vary) are "operating current," which is the suggested current for the device, and the "continuous maximum forward current," which is the the maximum current it can handle without being destroyed. The package/datasheet for the LEDs should have one or both of these ratings listed on it.

      The current that passes through one item in a chain passes through all items in the chain - a little like the water passing under multiple bridges over the same river. So, the current rating for a single LED (you should make them all be the same) is the current rating for the entire chain. (Note that this paragraph applies to LEDs - it is not a universal truth. The rules vary depending on the type of devices you're chaining together. For example, when chaining regular incandescent bulbs together, the current consumption of all of the individual bulbs must be added together to find the total current consumed by the circuit.)

      Note that these datasheets will typically also contain a voltage rating. It has been my experience that current ratings must be taken seriously, but (when building LED illuminators) voltage ratings can be ignored. Your mileage may vary. (i.e. Unless you do EXACTLY the same thing that I did with EXACTLY the same parts, I can't promise that it won't catch fire when you try it. ...So be careful!)

      If no datasheet is available, I suggest experimenting with the LEDs one at a time using different current levels starting with 5mA (0.005A) for small LEDs and 10mA (0.01A) for large LEDs. (After finishing this document, I hope you will know how...) These values will give non-disastrous results for a large majority of PC mount LEDs. Note that I said "large majority," not "all." Some LEDs will be destroyed if subjected to these levels of current (because it's too much), and others will light very dimly or not at all (because it's too little). Unfortunately, it's often difficult to tell the difference between these two even after it happens. Still, if you don't have a data sheet, you will need to experiment with different current levels to achieve appropriate brightness. Expect to kill some LEDs in the process.

      If the recommended "operating current" of the LED is known, you should choose that value in this step. (And subsequently design your circuit to supply exactly that.) If only a "maximum" is stated, I suggest picking a value that is approximately 85% of that value.

      The more current you put through an LED, the brighter it will be - until you fry it. However, it has been my experience that (for most LEDs) you get very little additional brightness in the range between the recommended current and the breaking point. Your illuminator will last longer if you treat it reasonably. (i.e. use the lowest current and lowest voltage that will get the job done.)
       
    2. Calculate the Voltage Drop for your entire illuminator

      Each LED gobbles up a little juice as it passes by. This is referred to as "voltage drop." Generally, the data sheet for your LED will specify what its voltage drop is. Otherwise, a good guess is 0.7 volts per LED. If the total of the voltage drops of all of the LEDs in a particular chain exceeds the voltage of the power supply, that chain will fail to light. For example, assuming a voltage drop of 0.7 volts and a 12 volt supply, the maximum number of LEDs that can be chained is 17 - i.e. a total voltage drop of 11.9 volts. Note that sometimes both power supplies and LEDs are manufactured imprecisely, so it's a good idea to leave a little slack. 14 or 15 LEDs would probably be better. You should allow even more slop if you're guessing at the voltage drop and/or using inexpensive parts.

      Additional LEDs can be supported by placing more than one chain in parallel (side by side) on the same power supply - but keep in mind that this increases the total current load on the supply. In other words, LEDs attached end-to-end require additional voltage and LEDs attached side-by-side consume additional current. You can do both, but then you need both.

      To determine the voltage drop for the chain, count the LEDs and multiply by the voltage drop for one of them. This is the total voltage drop for the entire chain. If this value exceeds the voltage your power supply puts out, you will need to break the chain up. Each chain should be totally separate from the others - in particular, each should have its own current limiting resistor.

      If you have different types of LEDs, it's a good idea to build multiple illuminators so that a single illuminator has only one type of LED in it.

      Note that this voltage discussion, like the current discussion above, applies to LEDs, and may not work for other types of devices.
       
    3. Calculate the value of the Current Limiting Resistor

      We will use one or more resistors to regulate the current that flows through the illuminator. Resistors are rated in units called ohms. Lots of ohms, lots of resistance, and therefore less current (fewer mA). Fewer ohms, less resistance, and therefore more current (more mA).

      If you have resistors and don't know how many ohms they are, type resistor color codes into a search engine, and you should have no trouble finding a page that will explain how to read the color bands.

      Important: to keep costs down, resistors are typically manufactured to fairly sloppy tolerances - sometimes varying by as much as 10% from their marked values. This means that if you design your illuminator to run at 99% of maximum current, your resistors could be off by as much as 10%, and poof! At 109% of maximum current, you have destroyed at least one of your LEDs and achieved eternal darkness.

      To calculate the proper value for the resistor, we use Ohm's law, which describes the relationships between Voltage in volts (V), Current in Amperes (I) and Resistance in Ohms (R). When two of these values are known, Ohm's law can be used to calcluate the third, and so the law is expressed in three ways:
       
      1. V = I x R
      2. I = V / R
      3. R = V / I

      For our calculations, V (voltage) is the rating of the power supply, minus the total voltage drop (calculated above). You also know I (current) because you decided it above. We therefore use the third form, R=V/I, to calculate the only unknown, R (resistance).

      If your power supply is 12 volts, you have three LEDs with a drop of 0.9 volts and want to run 50mA (0.05 Amperes) through the illuminator...
       
      a.R = V / I
      b.R = (12V - 3*0.9V) / 0.05A Insert known values
      c.R = 9.3V / 0.05A Crunch Dem Numbers! 12-(3*0.9)=9.3
      d.186 ohms = 9.3V / 0.05A Ta-daaaa!

      If you don't have a 186 ohm resistor (trust me: you don't), you might want to calculate the current that will flow if you use the resistor you have handy. Say we had only a 200 ohm resistor available. We'd use the second form of the law to calculate the current...
       
      a.I = V / R
      b.I = (12V - 3*0.9) / 200 ohms Insert known values
      c.0.0465 A = 9.3V / 200 ohms More Crunchin'!
      d.46.5 mA = 9.3V / 200 ohms Convert A to mA, and... Ta-daaaa!

      Now that the current is known, you can decide whether or not that 200 ohm resistor is good enough. (46.5 mA looks OK to me!)

      By the way, multiple resistors can be combined to form different values:
       
      • To make bigger (higher ohm) resistors out of small resistors, connect them in series. The new value is the sum of the original values. (e.g. two 100 ohm resistors end to end form a 200 ohm resistor)
         
      • To make a smaller resistor out of big resistors, connect them in parallel. The new value can be determined by calculating the reciprocal of the sum of the reciprocals of the individual values:
        
              1         1      1      1          1
           ------  =  ---- + ---- + ---- + ... ----
           Rtotal      R1     R2     R3         Rn
        
      • If you're connecting identical resistors in parallel, there's a shortcut: The new value is one of the individual values divided by the number of resistors. (e.g. two 100 ohm resistors side by side form a 50 ohm resistor, and three 100 ohm resistors side by side form a 33 ohm resistor.)

        Resistors are not polarized, so there are no anodes and cathodes to worry about.
       

      Ohm's Law calculators

      Vs=Supply Voltage
      N=Number of LEDs
      Vd=Voltage Drop per LED
      R=Resistance in Ohms
      I=Current in Milliamperes

      Calculate Resistance
      Given the specifications of your power supply and LEDs, calculate the value of the resistor you need:
      ( Vs: - ( N: * Vd: )) / I: = R:
      Calculate Current
      Given the specifications of the parts you actually have, calculate the current that will flow through your LEDs.
      ( Vs: - ( N: * Vd: )) / R: = I:
       

       
       
  5. Summary
     
  6. Other suggestions:

Email me if you have questions. I reserve the right to quiz you on this document before I attempt to answer them. ;)

Good luck!

- Richard


Also, thanks to:
   Franklin Geiser for his help in explaining how to combine resistors!


Frequently Asked Question:

The most frequently asked question I get is: How many LEDs do I need to light up <something> at <some distance>?"

The answer is: I don't know. This is because there are just too many variables involved.

What is the minimum level of IR illumination for your camera, and at what wavelength? Can the illuminator be positioned near the subject matter, or does it need to be near the camera? What is the angle of the field of view of the camera? (i.e. can you point all of your LEDs at one target, or do you have to spread them out over a wide area?) How bright is each LED? How good is the match between the peak wavelength that the LEDs actually emit and the wavelength of peak sensitivity for the camera? What is the viewing angle of each LED? What is the IR reflectivity of the subject matter? (Objects that are quite bright in the visible spectrum can appear quite dark in IR, and vice versa.) What is the minimum image quality you can tolerate?

Even if I knew the answers to all of these questions and all of the relevant questions I haven't thought of yet, I'm positive I couldn't do the math. Therefore, what I would do is set the camera and illuminator up, and play with it (i.e. add LEDs) until I got the effect I needed.

Now, all of you true physics buffs are going to fall down laughing at this point (what the heck are you reading this for, anyway?), but I'm still going to give this a try:

I am dimly aware of something known as the inverse squares law, a common form of which states that the observed brightness of a light source drops off as distance increases, because the light is spreading out. The formula seems to be B=L/(4*pi*D^2), where B=observable brightness, L=luminosity of the light source, and D is the distance between the light source and the observer. So, as the distance between the light and the observer doubles, the observed brightness falls to approximately 1/4 of what it previously was.

The way I suggest that you apply this is to build a small illuminator, figure out what its maximum acceptable range is, and then use the formula to generate a guess as to how many more of those small illuminators you're going to need to reach the desired distance: First, for your 'acceptable' test case, plug in your observed distance D in whatever units you choose, and then for L, plug in the number of LEDs you currently have. Observe the value of B that pops out. Then, plug in your desired value for D, and determine the new value for L that is required to reach approximately the same value you had for B the first time. This may give you a decent starting point, but keep in mind that all of the factors from four paragraphs ago are still going to mess with your calculations. Furthermore, my understanding is that this law is generally applied for one way trips, such as light travelling from a star to the Earth. For reflected light, I'm not certain you don't need to multiply D by 2 or something like that.

The bottom line is that in my opinion, trial and error is the best way to answer the question of "what do I need?" Sorry I can't be more helpful than that.




























Come on, fhqwhgads!