Download A Simple and Cheap Dark

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Printed circuit board wikipedia , lookup

Power MOSFET wikipedia , lookup

Index of electronics articles wikipedia , lookup

Flexible electronics wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

Regenerative circuit wikipedia , lookup

Current mirror wikipedia , lookup

RLC circuit wikipedia , lookup

Integrated circuit wikipedia , lookup

Charlieplexing wikipedia , lookup

Surface-mount technology wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
e vilm adscie nt ist .co m
http://www.evilmadscientist.co m/2007/a-simple-and-cheap-dark-detecting-led-circuit/
A Simple and Cheap Dark-Detecting LED Circuit
by Windell
Here’s a simple problem: “How do you make an LED turn on when it gets dark?” You might call it the
“nightlight problem,” but the same sort of question comes up in a lot of f amiliar situations– emergency
lights, street lights, silly computer keyboard backlights, and the list goes on.
Solutions? Lots. T he time-honored tradition is to use a circuit with a CdS photoresistor, sometimes
called a photocell or LDR, f or “light-dependent resistor.” (Circuit Example 1, Example 2.) Photoresistors
are reliable and cost about $1 each, but are going away because they contain cadmium, a toxic heavy
metal whose use is increasingly regulated. T here are many other solutions as well. Look here f or some
op-amp based photodetector circuits with LED output, and check out some of the tricks used in welldesigned solar garden lights, which include gems like using the solar cell itself as the sensor. (Our own
solar circuit collection is here.)
In this article we show how to build a very simple– perhaps even the simplest– darkness-activated LED
circuit. To our LED and battery we add just three components, which cost less than thirty cents
altogether (and much less if you buy in bulk). You can build it in less than f ive minutes or less (much less
with practice).
What can you do with such an inexpensive light-controlled LED circuit? Almost anything really. But, one
f un application is to make LED throwies that turn themselves of f in the daytime to save power. T hrowies
normally can last up to two weeks. Adding a light-level switch like this can signif icantly extend their
lif etime.
Here are our components: On top: a CR2032 lithium coin cell (3 V). On the bottom (L-R): the LED, an LT R4206E phototransistor, a 2N3904 transistor, and a 1 k resistor.
T his LED is red, blindingly bright at 60 candela, in a 10 mm package. It casts a visible beam, visible f or
about twenty f eet in a well-lit room. We got the LEDs and batteries on eBay, and the other parts are f rom
Digi-Key, but Mouser has them as well. As we mentioned, the last three cost about $0.30 all together, and
much less in bulk.
T he LT R-4206E is a phototransistor in a 3mm black package. T he black package blocks visible light, so it
is only sensitive to inf rared light– it sees sunlight and incandescent lights, but not f luorescent or (most)
discharge lamps– it really will come on at night.
Our starting point is the simplest LED circuit: that of the LED throwie, which has an LED driven directly
f rom a 3V lithium coin cell. (Funny looking example
here.) From this, we add on the phototransistor, which senses the presence of light, and we use its
output to control the transistor, which turns the LED on.
T he circuit diagram looks like this; please ignore the messy handwriting. ;)
When light f alls on the phototransistor, it begins to conduct up to about 1.5 mA, which pulls down the
voltage at the lower side of the resistor by 1.5 V, turning of f the transistor, which turns of f the LED.
When it’s dark, the transistor is able to conduct about 15 mA through the LED. So, the circuit uses only
about 1/10 as much current while the LED is of f . One thing to note about this circuit: We’re using a red
LED. T hat’s because the voltage drop across the transistor allows less than the f ull 3 V across the LED.
T he f ull three volts is really only marginal f or driving blue LEDs anyway, so two-point-something really
doesn’t cut it. (Might be able to work around that with a cheap FET – haven’t tried yet.)
And now, let’s build it. You can certainly put this together on a breadboard, but there’s something more
satisf ying about the compact and deployable build that we walk through here.
First get the transistor and the resistor. T he pins of the 2N3904
are called (lef t-to-right) Emitter, Base, Collector, when viewing it
f rom the f ront such that you can read the writing. We’re going to
solder the resistor between the leads of the Base and Collector
of the transistor. Unusual part: hold the resistor with its leads at
90 degrees to those of the transistor while you solder.
Stay saf e when you do this: Use Mr. Hands.
Af ter soldering, clip of f the excess resistor lead that is attached
to the transistor base (middle pin), as well as the excess length
of the collector pin.
Next, we add the phototransistor. Note that it has a f latted side,
much like an LED does. T his pin on that side is the collector of
the phototransistor. Solder the collector (f latted side) to the
middle pin (the base) of the transistor, again at 90 degrees. T he
other pin of the phototransistor, the emitter, is lef t unconnected
f or the moment. (Here is an alternate view of what that should
look like when you’re done.)
Finally, we need to add the LED. To do so, we need to know
which side is the “positive,” or anode side of the device.
Regrettably markings of LEDs are not consistent, so the best
way to be sure is to test it with the lithium coin cell– put the LED
across the terminals of the cell and, when it lights up, note which
side is touching the (+) terminal. (Usually, it’s the one with the
longer lead.) Solder the “positive” lead of the LED to the emitter
pin of the transistor– it’s the one on the lef t, which doesn’t have
anything soldered to it. Trim away the excess lead of the LED
that goes past the solder joint. Solder the other pin of the LED
(the “negative” pin, or cathode) to the emitter of the
phototransistor, the pin on the non-f latted side, which does not
have anything connected to it yet.
By this point, there are only two pins sticking down below the components: One that goes to the resistor
and collector (rightmost pin) of the transistor, and one that goes to the emitter of the phototransistor
and to the cathode of the LED.
To test the circuit, squeeze the coin cell between these two terminals, positive side goes to the lead
touching the resistor. You can’t see the LED on here because these photos were taken with
incandescent lighting– it wouldn’t turn on.
Bending the leads to contact the lithium cell a little more reliably,
you can try it out a little more easily. In the photo on the right, I
cupped my hand over the circuit– so the LED turned on.
To make this into an actual “throwie,” you still need to add some
tape and a magnet, but that’s quite easily done. T his one makes
a pretty good nightlight attached to the top of a doorf rame–
when the room lights are of f , it shines a bright, bright spot on
the ceiling.
Where to go f rom here? While this little circuit can do something
on its own, it would probably also be happy as part of a larger
circuit. At a minimum, note that if you work with batteries that
have lower internal resistance than the lithium coin cells, you
should place an appropriate resistor in series with the battery
bef ore trying to operate this circuit– or else you may put too
much current through the LED. Certainly, this is one of the
easiest and least expensive ways to control an LED with a
photosensor. (Unlike, say, this method?) You could also consider
crossing it with some more extreme mods, like the
Talkie T hrowies that know Morse code, or f or more extreme
hackers, bagel throwies.
Note added, May 2012:
T his set of components works well, and is a pretty neat little dark detector.
We have received hundreds of responses to this article both here in the comments (which are now
closed due to abuse) and by e-mail, asking (a) how you would modif y this circuit to do X, Y, or Z, (b)
whether you can use component T HX1138 f or the phototransistor, because that’s the only one available
on the tropical island where you live, or (c) why your circuit doesn’t work, because you only made two
substitutions.
We are, f or the most part,unable to respond to inquiries like these. Designing circuits is not always trivial,
and we don’t want to give f lippant (or worse, wrong) answers, when people are trying to solve problems.
To give the quick set of answers to some of the popular questions:
T his it is a special set of parts that is chosen to work well together, and several simplif ications
have been made on the basis of which particular components are used– f or example, we rely on
the internal resistance of the coin cell, so that we don’t need an external current-limiting resistor.
Because of this, there aren’t many simple direct substitutions that work well.
T here are plenty of great CdS (“LDR”) phototransistor circuits out there. For better or worse,
this is not one of them. (We happen to think betterf or a number of reasons.)
You can’t just substitute a white (or UV, or blue, etc) LED directly, because there isn’t enough
voltage to drive it well. (We did actually show how to do this one– see below.)
You can’t just substitute 12 V, because the current will be too high, and will blow out your LED.
Yes, there are ways to do it, but you have to think it through.
Some other phototransistors will work, and some will not. If you would like to know which, you
can compare their datasheets, or– better yet –just try it!
If you would like to see a couple of other examples of dark-detecting circuits, please see here:
A dark detecting circuit f or your pumpkin and a f orum post showing how to build this circuit with white
LEDs.