For the last few years I’ve joined in with group of my friends in a “home-made Santa” – a couple of months before Christmas, we all put our names into a hat and then each draw one name out. The idea is that we make a present for that person. There are no other restrictions – gifts in the past have included sculpture, jewelry, knitting, sewing, plenty of cakes and sweeties. Last year I made an LED flashing star and I thought it might be interesting to know how I made it.
In case you haven’t worked it out, the LEDs light as rings moving outwards so there are either 5 yellow or the one central blue one on at a time. There are plenty of sources to help on the internet – this isn’t quite taken from someone else’s design, but the ideas behind it are fairly well understood.
I was originally toying with the idea of making a tree shaped object with LED “lights” on it, but I wasn’t convinced as to what to do with it once finished. Then the idea of making a star for the top of the tree came to me. My first consideration was how to power it. On the top of a tree, batteries are probably easiest. Initially I thought about a single 9v (potentially powering 2-3 LEDs in series), but this probably wouldn’t last that long, so I went for 4 AAA cells 6V) instead. There are two ICs, a standard 555 timer, which generates a pulse (clock) followed by a 4017 decade counter / Johnson counter (at work I’d call this a shift register). [Aside1: I’m a digital chip designer by day so the logic required to get something running is straightforward to me – however building it out of discrete components is somewhat different. Normally I write in a software like language then this gets parsed by a whole chain of “CAD tools” (computer programs) before you get something that the nice guys in Taiwan will work with.] [Aside 2: It’s somewhat amusing that they make a chip which can count to 16 in pulses, but do this with just 4 flip-flops and then a decoder. The finished chip, when packaged is massive, bigger than one of CSR‘s bluetooth+FM+audio chips despite being really, really, really simple in comparison.]
Generating the clock pulses is relatively straightforward – I could download the chip datasheet from Farnell before ordering and this has a wealth of information. I made a bit of guess at the period (i.e. flashing rate) and had range of different resistors to try. It took a few goes runs to see what looked best.
Once I had a clock, this drives the counter. It’s relatively simple in that you just connect the clock, you have one output for each count (to turn the LEDs you want on), then the next count just goes to the reset to get it back to zero again without having a long off time while the counter counts past numbers you aren’t using. Although the 4017 is perfectly capable providing enough current for one LED, I wasn’t sure about 5 moderately high intensity ones. So I went for the safe option of including a transistor switch for each set of 5. There are actually several ways of getting this to work – I checked in the bible (had a copy from my university days) and jsut went for a NPN with the load on the collector and the emitter grounded. I added in a moderate base resistor (470 ohm, 1 K would have done) to reduce current flow here, and therefore decrease power consumption / increase battery life. I chose most of the components to be cheap (using a transistor as a switch doesn’t have a particularly high spec!) after they basic “it’s a transistor” choice. I probably checked that the transistor was definitely saturating, given it’s hFE, but that’s the sort of person I am. Incidentally, swap the npn for a pnp and you’ll get all the lights but one ring on if that’s what you’d prefer (and a quarter of the battery life).
At this point I came up with a neat idea to save me from adding in a series resistor for each of the 17 LEDs. The series resistor is required to ensure the correct current flows through the LED when lit. Only one LED in each spoke is lit at one time, so they can share a series resistor. You can see this on my circuit diagram. ABCDE are different spokes, 1234 are LEDs along one spoke. As I wasn’t 100% sure the circuit was OK, I tried it out on breadboard first. This also gave me a chance to get the flashing rate right. One of the tricky things to do is actually translate the circuit diagram onto something that can go on breadboard or (later) soldered on the veraboard. Here you get connections in columns for free and connect components between rows. You don’t need the optimum configuration, but it saves on time (soldering) and space if you can come up with something fairly efficient.
This is my test circuit. As you might see here, I dispensed with the transistor on the central blue LED, and it needed a different value of series resistance. Happy that the idea was OK, I could now do it for real.
First it’s onto the star itself. I’ll leave the challenge to draw a regular pentagon when you do not have a large enough sheet of paper to fit it all on as an exercise to the reader. (Hint: a pair of compasses help – no not the sort that tell you which way is North!) It helps if you don’t make it too pointy as then you have plenty of space to hide circuits and batteries behind it. I drew the template onto a piece of hardboard, then drilled small holes in the wood to be able to get the LED’s leads through without the body coming through as well. I fussed over countersinking slightly to get the LEDs to fit nicely, but it wasn’t really worth it. Next I painted it and added some glitter into the drying paint to make it more star like. The downside of this is everytime you move it thereafter, some of the glitter falls off. Better is to use glitter glue after the paint has dried instead (we’ve only recently discovered this – for small children!). I saw someone on the interwebs use a hot glue gun to fix the LEDs in – sounds like a good plan, but I didn’t have a glue gun at the time, so went for grab adhesive instead. This worked fine (although I did have to check it didn’t conduct when dry – it does a bit when still wet).
I soldered up the circuit part on to veraboard and left some trailing wires so I could test before the final connections. It’s easy to say that in one sentence, although in practice it took several evenings, especially as I always seem to have trouble getting my soldering iron hot enough. It was so much easier when I was a little boy and no-one worried about lead-free solder!
The LEDs were connected up – you end up with one side of the LEDs connected to all the others in the same spoke and the other side connected to the next LED in the same ring. You can see what I mean in the picture. Once it is all working, the grap adhesive came out again. I stuck the circuit board on one side, batteries on the other. The panel in the middle has double sided velcro stapled to it. This is for attaching to the tree and helps stop you from poking the wires when putting it up. Be warned – once the glue is dry there is no way of repairing it. The final star looks like this.