My work colleague joked that I should not be let near the Christmas fairy lights as I’d probably “hook a microcontroller to them”. I’d not actually thought of this before but as the gauntlet had been thrown down I thought I better pick it up. I sketched out a simple tree with LEDs decorations on it.
I had some spare 3mm ply from the Enchanted Cottage project so that seemed the obvious choice for the tree part. My first attempt I used a ruler and adjustable angle to mark out a geometrically perfect tree with all the branches the same size. It looked terrible and due to an optical illusion the top branches looked bigger than the bottom. I’d also had a few problems with the holes for the LED breaking out on the back.
So I scrapped that and drew a new tree free hand. I then cut that out and it looked a lot better. When drilling the holes I did a pilot hole at 3mm then spotted on side with the full size drill. I then flipped the tree over and drilled through. This stopped the breakout but the holes did need a little tidy with the sand paper.
The base was a larger offcut and I drilled/chiselled a slot which the tree slipped into.
My daughter helped out with the painting of the tree and the base.
I had a selection of different coloured LEDs that had been kindly donated by Oomlout that were just the job for this project. I knew that the microcontroller would not be happy running all of these so I devised a simple transistor switch to run each channel.
I found some BC549 “general purpose” transistors in the drawer and prototyped the circuit on breadboard for testing.
Once I’d got it working with the Arduino I moved it over to some tri-pad board with the resistors simply soldered inline to the LED legs.
I’d picked up an AdaFruit trinket at the Make shop at the Maker Faire. At $5 it seemed a bargain, it’s also miniscule so ideal for this kind of project.
I did find a few catches compared to the other board’s I’ve used. It’s an ATTiny based so has fewer I/O pins, so I needed to remap my pins following my testing with the Arduino UNO. There were 3 pins that I could use for driving the transistors but they are not all PWM so I can’t really dim or cross fade my LEDs. The trinket also does not have USB serial so that means that I won’t be controlling it with the computer. One issue that nearly threw a spanner in the works in that the Trinket uses a Mini USB cable not the more common micro, luckily I found one in the back of the cupboard. The programming of the trinket is a little different too, you need to reset it each time you program by pressing the little button before uploading. It’s all explained on the Adafruit page but does take a bit of getting used to. I also found that I could only program the board if I ran the Arduino IDE as Administrator.
I did not bother mounting the driver board as that was held in place by the solid core cables. I will likely provide some support for the trinket though as it’s got to survive having a USB cable attached to it which might get knocked.