DMX Controlled Christmas Tree

DMX Controlled Christmas Tree

Introduction

I love Christmas lights, and always watch several videos of Christmas lights synced to music—usually Wizards in Winter. In previous years, I’ve used normal Christmas lights with an Arduino to cycle through the effects. This year I wanted to turn the tree up to eleven. I’ve worked with DMX for projects before, controlling strips of 5050 LED Tape, so controlling addressable LEDs was logically the next step.

There’s a fair amount of bits and pieces that came together to get this all working. But, if you’re interested in DMX and Arduinos you’re 90% of the way there. For this year I went barebones, but may invest in building a dedicated PCB in years to come. You can find the full list of required components at the bottom of this post. But I’ll go through it section by section below, so check you’ve got all the bits, then follow the below through.

The LEDs

Instead of using 5050s—which can only produce one colour—I used addressable WS2811 String Lights. These come in groups of 50 RGB LEDs and can be daisy-chained together. The limit for LEDs is the number of channels within a DMX universe, so the magic number will be 170 Pixels (510 Channel of RGB). Luckily for my 5ft tree, 170 LEDs were more than enough. If you need more, you can easy to double up the project and control a second DMX universe. I bought my WS2811 LEDs from AliExpress at the start of November. The shipping for this was 20-40 days—so it might be a little close now. You can order them from Amazon/eBay, which cost more but could be next day delivery.

The amount of power required for this will depend on the number of LEDs. For powering, I’ve screwed in DC Jack terminals to allow me to provide power through the tree. I’ve found that the voltage drop seems to affect the colour of the LEDs after around 100 Pixels, so I’ve added in a second power-supply into the 3rd group of LEDs. This gave an even white across the LEDs. For calculating the power requirements, I found this handy calculator: http://www.da-share.com/calculators/led-strip-string-current/ 

Arduino Wiring

For the project, I’m using an Arduino Uno, as the DMX Shield I’m using was made for that model. This shield makes life a lot easier, but if you are going for a smaller form factor, you can use a MAX485 chip—which is the same chip used by the DMX Shield.

The only cables required is one between pin 7 of the Arduino and the data pin of the LEDs, and one between the Arduino’s Ground and the ground pin of the LEDs. This is to make sure both are referencing the same ground—without this, the LEDs get quite glitchy.

Arduino Coding

This project uses two Arduino libraries. Conceptinetics, to talk to the DMX Shield/MAX485Chip, and FastLED to talk to the WS2811 LEDs. The coding for this project is simple, and controlling these LEDs was far easier than the 5050s. The whole project works with just the below code:

/* Sam Brooks DMX Christmas Tree */   
#include "FastLED.h"
#include "Conceptinetics.h"
 
#define NUM_LEDS 170 
#define DATA_PIN 7
#define DMX_SLAVE_CHANNELS 510 
 
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );
CRGB leds[NUM_LEDS];
 
void setup() {
   FastLED.addLeds<WS2811,DATA_PIN, RGB>(leds, NUM_LEDS);
   dmx_slave.enable ();
   dmx_slave.setStartAddress (1);
}
 
void loop() {
    int n;
    int r = -2;
    int g = -1;
    int b = 0;
    
    for (n=0; n<NUM_LEDS; n++) {
       leds[(n)] = CRGB(dmx_slave.getChannelValue((r+=3)),
                        dmx_slave.getChannelValue ((g+=3)),
                        dmx_slave.getChannelValue ((b+=3)));
    }
    FastLED.show();
    delay(50);
}
💡
There is a jumper on the DMX Shield, this has to be set to –EN to upload code, then back to EN to use the Shield’s functionality.

Playing with DMX

Uploading the code, I then connected the Arduino to the LEDs and a DMX Cable. This system will work with any DMX controller. I’m using an ENTTEC Pro and QLC+, this is because it includes a Web GUI so I can control the effects from any device on my network.

💡
I’ve got the app running on a little Barebones PC so that it can run 24/7 without using a large amount of power.

I’ve included a video of some effects I’ve built for my tree, but the possibilities are endless. If you’ve followed this guide, I’d love to see what you’ve come up with. Even if it’s not a Christmas Tree, send them over to me! If you have questions about the project, I’d be more than happy to answer them below.

As an Amazon Associate, TechTrail earns from qualifying purchases made with some store links.

Sam Brooks

Sam Brooks is the founder and creator of Techtrail. He works as a Broadcast Engineer, and has a great enthusiasm for smart home, 3D prototyping, and emerging technologies.