When the only tool you have is a hammer, every problem looks like a nail. An LED ornament for the Christmas tree can be built in any manner of simple, easy implementations. You certainly don’t need an ARM Cortex M4 CPU running at 120MHz having a mouthful of three letter features like FPU, ETM, ETB, ECC, RWW, TCM, EIC, AES, CAN bus and much, much more. But [Martin Held] built a super simple LED Christmas tree ornament using the ATSAME51 series micro-controller, which he regularly works with and had on hand, and lots of bi-color LEDs. He already had schematic symbols and programmers for the device from other projects where he uses it more extensively, so putting it all together in time for the festive season was that much faster for him, despite the fact that the micro-controller was most likely the cheapest part of the BOM, besides the passives.
At this point it might be tempting to argue that it would have been so much simpler to use addressable LED’s, such as the WS2812B or the APA102C. You can drive them using a more basic micro-controller, and not require so many GPIO pins. But using such “smart pixel” LED’s for hand assembled prototypes can sometimes lead to unexpected results. If they are not stored in sealed tape/reel form, then storage conditions can have an adverse effect leading to dead pixels. And, they need a specific baking procedure before being soldered. Doing that for a few LEDs at home can be tricky.
So for the LED’s, he again went a bit off the beaten path, selecting to use three different color styles of bi-color LED’s with easy to hand-solder, 1206 footprints. This allows him to get a fairly random mix of colors in the completed ornament.
The LED array is pseudo-charlieplexed. One terminal of each LED goes to a GPIO pin on the micro-controller and the other terminal of all the LED’s are connected to a single complimentary pair of N-channel/P-channel MOSFETs — connected in totem-pole fashion. Depending on which MOSFET is switched on via a GPIO pin driving the gate pin high or low, the second terminal of each LED gets connected to either supply or ground. In combination with the GPIO pins being driven high/low, this allows the bi-color LED to be biased in either direction. Getting each LED to emit one color is simple enough — setting all LED GPIOs low, and MOSFET gate GPIO high will bias the LEDs in one direction. Reverse the GPIO logic, and the LEDs will be biased in the other direction. If this is done slow enough, the two colors can be differentiated easily. If the driving logic is made fast, changing states every 10us, the two separate colors merge to form a third hue. With some clever bit of code, he also adds some randomness in the GPIO output states, resulting in a more appealing twinkling effect. [Martin] does a detailed walk through in the video embedded below.
If you have the same bunch of parts lying around and wish to replicate the project, be warned that the KiCad source files will need some work to clean up errors — [Martin] was in a hurry and knew what he was doing so there are some intentional mistakes in the schematic such as using the same symbol for the N-channel and P-channel MOSFETs, and uni-directional LED symbol in place of the bi-directional one. And for programming, you will need one of these pricey pogo-pin style cables, unless you decide to edit the PCB before sending off the Gerbers.
[Martin] built just three of these bespoke ornaments, retaining one and giving away the other two to a neighbour and a co-worker. But if you would really like to build a tree ornament with addressable LEDs, then check out the Sierpinski Christmas Tree which can be cascaded to form an array of tree ornaments.
7 thoughts on “Simple Christmas Tree Christmas Tree Ornament”
The title of this blog article has been approved for general viewing by the Department of Redundancy Dept.
Well, it is a Christmas Tree shaped Christmas Tree ornament, so the redundancy may be intentional and technically correct. ;)
Cool project, I’ve literally planned to make something like this for the past 3 years, but always wait too long to get started before Christmas, and then put it on the back burner after Christmas, intending to get an earlier start the following year, which I subsequently fail to do. Next year… I’ll definitely maybe remember to try to not blow it.
I have bought a nice kit some years a go, a pine shaped pcb, some red leds becaude at the times only red, yellow and green leds were available and red led were cheaper, some transistors, resistors, capacitors and a 9V battery holder. Nice educational kit.
Yes, I have a Vellemann kit, it may be the one you are referring to, I swapped out some of the red LEDs with green, yellow, and orange ones. Years later, I swapped in a blue LED, IIRC.
(I forgot to dig it out this season)
web searched and found this, I think it is the one I have.
That is “LEDs,” not “LED’s.” The apostrophe with an “s” is for posession, not plurality. You have multiple LEDs. You could write “The LED’s cathode” if you were writing about the cathode belonging to a particular LED.
With abbrev’s and TLA’s it’s semi acceptable in that you’re using the apostrophe to shorten the last word, which if spelled out would be plural but isn’t in the acronym.
Can´t wait for Halloween as HaD rolls back into 2020…
Please be kind and respectful to help make the comments section excellent. (Comment Policy)