Lighted Christmas Tree Topper

We bought a lighted Christmas tree from Amazon that had RGB lights. It lasted a season before dying. This year I decided to make a Christmas tree topper for my wife as Christmas is her favorite holiday. It involved designing a small circuit board for the LEDs, reflowing the LEDs in a toaster oven, designing and printing the topper, writing code for an ESP32 to drive the LEDs, and creating a small website to easily control the lighted topper.

To start with, I wanted to use some new LEDs I hadn’t used before. The APA102 LEDs (also known as Dotstar) are a little more forgiving on timing than the standard Neopixel LED. I purchased the LEDs and a breakout board from Adafruit. Unfortunately I didn’t like the layout of the board as it had only one power and one ground connection which was not conducive to multiple LEDs as I’d have to share connections. I designed my own board with 4 connections on each side so I had power and ground in and power and ground out as well as data and clock in and out. The boards pins were on 2mm spacing so I could use headers as an easy way to wire in and out.

Board Top. I have a new rev that has a small pour on the ground to those pins so its not only on the bottom plane, my CAD was setup to replace etch I think and it removed it.
Board Bottom. I forgot to generate the bottom silk for the board house on the first revs, woops! Pads are for capacitors in case noise is an issue.

After I had the boards designed and ordered I had to solder a bunch of LEDs. I decided the best way would be to use my reflow oven I made for Ben’s show, seen here: https://www.youtube.com/watch?v=ckcHyMxqesM&t
I used a paste syringe to apply the solder, then ran it through the reflow oven. I had some failures to do with overheating the parts because my thermocouple setup inside the oven is not ideal. I will address that in the future so I don’t ruin anymore LEDs.

Oven is Hot Hot Hot!
Some good looking boards.

After I had the boards done I had to do the design. I designed everything in Fusion 360 and printed it out on my Prusa MK3 as large as I could get it. I made a two piece design with the front half housing the LEDs and being hollow and a few spots for magnets to attach to the back half. The back half had a sunken area to allow wiring and the controller board, a spot for the power connection (5V), magnets to attach to the front, and a hole/stand for the tree to go into.

For wiring, a barrel jack is the connection for the 5V power from a wall wart. That goes into technically the last LED in the chain and it is daisy-chained through the other LEDs all the way to LED 0 which has four connections to the ESP32, 5V power, ground, MOSI, and SCK. The power is switched so it can be turned off during USB connection to prevent the wall wart from feeding my computer’s USB port with 5V. Each LED has 8 connections, the 4 on the left are Power, Data In, Clock In, Ground, and on the right Power, Data Out, Clock Out, and Ground. Power and ground are pass thru while the data and clocks pass through the LED which acts as a shift register. I used 2mm headers to connect each LED to each other where I could, and at the ends I used ribbon cable to return to the center. If you look at the LED at the center, that is LED 0, then count outwards and counter clockwise for the data path.

Top and bottom halves: 5V power comes in on the right via a barrel jack, on the left I have 31 LEDs wired in a line, an ESP32 and a switch to turn the power off to the ESP during USB connections. Click for larger picture.
Closeup of the mediocre soldering. Technically the power and ground enter the last LED and go board to board until they get to the start of the string, there MOSI, SCK, POWER, and GROUND are wired to the ESP32. Click for larger picture.

After everything was wired it was all about the code. First time using the ESP32, I followed some examples from random nerd tutorials https://randomnerdtutorials.com/esp32-web-server-arduino-ide/
and combined that with my code for my dice lamp I created a few years back https://blog.colecago.com/?p=743 . I added a new mode not used on the dice lamp and called it StarBurst and basically it lights the LEDs in a ring going faster as it goes outwards. I also changed the inputs for changing speed, brightness, and mode from buttons to webserver link hits. See the animations below.

After I had all the animation modes working I put up a website on my internal NAS with links to the tree topper to change all of the settings.

To make one yourself, the 3D files are located here:
https://www.thingiverse.com/thing:4112353
or here:
https://www.prusaprinters.org/prints/18177-lighted-christmas-tree-topper-dotstar

You can buy bare boards here:

https://www.pcbway.com/project/shareproject/APA102_SPI_LED_Breakout_Board.html

You can buy LED’s here:

https://www.sparkfun.com/products/16345

ESP32 was purchased from here:

https://amzn.to/2VrNIno

Code is available here:

TMNT Shadows of the Past – Dice Organization

Designed and laser cut an accessory to keep track of the used and shared dice in the TMNT Shadows of the Past game. Worked pretty well, text is a bit hard to see on the wacky table cloth.

How to use: I think for us our favorite way to use is to orient the use either to the inside or outside, whichever is most convenient. And on the active turtle’s turn, all your dice are in the available section, and you grab the neighboring dice (unless you’re Raph) and put in your share section. When you use your dice you put then into the used section, as you use the share dice put them back into the used or available section of the neighbor turtles’ dice holder.

Originally I was going to put each turtle’s dice on their own share side and as they get used they go to the available or used as the neighbors used them, but I think that’s a bit more confusing. So that’s why Raph has the share section when he doesn’t borrow dice. I’ll upload both files and people can decide which they want to use.