Entries Tagged as 'Electronics'

Build A Flickering LED Candle Amplifier

Shadow Wood Cemetery, nestled in the heart of Spooky Hollow, boasts a growing population that enjoys an active nightlife. A pair of flickering LED “gaslight” lamps ensures that everyone finds his way home before sunrise.

How many ways are there to make an LED flicker?

Lots, and solutions range in complexity, from our fairly pedestrian driver circuit, to more complicated arrangements that include timer chips, logic gates, and even a programmable logic controller. As it turns out, making an LED turn on and off in a seemingly arbitrary pattern is a complex task, and the more random-looking the effect, the more you approach a Rube Goldberg device.

We’re all about economy here at the skunk works, and what’s more economical than robbery? For instance, the ubiquitous flickering LED candle already contains its own flicker circuit, miniaturized and encased inside the LED. We’re going to swipe that functionality and use it to drive three Ultrabright LEDs.

To accomplish this, we’ll be using the good ol’ 2N2222 NPN transistor and a handful of resistors. Well, fewer than a handful; three, to be precise. And we’re all about precision here at the skunk works; next to economy, that is. Economy and precision. Yes, that’s what we’re about.

How do transistors work?

Perhaps the better question is “why on earth do I care?”
Because Homo erectus dreamed about bar-B-Q, and discovered fire. Further innovations followed, and soon we had flash lights and space shuttles. That’s not to say that Ogg, the inquisitive caveman, triumphantly waving his flaming log around, didn’t get chased out of the cave with sticks.

The point being; a little technology goes a long way, and the benefits of learning something new almost always outweigh the possibility of getting chased with sticks. Call it an occupational hazard.

2n2222 NPN TransistorIn simplest terms, a bipolar transistor is a current-controlled device that is generally used as a switch or an amplifier. It consists of three sections called the base, the collector, and the emitter.

NPN transistor
As current increases at the base, the transistor starts to conduct electricity from the collector to the emitter. The more current at the base, the more current flows out the emitter. Decrease the base current and the emitter current decreases. This is how we’ll vary the brightness of our LEDs.

PNP transistor
Although we’re not using this type of transistor, it’s worth mentioning that a PNP transistor works completely bass-ackwards from the NPN variety. It only turns on when there is no current at the base, and current flows from the emitter to the collector. Where the NPN transistor is triggered by a high signal, the PNP is triggered by a low signal (ground).

Flickering LED amplifier circuit
In both transistor types, a small amount of current can be used to switch a larger amount of current, which is exactly what we’re doing.

Flickering LED amplifierCurrent reaches the base of the 2N2222 transistor through the flicker LED. The amount of current is varied by the LED’s internal circuitry.  When the flicker LED reduces the current at the base, less current flows out the emitter, and the ultra-bright LEDs grow dim. When the flicker LED allows more current through to the base, an increase in emitter current causes the ultra-brights to grow brighter.

And there you have it

Our flickery little flap-happy runs on 12VDC, which is fairly easy to come by. We power ours with a recycled low voltage landscape light transformer. Mount one or two of these guys inside a lantern, hurricane lamp, or that beat up solar “garden light” you’ve been saving in a box out in the garage. If your lamp’s globe is clear glass or plastic, lightly mist with white spray paint to act as a diffuser. This would look pretty cool behind a “Fresnel Globe”.

We owe a debt of gratitude to our forebear, Ogg

He overcame obstacles, and not just of the technical kind, because he almost surely faced a superstitious crowd. Douglas Adams described this reaction to technology in the following set of rules …

  1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works.
  2. Anything that’s invented between when you’re 15 and 35 is new and exciting and revolutionary and you can probably get a career in it.
  3. Anything invented after you’re 35 is against the natural order of things.

Despite getting chased with sticks, Ogg understood technology as a means to an end. This point wasn’t lost on Adams, who, in addition to his rules listed above, also observed, “We are stuck with technology when what we really want is just stuff that works.”

I’m fond of the LED candle amplifier project, and I encourage anyone who likes to sling solder to give it a go. All you really need is patience, time, meticulous attention to detail, and a decent insurance policy.

Or if what you really want is just stuff that works, order a few dozen of these.

12V Haunt Lighting with Hacked LED Christmas Lights

Green LED "Blaster"

I think the secret to a successful blog is to write only about five articles a year. Your traffic, if you ever had any, will fall through the floor, and that really takes the pressure off.

This makes perfect sense to anyone who has ever been labeled a curmudgeon. If it doesn’t describe you, however, then my definition of “successful” is almost certainly different from yours, in which case you should probably just ignore that first bit altogether.

If you’re just joining the party, we are transforming LED Christmas lights into a 12V haunt lighting system. In part I, we touched on the genesis of this project. Part II covered some LED basics, and in this third and final part, we tackle the wiring, lamp construction, and a few other bits that should be helpful if you decide to build your own LED haunt lights.

Experimenting with LEDsPrep the wire

You’ll need at least one spool of LED Christmas lights that you don’t mind destroying. It’s easier to work in sections, so unspool about four feet and snip all three wires.Three-wire light string Yes, there are three wires, and you’ll notice the middle wire connects every nth LED. Snip this middle wire about an inch from every LED to which it is connected, then unravel these longer wires and set them aside. They will come in handy later. You’ll have a pretty good pile of extra wire before long, so toss the pieces into a shoe box, or a bucket.

Separate the LEDs

You should now have a strand of LEDs on a single wire. Separate them by snipping the wire halfway between each LED.  When you’re finished, you’ll have a small stockpile of LEDs, most with two leads, and a handful with three leads. Trim the leads so they’re all the same length and strip about 1/2″ of insulation from the ends. Repeat until you get bored.

Mark the LED polarity

Red LED testAs we discussed in Part II, LEDs are polarized. Current will only flow through an LED when the negative lead is connected to the negative side of the voltage source. You’ll need to identify the positive and negative sides. There are several ways to do this.

  • Test for continuity with a multi-meter to see which direction current flows.
  • Remove the LED from its plastic casing and look for a flat side, or notch, which indicates the cathode (negative).
  • Apply 3V and see if it lights up.  If not, reverse the leads. A universal power supply is invaluable for testing LEDs. You can also tape two AA batteries together (positive to negative) to get three volts. Do NOT use a 9V battery without adding a 300? resistor in series to drop the extra 6V. (Ohm’s Law states: 6V / 20mA = 300?) Note: LEDs run on magic smoke; let it out and they quit working. Applying three times the voltage at which an LED is rated will usually do the trick.

What about the lights with three wires sticking out of them?  The third wire is connected to one side or the other (+ or -), which means you’ll have two negatives, or two positives. Pick one and snip it close to the base. Problem solved.

Once you’ve determined the polarity of your leads, mark one of them. I marked all my positives with a silver Sharpie. If you’re lucky, the plastic casing will have a clip, or some other mark, that is always on the same side.  If so, then use this as a clue to mark the other leads; it’s not necessary to check polarity on the rest of the LEDs.

Build the cans

PVC - LED light tubesFor our cans, we chose 2″ PVC pipe, cut into lengths of about six inches. If you are adept at making straight cuts with a hacksaw (I’m not), then this will be a snap. If you have a large ratcheting pipe cutter (I don’t – yet), then even better. If you decide to cut your PVC using a table saw (I did), then I can’t stress enough the importance of observing every safety precaution you ever heard of, up to, and including, wearing a lacrosse helmet over a hockey mask. See exhibit A below, which illustrates the effects of “kick-back”, and very nearly compromised the bilateral symmetry of my face.

I keep this jagged hunk of PVC on permanent display in the shop as a reminder, although the rush of wind as it whipped past my left ear is not something I’m likely to forget.

Cutting PVC pipe with a table saw is like fishing with dynamite. In fact, I take it all back; don’t do this. It’s dangerous, it will prematurely wear down your saw blade, eat puppies, and make you sterile. But … if you’re willing to take a chance with your life, then build a wooden jig to firmly hold the pipe in place, use a fine-toothed blade, cut in warm weather to reduce the chance of splintering, and wear gloves and face protection. Or maybe try a chop saw.  Hmm.  Why didn’t I just use the chop saw?

Assemble the lamp

1/4" foam "substrate"LED assemblyA bit of 1/2″ foam board makes a decent substrate to keep the LEDs from rattling around. Cut a disk to the same inner diameter as the can (two inches, in our case). You want a snug fit, but if it’s too tight, then sand lightly around the outside of the disk.

Your disk need not be an exact circle, but it’s generally preferable that the substrate conform to the shape of the container in some fashion (cough).

To insert an LED, first poke a hole through the disk with a nail, then open the hole with a small circular file. A cordless drill would probably speed things up (he said, wondering about his fixation with small circular files). Make the hole a bit smaller than the LED case so it fits snugly, and insert each LED so the positive leads are facing the same direction.

If you sorted your LEDs by color, then you probably have five separate piles of red, green, blue, amber, and yellow. These can be combined to produce new colors. Trying out different combinations is a fun way to waste a lot of time.

LED wiring diagramThis drawing of a spiky Christmas ornament is, in fact, the wiring diagram for a 16-LED lamp.

It consists of four columns of four LEDs, each wired in series. At the end of each series circuit is a positive and a negative lead. These are connected to form a parallel circuit. See our previous article in this series for a more in-depth discussion of this horoscopy.

Note, in this first photo, how difficult it becomes to determine the polarity of the LEDs when one has not properly marked the leads. Additionally, planning your wiring routes ahead of time, and inserting your LEDs all in the proper direction, will avoid the need for any “bridge” wires (cough hack).

Partially assembled LED cansAttach a long wire (from your bucket-o-wire) to the positive and negative leads of the assembled lamp, marking one of the leads outside the can (my positives are marked with red electrical tape), then connect to 12V to make sure everything works. After soldering all connections, it’s not a bad idea to wrap them in electrical tape to prevent any shorts. This would probably not be necessary if you cut your leads shorter. Apply some carpenter’s glue around the edge of the disk and slide the assembly into the can far enough that everything except the two long lead wires are fully inside the can.

Build the post

LED lamp post
A two inch vertical beam (1x2x2) is attached to a four inch length of 1×2 lumber with two 1″ wood screws, forming a “T”. This is mounted to the can with two 1.25″ hex bolts. Drill holes for the mounting bolts through the wall of the can on either side of the lamp assembly.

Drill a hole through the base of the “T” large enough to accept a 1/4×1″ bolt (overkill, but I had a box of 1/4″ wing nuts). A washer and wing nut hold everything in place. Simply loosen the wing nut to adjust the angle of the lamp.

Seal the can

End caps End cap

PVC end caps come in several varieties, from a $0.40 plastic insert, to a $3.00 end cover. However, for one whose list of quirks includes saving bits of plastic and other refuse in bins in one’s garage because “this might come in handy”, there are other options, especially if one is fond of a particular brand of grape jelly.

Drill a hole through the center of the cap and feed the wires through.  If you use metal as a cover, insert a strain relief bushing, or rubber grommet, to protect the insulation from sharp metal edges. Apply a bead of caulk, or silicone sealant, around the inside of the cap and press firmly.

LED lamp lensOur lens, a 2″ diameter disk cut from plastic sheeting (typically used in vacuum forming), is held in place with a 2″ PVC coupler and a bead of caulk. Any clear plastic would work just as well.

Why not just glue the end and lens cap using PVC cement? Because history teaches there’s a better than average chance we’ll need to get back inside this thing at some point in the future.

Hook it up

Haunt lighting planPlace your 12V transformer in a (protected, waterproof) central location and run your cabling. Two-conductor cable is ridged on one side. Attach the ridged side to the positive lead of the transformer.

Attach a low voltage wire connector to the leads on the back of your lamp, taking care to note which side of the connector is positive. Place the positive side of the connector over the ridged side of the cable and firmly press the ends together. Metal prongs inside the connector pierce the cable jacket to make the electrical connection.


09Part of the fun of any new project is answering the question, “I wonder if this will work.”  Okay, that’s not a question, but the answer is yes, if your expectations are low enough.

Okay, that’s not an answer. Let me put it another way. My expectations weren’t altogether realistic at the start of this project. Shadow Wood is located in a very dark hollow where ambient light is practically nil, and I prefer more illumination than these little guys alone can provide.

As accent lighting, however, the lamps work very well. We placed 12 throughout Shadow Wood, and once I got it into my head that their job was to provide little pools of color, I was happier with the outcome. Change your attitude, change your life. (gah…yes, yes, I know. Hypocrite, hypocrite, hypocrite)

Home guardThe takeaway here is that 12 little LED Christmas light lamps won’t illuminate your cemetery like a honking 110V halogen flood. But they nicely fill a niche and only tap a small percentage of what the transformer can provide. Namely, nice steady current, which is exactly what high power (1W, 3W) LEDs enjoy most. Aha!

Weird glows gleamWhich brings us to why this project is probably a bad idea. Now, I suppose you can make the case that you could burn down your garage with a soldering iron, a definite consideration. And, of course, there’s the possibility that a flying bit of PVC shrapnel could make your sunglasses sit crooked for the rest of your life. But these are just hazards we face every day. The real problem here is weeds.

Specifically, it’s the heading-off-into part that’s the trouble. There’s untapped potential in this project, both literally and figuratively. For instance, what will it take to make honest to gawd floods out of 3W LEDs? (Off into the weeds) With easy access to 12V DC, what other work can I make it do for me? (More weeds. Always more weeds)

Light Your Haunt With Hacked LED Christmas Lights


Shove a bunch of LEDs into a can, then watch Ohm’s Law and Murphy’s Law duke it out.

Safely lighting our outdoor haunt has always been a compromise game. Every spotlight comes with an extension cord, and those routes have to be planned because haunt visitors are like free range chickens, or BBs. They run all over. Keeping the electrified snakes from attacking our chickens is a key responsibility that we don’t take lightly.

In an effort to reduce the snake population, we investigated other lighting options and came up with what seemed to be a viable alternative: Low voltage landscape lighting.

Haunt lighting planSpecifically, we built an assortment of LED spots, powered by a 12V 350W transformer over 12AWG low voltage power cable. Because the cable carries 12V DC current, it can be safely “tucked” an inch or so beneath the soil with just a spade.

Each lamp consists of a cluster of LED Christmas lights housed in a length of two-inch diameter PVC pipe, which is sealed and mounted to a post. The positive and negative leads are attached with wire nuts to a low voltage wire connector. The best part of this arrangement is that the connector can be attached to the power bus at any point along its length, allowing for greater flexibility in the layout of our lighting plan.

With fewer extension cords lying about, there are fewer opportunities for “unplanned interactions” between them and our guests. All we had to do was keep our chickens from tripping over the lamps.


The basic idea is to pack as many LEDs as possible into the can without setting any fires.  The not setting any fires part requires that we understand a few key concepts.  For example, why would I wire three or four LEDs in series, and then connect three or four of these series circuits together in parallel? If you know the answer, then you can go outside and play while the rest of the class catches up.

It is usually at this point in a dissertation on LEDs that the author devotes several paragraphs to a review of Ohm’s Law. Instead of heading off into those weeds, we’re going to wade through some other weeds.  We’ll tackle the math as we go.

How do LEDs work?

In the most general terms, a circuit is designed to operate at a particular voltage, and will draw as much current as it needs. An LED requires a certain minimal current to turn on. The “forward voltage” is the least amount of voltage required to allow current to flow through the LED. The amount of current changes (exponentially) based on the amount of voltage that is applied. A small increase in voltage results in a large increase in current. The more current, the brighter the light.  That is, until it overheats and dies.

There are two species of LED Christmas lights. One type consists of red, orange, yellow, green, and blue LEDs. The other type utilizes only a white LED encased in a colored plastic sheath or bulb. It’s important to know the difference because the latter type provides a simpler solution for our application. All the LEDs have the same power requirement: About 2V(forward), and about 3V(optimal), drawing about 20mA. For simplicity’s sake we’ll be discussing this type of LED.

Note: I had a zillion of the colored LEDs and no data sheet, which meant I had to employ my unpaid assistants, Trial and Error, to determine the power requirements for each color. I should mention that Trial was generally cautious during testing while Error ham-handedly blew through not a few LEDs.

Think of voltage as a sluice gate above a water wheel.

Say the gate is marked with stops, 1-12, that represent voltage.

Open the gate to 1 and a trickle of water flows over the wheel, but it’s not enough to make it turn.

Open the gate further to 2 and the wheel begins to turn. We’re at forward voltage, meaning the LED is on, but just barely. We need to apply more voltage (to get more current to flow) for it to glow more brightly.

Open the gate to 3 and now there’s enough power to grind some corn.

We’re at optimal voltage and the LED glows at the brightness for which it was designed.

If you go all the way to 12, then you, or the passive-aggressive engineer who built the gate, must have a grudge against the miller. Like the wheel about to fly off its axle, when you over-energize an LED, it may glow very brightly for a short period of time, but it’s toast.

Wiring LEDs in series

Series circuitAn LED is polarized, meaning it has a positive lead(anode) and a negative lead(cathode).  To wire two LEDs in series, connect the positive side of one to the negative side of the other.  Note: Always connect the anode to the positive side of the voltage source, and the cathode to the negative side of the voltage source.

How many LEDs can safely be connected in series? Simply add up the voltage requirement for each LED until you reach source voltage (12V in this case). Assuming 3V(20mA) for each LED, the answer is four (3V+3V+3V+3V=12V). This series circuit can handle 12V, and would draw 20mA.

I can’t get my LEDs to add up to exactly 12V

Three goes into 12 four times, which is nice. But suppose your LEDs can’t handle 3V, and instead prefer 2.5V. In that case, how do you get to an even number of LEDs?

  • Option I – Intentionally overload the circuit
    You can place 5 LEDs in series. Each LED would get 2.4V (12V / 5 = 2.4V), instead of 2.5V, which means they’ll be a little dimmer. But it might not be enough of a difference for you to notice. Then again, they might be a lot dimmer, in which case you’re on to your second option.
  • Option II – Use a resistor to drop excess voltage
    Place four LEDs in series. Since these four LEDs would only require 10V (2.5V * 4 = 10V), you need to drop the extra two volts with a resistor. The resistor value can be calculated with Ohm’s Law as R = V / I. If each LED requires 20mA (.02A), then the resistor value would be 100Ω. (2V / .02A = 100Ω) So, you would add a 100Ω resistor at one end of your series circuit to deal with that extra two volts.
  • Option III – Overdrive the circuit
    Don’t. You saw what happened to the miller.

Wiring LEDs in parallel

Four LED Christmas lights don’t emit much light, and we’ve determined that we can’t add more LEDs to our series circuit, so how do we pack more light into our lamp? Simple. Build four series circuits, then wire those together in parallel.

Four series circuits wired in parallelAt the end of each series circuit is a lead. One is positive, the other is negative. Connect the positive leads, connect the negative leads, and you now have a cluster. Each series circuit draws 20mA, so the cluster would draw a total of 80mA.

How many series circuits can be wired together in parallel to form a cluster? That depends on how much current your power supply can provide, and how good you are at packing everything together inside its container. Our 12V transformer is rated at 350W. To figure the total amount of current I can draw from the transformer, [I(Amps) = P(Watts) / V(Volts)] Therefore, 350W/12V = 29A, or 29,000mA.

Our transformer could, theoretically, provide current for roughly 362 clusters (80mA * 362 = 28,960mA).  That’s assuming, of course, that our power bus is a superconductor, or a spherical chicken in a vacuum.  It’s neither, so voltage losses in the power cable would probably be a limiting factor.  Still, you could pile on a lot of lamps without worrying about the transformer bursting into flames.

Coming up…

How to build a 12V LED lamp.

I know what you’re thinking.  We’re two articles into this project (if you count the introduction), and we haven’t yet glued anything to the workbench (silicone sealant is surprisingly adhesive) or accidentally hurled a hunk of PVC across the room (off the table saw, and I’m extremely lucky to still have two ears).

I figured it was a good idea to cover the more arcane aspects of the project first.  With these out of the way, the rest of the construction is a snap.