Christmas Tree Lights

Greg Abbas

My family loves setting up a Christmas tree every year. A tall, natural one with colorful lights. Even though I know LEDs are more energy efficient (and I use them in place of incandescents almost everywhere I can), I find that on a Christmas tree, old-fashioned incandescent lights look way better than LED ones. They're just prettier.

I love how they cast multi-colored shadows on the walls when they turn on and off, but the "blinker bulbs" they come with turn them on and off abruptly. I wanted something more graceful, where they fade up and down smoothly, and that's what this project is about.

AC Dimming

To dim mains-voltage lights you need triacs, and they need supporting components, so instead of building all that from scratch I got a 4CH AC LED Light Dimmer Module Controller Board.

It controls 4 devices independently, which is perfect for making 4 different strings of lights on my tree look interesting. It needs a microcontroller to control each channel, and originally I used an Arduino for that (I started this project years ago). It worked, but the Wifi solution (for integrating with home automation) was flaky. I went through several iterations before landing on the current design, which uses an ESP32 from Sparkfun which can control the dimmer board and communicate over Wifi itself.

Because all the complexity is handled on those two boards, the rest of the circuit is trivial. Just connect GPIO pins to the dimmer board and hook up power. I added external power & reset switches. Finally, ESP32 can support capacitive touch switches with no external components, so I added four of those.

Controlling the dimmer board is a little subtle. You might guess that it takes four analog voltage signals, but it doesn't. I2C would be another good guess, and there are boards that work that way, but not this one. For this one, it tells the controller every time the AC mains voltage crosses zero (that's the "sync" signal), and it's up to the controller to tell the dimmer board exactly when to turn on and off each output, 60 times a second. That has the nice advantage that you can run it in forward phase or reverse phase (or both), if it matters for your application.

On the old Arduino board I coded that logic, but on ESP32 I decided to try using ESPHome instead of coding from scratch. ESPHome has an "AC Dimmer" component that's made for exactly this purpose, and it works great.

Assembly

I hand-cut the enclosure out of clear acrylic, and glued it together with acrylic cement. (If I were to do it today, I'd have it laser-cut.) The components are bolted to the floor of the box, controls & sockets are mounted on the sides, and top has a hinge for easy access.

I used a recycled IEC-320 socket for power input.

For much of the internal high-voltage wiring I made the unorthodox choice of using speaker wire because its clear insulation lets you see the copper conductor, which I thought was really pretty.

The capacitive touch terminals are banana jacks (again, re-using stuff intended for audio applications :).

Here's the ESPHome configuration I used (view / download). The animation for the lights is coded as a "lambda" block, in C++ which gets directly included into the compiled firmware. Here's the effect it produces:

Merry Christmas!

Questions or comments? Email me at .

2024 Mar 24