Sunday, 11 June 2017

When Life Gives You LEDs

I've been making quite a few gifts for babies in recent months, mostly stuffed toys, and all traditional crafts. But when it came to making something for a former colleague's new daughter, I decided to mix things up a bit.

For my housewarming at my current place, I bought a pack of 50 assorted colour frosted 5mm LEDs, attached a bunch to coin cell batteries and stuck them up around the house and garden. Because buying fairy lights is for dudes. I only used about 30 of them, and have been scouting around for a use for the extras ever since. Which led to the eventual conclusion: When life gives you spare LEDs... make night lights!

5 frosted LEDs in various colours


Usually when I work with LEDs, I want to attach them to an Arduino and program them in some way. But this project was, electronics-wise at least, much simpler. All I needed was to string 5 LEDs of various colours together, and attach them to a battery pack. I didn't even need to add a switch, as I already had a battery holder with a built-in switch on hand. This enabled to me brush up on some electronics basics I've been meaning to get into for a while.


Lesson 1: Series vs. Parallel - The Ultimate Battle

I'd heard of parallel and series wiring for LEDs, and knew that how to wire my circuit would be the first decision to make here. I found a few useful resources, such as this blog post and this circuit planning tool. And my conclusion was this:


  • Parallel wiring is regular wiring. The positive terminal of the battery connects to the anodes (positive pins) of each LED, and the negative terminal connects to the cathodes (negative pins). Move along, nothing to see here. If one LED blows, the others will continue working because the circuit's current is passing along the wires that connect all the lights together.
  • Series wiring sounds to my inexperienced mind like it just... shouldn't... work... It involves daisy-chaining the LEDs in a row, connecting the positive battery terminal to the anode of the first LED, then connecting the rest cathode to anode to cathode like some kind of ungodly light bulb centipede, ending with the cathode of the final LED connecting back to the negative battery terminal. Despite my joking around, it's an effective, easy method, but has the disadvantage that if one LED blows, the circuit isn't complete anymore and will stop working altogether. 

I went with parallel wiring because a single point of failure didn't sound like the right approach here. Also because The Human Centipede scarred me for life, and I just couldn't do that to a bunch of innocent diodes.

5 LEDs wired in parallel



Lesson 2: Join the Resistance

I knew from previous projects that I'd need resistors in my circuit, as a buffer between the current coming from the battery and the LEDs themselves. This helps the LEDs last longer, and has the pleasant side effect of toning down their eye-searing full brightness.

Calculating resistor values starts with this formula:

V = I R     aka     Voltage = Current x Resistance

The formula can be transformed to calculate whichever of the three variables you don't know, so in my case I used R = V / I.

I'd tried learning about Ohm's Law previously, but it all went over my head at the time, and sewable LEDs tend to have built-in resistors anyway, so I hadn't bothered figuring it out. This blog post explained it the best for me, but I still wasn't clear on what standard resistor value that would translate to. Later on at the Hackerspace, I spoke to Andy about it and found that as we were discussing the variables involved, everything had clicked and I understood what was going on. He suggested trying out some higher resistor values as well, because the higher the Ohm value, the more of a dimming effect the resistor has on the lights. That ended up being a great call, because even frosted LEDs are extremely bright, as you'll see in my photos of the finished product.


Lesson 3: Get On Board

I've been doing electronics projects on and off for the past 5 years or so, but since I've mostly used conductive thread rather than conventional wiring, I'd never actually prototyped a project using a breadboard. I've been meaning to learn this basic technique for ages, and this was the perfect chance, because it's always a good idea to see how the resistors affect the brightness of the LEDs before soldering everything together.

I recently borrowed the Make: Electronics book from a friend, and it had a great explanation. I also found this cute how-to comic:



And here's my prototyped circuit:

LEDs and battery pack wired together on a breadboard


This may be the most useful of the skills I learned with this project. I'm keen to move onto some more complex Arduino projects soon, and being able to troubleshoot before soldering will be invaluable.


Lesson 4: Lasers Are Awesome

Well, I already knew that. But in making the frame I would mount the LEDs on, I consolidated my knowledge around how to design in 2D for a CNC laser cutter, and how best to configure the machining settings on the Hackerspace cutter to get the results I wanted.

I started with a free DXF format vector drawing of a horse I found online. I imported it into Sketchup and with a few quick adjustments turned that horse into a unicorn, surrounded it with a simple, elegant border, and defined the edges of the piece. I also added five 5mm holes into which the LEDs would slot. The Hackerspace laser cutter has reversed x and y axes in its software configuration, so I also mirrored the image to get the correct final cut:

2D drawing on a unicorn in Sketchup


The final step was to import the image into CamBam, position it in the cutting area, and create a gcode file to feed instructions into the cutting software. With the reversed Y axis, positioning the drawing correctly was a bit of a stretch for my brain, which requires me to rotate maps in the direction I'm going in order to navigate effectively.

2D drawing of a unicorn in CamBam


The Hackerspace laser cutter uses Pronterface, a 3D printing program, to feed the gcode into the machine. I used 4.5mm white acrylic for this project, which gave it a nice frosted appearance. I also cut out four straight pieces in the same material to create a frame on the back of the unicorn piece, which would hold the electronics.

There are a few things I'd change if I did it again, like allowing more time for glue to cure - I was rushing to finish it so in the end I hot-glued everything together. It held together well, but was not exactly the most elegant solution! Here's the back of the finished lamp:

Finished lamp - back


And the front (keeping in mind that reflective surfaces and lit LEDs are a bit hard to photograph):

Finished lamp - front, unlit

Finished lamp - front, lit


I was really, really happy with the final piece. If I were to make these in any quantity, I'd probably get some PCBs made to solder the LEDs to in the proper configuration - anything that involves less hot glue and more structural integrity is a good thing here! But ultimately this was heaps of fun to make, and a great learning experience.

No comments:

Post a Comment