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:
- Soldering iron
- Electronics solder (not plumbing solder)
- Wire (stranded is more durable than solid)
- Something to strip and cut wire with
- Electrical tape and/or heat shrink tubing & cigarette lighter
- Power supply (specifics later)
- LED(s) (specifics later)
- Resistor(s) (specifics later)
- Volt/Ohm/Amp multimeter, in case things don't go well.
- Solder removing tools, in case things don't go well.
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...
;)
- Electricity Basics
Here are some basic electronics terms and concepts that will come in handy for this project:
- Voltage (abbreviated V) Voltage is often thought of as the "pressure" that electricity is placed under by the power supply.
The higher the voltage, the better the ability to overcome resistance and travel through something - even something that you might not want it to travel through, like the air or your body. High voltage also gives electricity the ability to push *more* of itself than you intended through your circuit - thus burning it up.
Most devices are designed to work best at a specific voltage (i.e. it's generally important to match the voltage of the device with the voltage of the power supply) ...But as it turns out, LEDs typically aren't all that fussy.
- Current A measure of the flow of electricity through a device. When using water as an allegory for electricity, current is something like the diameter of the pipe (assuming constant pressure). Every electronic device demands (or "draws") a certain amount of current in order to do its job. High current often means high heat, particularly when some sort of problem causes a device to draw more current than it (or its power supply) is actually prepared for. High current makes batteries go dead and your electric bill go up! Current is not controlled directly (the "pipe" is strictly allegorical). Instead, we will influence it by changing the resistance or voltage of the circuit. Unlike voltage, LEDs are very fussy about current: too much can destroy an LED in a fraction of a second.
- Resistance The opposition a device puts up to the flow of electricity. Generally speaking, when resistance goes up, current goes down. Substances that have almost no resistance (like copper) are called conductors. Substances with a great deal of resistance (like rubber) are called insulators. Most electrical components lie somewhere in between. For the purposes of this project, we will control current by adjusting resistance. (It is also possible to control current by adjusting voltage. Mathematically, it's just as easy as adjusting resistance, but in the real world it's often much more difficult.)
- Ampere or Amp or abbreviated A A unit of current, a bit like "gallons per hour" is a unit of water. Wikipedia says that an ampere is 6,241,509,479,607,717,888 electrons passing by a particular point in one second. Don't worry; they're very, very small. ;)
- Milliampere or Milliamp or abbreviated mA One one thousandth of an ampere.
- Ohm The units that are used to quantify resistance.
- DC Direct Current. This is electricty that flows in only one direction, like that which comes from batteries, many "wall wart" power supplies, and automotive electical systems. Direct current has a "+" and a "-" to indicate the direction of flow. LEDs don't light up if you try to run electricty through them backwards. For this project, DC power is preferred over AC.
- AC Alternating Current. This is electricty that reverses direction at regular (very short) intervals, like that which comes from a wall socket. There are devices that convert AC to DC and others that convert DC to AC. AC has no "+" or "-".
- Circuit For the purposes of this project, you can think of a circuit simply as a path for electricity to flow between the "-" and the "+" of your power supply - through your LEDs and other parts. If the electricity doesn't make that trip in the right way, nothing good is going to happen. Electricity always follows the path of least resistance towards ground (or 'minus,' in this case). A Short Circuit occurs when an unwanted path with low resistance exists (i.e. due to a wiring mistake or damage), allowing electricity to skip a portion of the circuit you wanted it to flow through. Short circuits frequently cause fires.
- Series vs. Parallel connections If you were pumping ping pong balls through two hoses, and you connected the hoses end-to-end so that every ball had to pass through both hoses, you could say that the hoses were connected "in series." If you connected the hoses side-by-side so that balls were passing through both hoses, but any individual ball passed through only one hose, then you could say that the hoses were connected "in parallel." This may not sound terribly interesting when applied to ping pong balls, but in electronics it has critically important implications for voltage, current, and resistance.
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.
- 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:
- 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.
- 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:
- (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.
- (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.
- (Best...) Use a multimeter to measure the no-load voltage of the power supply
- 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...
- 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:
-
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.)
- 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.
- 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:
- V = I x R
- I = V / R
- 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:
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
|
-
Summary
- Select a power supply. 12 volts DC is recommended.
- String a bunch of LEDs together, always connecting
anode to cathode.
- Attach an appropriate current limiting resistor
anywhere in the chain, just like you did with
the LEDs.
- Your circuit should be a single chain that
joins the "+" and "-" of your power supply.
Verify that there is only one path that
electricty can take through your illuminator.
Electricity only goes where you want it to
go when you don't give it any other choice. ;)
- Bombs away!
-
Other suggestions:
- If it doesn't light up:
- It might be plugged in backwards. Unplug it and
reverse the "+" and "-", and try again!
- Double check to make sure that you haven't
connected two LED anodes or two LED cathodes to each
other. If just one is backwards, the entire chain
will fail to light.
- If it's Infrared, maybe it IS lighting up,
and you just can't see it. But, you probably have
access to equipment that will solve this problem:
Most camcorders and
digital cameras can see at least a little Infrared
light. To check,
power the camera/camcorder on and point your TV
remote into the lens and push a button. If you see
a bluish light in the monitor,
you can use that cam to check your illuminator.
- Is your current limiting resistor too large?
(Too many ohms?) If it is, your illuminator will
light dimly or not at all until you fix it.
- Is your current limiting resistor too small?
(Too few ohms?) If it is, one or more of your LEDs have
just gone to the great electronics store in the sky. You
will need to disassemble your illuminator and test the
LEDs one at a time to see which ones were destroyed. Unfortunately for you,
you'll need a correct current limiting resistor to do this.
- Did you check the power supply? Is it putting out the
voltage you expect? Does it work at all?
- Is your voltage drop too great for your power supply?
Remember, any of your individual components may
differ somewhat from their specifications, and those errors
can gang up and push your design over the edge!
- Infrared light is fussy about the
materials it will pass through. For example,
you can pretty much forget about Infrared photography
through car windows. I'm tempted to encase an
illuminator in transparent heat shrink tubing, but
I'm not sure that wouldn't block all of the light.
- When electricty can flow out one wire of a
power supply and back in the other
with too little resistance
along the way, that's called a "Short Circuit."
Short circuits cause excessive current, and
excessive current causes electrical fires.
Use common sense -
insulate all wires with electrical tape or heatshrink
tubing to prevent the "wrong" things
from touching each other!
- If your intent is to photograph in darkness,
be sure that your camera supports it! Most modern
camcorders, digital cameras, and webcams have some
ability to pick up Infrared light, but typically
it is extremely limited - the Infrared light must be
VERY bright, like pointing the light directly
into the lens. Most do not pick it up well enough to
use Infrared LEDs as a light source. Make sure your
camera is up to the task. (BTW, it is my understanding
that most cameras fail to pick up infrared because they
contain a filter that has no purpose other than to block infrared, and
in many cases the filter can be removed. I intend to try
this at some point. ...Obviously, you shouldn't do this on
a camera you can't afford to lose.)
- Have fun spying on your pets!
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!