The Dark-Detecting LED is a classic beginner electronics project inspired by Windell Oskay from Evil Mad Scientist, knitted electronics, and instructables user abbtech, among other sources. I’d also like to thank John Hewes from Electronics Club for his infinitely helpful website assisting my understanding of transistors and other components. For any beginner, I should also mention the Encyclopedia of Electronic Components, Vol. 1 by Charles Platt will prove incredibly helpful in understanding the individual components of this and many other Weekend Projects.

Simply put, the Dark-Detecting LED circuit switches on an LED when ambient light levels dip below a certain threshold. I’m sure you’ve seen “garden lights” that perform this function, but none with this few components.

I recommend this project for beginners and enthusiasts alike because:

  • The brilliance of this project is achieved with only five common components, including many that you might already have laying around your workbench!
  • That said, it’s a fun and easy project to build with leftover components.
  • You can quickly iterate the circuit on a breadboard to experiment with components, which in turn help you understand how changing any of those components effect the output of the circuit.
  • If you’re looking for a challenge, try soldering the components together point-to-point (see Steps 7-9 below). Again because of the relatively few number of components this will be a challenge while requiring relatively few solder points — only seven!

Schematic

WP20_SCHEMATIC_w_circle-transistor

You can see the circuit contains only five components: battery, phototransistor, resistor, LED, and transistor. The parts listed for this project contain variations of all of these components. You can choose a la carte the components you want for their physical or aesthetic properties, but it really boils down to these five components.

For instance, you could choose to use a 3V coin cell battery and holder, or two AA batteries in a battery pack. You could choose a directional red LED in a clear package or a diffused one in a colored package. It all depends on where you want the project to eventually live, and how discreet or embedded you want it to be. However it should be noted that this design is only guaranteed to work with the specified components. You can’t simply replace the red LED with a blue or white one, due to the differences in forward voltage (and other specifications) required by each LED. Spend some time reading up on LEDs and Ohm’s law and you’ll be experimenting in no time!

True Story

I kid you not, while prototyping this circuit myself I encountered a resistor — a regular 1/4W 5% resistor, the kind you remove from any pack of resistors — that would only operate in one direction, as if it had polarity! Thus I recommend you first prototype on a breadboard to ensure your components operate properly. Plus doing so takes only a few minutes of time.

The Transistor

From right to left, this transistor's leads are the Collector, Base, and Emitter.
From left to right, the 2N3904 transistor’s leads are the Emitter, Base, and Collector.

The 2N3904 is a common low-power NPN transistor used in many hobby electronics projects. Unlike most simple electronics components that have two leads (typically anode and cathode; or which operate as junctions between other components, like resistors) this transistor has three leads. 1024px-BJT_NPN_symbol_(case)The “NPN” indicates the semiconductor is P-doped between two N-doped layers; as opposed to “PNP” transistors which are doped the opposite way around. The SKU 276-2016 sold by RadioShack comes in the TO-92 package configuration; one side is curved while the other is flat and has data imprinted on it (image above). The symbol for a transistor, seen at right, looks similar to the phototransistor symbol, but with that added third ‘leg’ and circle framing the symbol proper. A mnemonic for the NPN transistor’s symbol is the arrow is Not Pointing iN; again as opposed to PNP transistors whose symbol arrow Points iN Proudly.

Here’s a picture of a 2N3904 in a breadboard, with the leads indicated:

IMG_20140930_102920_detail_letters

When prototyping on a breadboard, a trick I use to orient the transistor properly is to imagine the symbol overlayed over the component like so:

IMG_20140930_102920_detail_overlay2

I align the flat side of the transistor with the bar in the symbol, and the curve of the transistor package with the symbol, keeping the arrow visible. This allows me to quickly place the leads or indicate their function. I doubt the component and symbol were designed with this in mind, but it’s a rather serendipitous visual aid nonetheless.

As shown in the schematic above, when photons (particles of light) hit the phototransistor, the transistor – and with it the LED — is effectively switched off. When a diminished number or no photons hit the phototransistor, current freely passes through the transistor’s collector-emitter junction, lighting up the LED. Experiment with the components you have available and share with us in the comments below any clever uses for this circuit you come up with!

Project Steps

And yeah, they're bright.

The two red LEDs are a 3mm diffused package (on the left) and a 5mm clear package (on the right) producing around 1200 and 5000 millicandela of light, respectively.

The white LED is another version of the circuit that I won’t explain here, but it uses a 4.5V power source and current-limiting resistor to properly turn on the LED without exhausting the circuit.

You can see all the LEDs are bright enough to shine on to my ceiling (and produce some distinct shadows), 80″ above the LED packages!

NOTE: More than five months ago I set up a version of this circuit in my studio running off a 2xAA battery source. With around 10 hours/day of little-to-no light (and thus it switched on), it’s still running today!

LED Throwie part 1

Let’s begin with a standard through-hole circuit board design. I used this round PCB from the 5-pack listed in the parts above; it was the second-to-smallest in the pack. It comfortably holds all the components and fit a CR2032 battery holder perfectly (see next step, image 3). It also allowed me to cleverly connect to the battery holder’s connectors without any additional wiring (see this step, image 3).

Use a pair of helping hands to hold the PCB in place while you insert and solder each of the components.

See image 3 for my layout. After soldering all the components, I then trimmed the excess leads, except for the long lead from the resistor (left arrow) and the collector lead from the phototransistor (right arrow).

LED Throwie part 2

I bent the aforementioned leads through the two larger holes on the PCB, and placed the PCB on top of the CR2032 battery holder. The leads from the PCB and the battery holder’s connectors matched up just right enough for me to patiently solder them together (image 1).

Now you can trim any remaining excess leads (image 2).

With everything soldered together, insert a CR2032 battery in the holder and voila, you have a dark-detecting LED circuit!

LED Throwie part 3

Now for some fun! I wasn’t satisfied with the circuit simply living on a PCB, and wanted to encase it in something. I’ve had my eye on this U MOLD material and thought this was the perfect opportunity to experiment with it.

The first image shows about two spoonfuls of the material. Since you’ll be using hot water, use a metal or glass container, and preferably one with a handle.

All you do is pour boiling water (I used an electric kettle) over the pellets and let them turn transparent, which takes around 15 seconds.

U MOLD is safe to handle and easy to manipulate, but under no circumstance should you ingest it! I used a metal cup for my experiment, and just to be safe I now reserve that cup for this and other projects in my workshop.

LED Throwie part 4

When the U MOLD pellets turn transparent, you can scoop them out of the container. I scooped the pellets out with a spoon and they will immediately bond together and form into a putty-like substance. Be careful, as sometimes hot water will find its way into an air pocket. But the material is safe to mold with your hands. I dolloped it onto the PCB, and then began to shape it with my fingers.

I left the phototransistor exposed (image 2), so it would still see light adequately during the day. When the material completely dries it will harden and become mostly opaque white.

THROWIE! I super-glued a magnet to the battery holder and tossed the Dark-Detecting LED onto a heat pipe (image 3) in the hallway of my building that otherwise has no light at night! There’s a nearby skylight during the day that provides light and thus turns the LED “off,” while it automatically lights up at night. That’s great!

Dark-Detecting Battery Pack

Using a small scrap piece of PCB from another project, I soldered up the circuit to this 3V 2xAA battery pack. I can still access the battery compartment from below, but I used U MOLD to encase the circuit and protect the wires going into the battery compartment, slightly weatherproofing the enclosure.

It is a version of this circuit — powered by two AA batteries — which has been turning on every night in my studio for many months now!

Dark-Detecting Jar Lid part 1

I save all my Bonne Maman jars after consuming their delicious contents, specifically for projects like this!

Drill a 13/64″ or 3/16″ hole in the lid of a spare jar. Insert the phototransistor through the hole from below, and glue it into place.

TIP: While this infrared phototransistor looks similar to an LED, the leads are not polarized. Rather one is the collector and the other the emitter. Follow the diagrams on the back of the component’s packaging for more details.

Dark-Detecting Jar Lid part 2

Solder the core components (sans battery) together per the schematic. This is a great time to put your skills to the test doing point-to-point contact soldering.

Cut and strip two small lengths of 22AWG wire for the battery contacts and solder them to the battery clip and also to the circuit per the schematic.

TIP: A trick for soldering small contact points together is to strip more length from the wire than you need, then to create a small “loop” with it, which can more easily wrap around your solder point (images 2 & 3). Trim the excess wire after soldering.

Dark-Detecting Jar Lid part 3

With everything soldered together, your jar lid will now light up whenever ambient light around the jar diminishes. I imagine I’ll be using this setup for terrariums, or simply as a faint bedside lamp or garden night light.

PumpkinLED part 1

I made another “button cell” version for a lid only this time that lid was the top of a pumpkin! I gave the phototransistor some extra-long leads so it could poke through the top, and used the stiffness of the wire to suspend the PCB underneath the lid.

TIP: Before mounting the phototransistor and PCB circuit you will want to want to preserve your pumpkin. There are several schools of thought, but I prefer the bleach solution method. Soak the pumpkin prior to mounting the circuit, and you could always encase the PCB in U MOLD for added protection. When you’re done with the pumpkin, simply remove the electronics and safely clean everything.

Hot glue the phototransistor in to place from above and below. This will also help weatherproof the project and ensure no water trickles in through the hole.

PumpkinLED part 2

I carved mine with a super-simple smiley face and bow-tie! Now he automatically lights up every night on my building’s stoop at dusk and stays on until sunrise.

And the best part of making a jack-o-lantern are all the pumpkin seeds you get to roast and snack on while working on your next project!

NOTE: Of course if you don’t want to bother with preserving the pumpkin from rot and mold, you can always just use a plastic toy pumpkin.

More on the Transistor

 

Considering the computer you’re now reading this on contains millions upon millions of transistors, the history of this component is pretty fascinating. For more, watch this classic video by Collin Cunningham:

YouTube player

Conclusion

The Dark-Detecting LED is a fun and simple circuit, but can easily be upgraded to the next level.

One obvious challenge is to ask yourself, "How to operate this circuit using a white or blue LED?" These typically have a higher forward voltage than red LEDs, and will require some different components to activate the circuit.

Try experimenting with connecting the circuit to a small solar panel and rechargeable power supply, so the batteries juice up during the day and the circuit automatically switches on and lights the LED at night!

What about combining the Dark-Detecting LED with a joule thief circuit? Encase everything in a wristband or necklace pendant that only lights up - powered by "dead" batteries! - when the lights go down.

Experiment and have fun. And share your thoughts, tips, and mods in the comments below!