Following up from the Christmas Magnets for 2018 I wanted to try and do a bigger and better project for next year. YouTube was recommending a lot of component level Macbook and iPhone repair and it made me think about getting more into soldering. Tiny soldering and surface mount soldering, those are components that only sit on top of the circuit and do not have wire leads which pass through the board. Combining this with the theme for Christmas I finalized on a PCB (Printed circuit board) in the shape of an evergreen that would have flashing LEDs on it to mimic strings of christmas tree lights.
The first step was to learn to surface mount solder. Checking out a few of the subreddits on electronics I stumbled across a maker who sells two different kits on the website tindie. I picked up both the “I Can Surface Mount Solder” and the more challenging, “SMD Challenge“ kits. Unlike the more hobby use through hole electronics components commercial use surface mount components come in many different smaller sizes since they’re usually assembled with machines and smaller components mean cheaper prices. While the first kit I started with has the larger 1206 size components (measuring approximately 3.2 mm x 1.6 mm) the SMD Challenge kit used smaller and smaller components getting down to a 0201 size (a micro size of 0.6 mm x 0.3 mm).
On top of these kits I would need new hardware as well. I opted for a more hobby-professional soldering station which has variable temperature control over the plug right into the wall and it gets hot basic types. Some magnify glasses so I can see these tiny components, and extra solder flux. This gel like liquid is a heating element of sort allowing for more working time as you attach components to the circuit board.
With everything in hand it was time to start the practice!
On through hole components the wire leads hold the component to the board. But because surface mount doesn’t have that a different trick is needed to hand assemble these. Before even touching the capacitor, resistor, or IC chip I picked a copper mount on the board and melted a good amount of solder onto it. Solder has a small amount of flux built into it so it can easily melt and flow around the “surface pad”. The flux does burn away when heated so I added extra flux onto of the solder which will allow the solder to easily flow when heated again and the flux, being tacky, will hold the component in place. I can then place the component in its spot, let the flux assist me in keeping the component in place. With one hand on tweezers finalizing the component position I can work the soldering iron in place melting that solder already on the board until it flows around the board and the component bonding them. Rinse and repeat for all the components, add in the coin cell battery on the back and you have finished surface mounted kits!
Following the same steps and having a working SMD Challenge Kit consisting of some crazy tiny components, as shows below, I moved onto designing the Christmas Tree board.
The first step for designing the final electronic circuit was to figure out what and how I wanted the electronics to light up the LEDs. From my prior experience with shift registers I set to work on those. Autodesk Inc. has a free edition of their EAGLE design software. With this software you can design electronic circuits diagrams and then have those circuits be properly placed on the circuit board for production. After a quick YouTube crash course on the software I began the first iteration, a test of shift registers and what colors lights I would use.
Using EAGLE’s built in component catalog I was able to quickly select all the components I would need for this project including the LEDs, resistors, IC chips, and a battery holder. Laying those all out on the sketchpad it was as easy as connecting the dots together. making sure all the chips were hooked up properly and everything that needed power was getting it. With built in functionality I was able to quickly export this component sketch to an actual circuit board diagram, manually move the components around as I see fit, then automatically route all the paths between them so as any signals would not cross over each other.
While I have manufactured my own circuit boards before this design was going to be much more complex including multiple layers (circuit paths on the top and bottom of the board) and a specific Christmas tree shape to the board. I used PCBWay.com to get them assembled. The Eagle software easily exported the circuit board schematics in a file format that PCBWay accepted. A quick review on their side and in just a couple of days DHL was knocking on my door with the prototype boards.
Following the same soldering steps as with the challenge boards I had Christmas Tree v1 assembled! I made a small mistake in the components used for the battery holder so I opted for soldering wires onto the board and just hooking them up to the 5v source on an Arduino for quick testing.
With the board assembled the last step was to write the program for the lights. I've written code for <shift registers link> shift registers before and was able to use most of that code with a few small changes to get a pattern of signals that could best mimic Christmas lights. The challenge then came of Getting the program onto the ATTiny85 microcontroller that I soldered to the board. Most hobby kits are made so that you can easily plug a USB cord into the board and upload your program but because I was buying individual components I had to flash the software onto the board with no easy USB assistance.
I managed to find steps online to use another Arduino microcontroller (built into a hobby board with a USB interface) as the programmer. So with a special chip clip I could connect my computer to the Arduino programmer to connect to the ATTiny85 chip so I could upload my program to it. And later update the code as I wished after the chip was already on the board.
Christmas Tree v1 circuit board was a good step for me and I learned a lot about what was needed for the end to end production of electronics. But The total cost of components (specifically the shift registers) was a little high for high volume production and the lights weren’t as bright as I was hoping. Looking more into more professional surface mounted LEDs I found NeoPixels. NeoPixels are a type of LED designed and sold by Adafruit Industries. They are RGB LEDs, similar to any other multicolored display each LED has a red, green, and blue led that can light up together at different brightnesses to give a wide assortment of colors. They can be chained together (so as to not require shift registers) and are a fraction of the cost! It felt like I hit the jackpot finding them and they can be sold as individual LEDs.
I picked up a few and began designing v2 of the Christmas Tree circuit and schematic. This time with the proper battery holder, the new NeoPixel LEDs, and in the shape of an evergreen tree. I also added a spot for a push button so I can turn the circuit off without needing to remove the battery.
After order and soldering all these components to the board it was time to write the new code! The NeoPixels are not like standard LEDs, because they have 3 tiny light sources inside but only require 1 pin to carry signal data for all of those lights (and to pass further data signals to other NeoPixels that are chained together), I needed to make use of the Adafruit library for controlling them. There was a small concern as the ATTiny only has 8KB of storage for the entire project to sit on and I needed to include the extra library. Thankfully with some finessing I was able to get the size down enough to fit on the chip. Initial tests of the program had these lights at 100% brightness and they were blinding! Hoping to save some battery life, and my eyes, I tested and settled on just 7% brightness, sometimes still too bright. Future iterations might include a light sensor to dynamically lower the brightness if the circuit is in a dark area.
I added a pattern to the lights to try and mimic a nostalgic looking red/green Christmas light pattern with the final NeoPixel at the top a solid white to imitate a start or angel.
With the code burned to the chip and the lights alternating in a pattern I like it was time to look at power. Coin cell batteries seemed to be working well so far but I needed to determine how long they would last. Following some guides and calculators online I estimated the battery life to be about 16 hours with a CR2032 battery.
Counting the total recipients of these trees I estimated I'd need to make about 20, and hand soldering all of those sounded dreadful. I've seen a few makers on YouTube who use toaster ovens to professionally "reflow" circuit boards. Using a type of solder paste you place components on the board with this thick paste holding them on the pads they are supposed to connect to. Heating them in the over to temps upward of 350F melts that paste properly connecting the components to the board. Following an assembly line process I was able to assemble the boards 6 times faster compared to hand soldering everything.
Knowing these were going through the mail I wanted to make sure they wouldn't turn on accidentally in transit and arrive with a dead battery or just break in general. I did a quick mock up of a cover for the tree and printed them out of them to protect them in the mail. While designing and printing those I also mocked up the battery holder to glue on the back of each. They would hold the magnets to mount the magnet on the fridge.
The final step was to program all of them. This step was easier than expected using the program I already had ready in a matter of seconds I could plug up a tree, flash the bootloader, and load the software verifying everything was soldered properly. Out of all the trees I made only 2 had issues both were easily fixed in 10 mins with some hand soldering.
This is, by far, one of the biggest projects I've tried to do and have succeeded on. There were months of procrastination in between as I started planning in January but didn't start final assembly until late November. Regardless of that all trees were delivered before Christmas and I got nothing but positive comments on family and friends hanging them on their fridge!