Breathing Christmas Tree - Arduino Christmas Light Controller

About: Designer, inventor, and maker.

It is not good news that the control box for my 9-ft pre-lit artificial Christmas tree broke before Christmas,and the manufacturer does not provide replacement parts. This inscrutable shows how to make your own LED light driver and controller use Arduino and L298N Motor Driver, with multiple visual effects including 'breathing' pattern to bring this Christmas tree back to life again.

The tree I have is a Color Changing LED Christmas Trees made by GE, featuring following light choices: 1) clear LED lights, 2) multi-colored LED lights, 3) alternating from clear to multi. The tree is controlled by a light controller powered by a 29V DC power supply. How does the color change work? I dissembled the control box, it turned out that each light bulb consists of a clear LED and color LED connected in parallel but with reversed polarity. Depending on the polarity of the DC power supplied, either the clear LED or color LED will lit up, thus provide color changing effect with only two power supply lines. In my case, the transistors in the H-bridge inside the control box shorted out and the power supply module is also damaged. To make the tree work again, I need to find a 29V DC power supply and manage to switch the polarity to the LEDs. This is the same task as controlling the direction and speed of DC motors. With a little programming, it is also possible to change the intensity of the light and create additional visual effects such as ”breathing".

Step 1: Parts

The light controller consists of two parts:

  1. 29V DC power supply
  2. The controller circuit that changes the color and brightness of the LED light by alternating the polarity of the DC power with PWM (Pulse-width Modulation).

The tree requires a 29V power source with about 500mA capacity. It is difficult to find a low power 29V DC power supply. I utilized an XL6009 Step-up Power Module DC-DC Converter to up-convert 12V DC to 29V DC. For the details of XL6009 modules, there's a helpful Instructable article.

To control the light, I used an L298N H-bridge motor controller, controlled by the Arduino Nano board. The L298N consists of two identical H-bridge each have a maximum of 2 Ampere capacity and are ideal to be used in this case.

Since the LN298N module is subjected to 29V DC power, the onboard 5V power supply should be disabled (remove the small 5V Enable jumper) and powered by external 5V power. I used an LM2596 DC to DC Buck Converter to convert the 12V DC to 5V to power both LM298N and the Arduino Nano board. The XL6009 and LM2596 modules look very similar, it is advised to adjust the output voltage separately before final assembly of the light control module, and clearly mark the wires.

To connect the components, I used Dupont jumper wires or 16-18 AWG stranded wires.

Additionally, you'll need some wires and screws, as well as access to a 3D printer to print the case, and a soldering iron.

Step 2: Electronics and Wiring

The wiring is straightforward. Once the power supply modules are adjusted to the desired voltage, connect the 29V to the power supply terminals on the L298N module motor marked as GND and +12V, and the GND and 5V terminal on the L298N module to the corresponding pins on the Arduino Nano board. Also, connect the +5V power supply from the LM2596 module to the same GND and +5V terminals to power the logic part of the circuit. Then, connect the Arduino Nano to the L298N as following:

Pin 9 --> IN1

Pin 8 --> IN2

Pin 10 --> ENA

Finally, connect the LED lights to the Output A terminal on the L298N module.

Step 3: Programming

Attached is the sample Arduino sketch with 'Breathing" effect. You may modify the code to change the frequency or add additional patterns and light effects.

Step 4: Print the Light Controller Enclosure

Below are the STL files for the enclosure, I printed all the parts with 25% infill. Mount all the electronic components inside the box use M2x5mm self-tapping screws and assemble the box.

Share

    Recommendations

    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest
    • Organization Contest

      Organization Contest
    • Faux-Real Contest

      Faux-Real Contest

    Discussions