Helping guide you through the never-ending forest of technology, into the open glade of easy to follow posts!
The Ultimate Tree: DMX Controlled Christmas Lights
The Ultimate Tree: DMX Controlled Christmas Lights

The Ultimate Tree: DMX Controlled Christmas Lights

I’ve always loved Christmas lights, and always end up watching several videos of Christmas lights synced to music—usually Wizards in Winter. In previous years I’ve used normal Christmas lights and used 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 decided to go barebones and wire it into the Arduino. I may invest in building a dedicated PCB, but for now, it’ll be barebones. For the full list of required components and links scroll down to 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 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). For my 5ft tree 170 LEDs is more than enough. But it would be easy to double up the project and control a second DMX universe. I bought my WS2811 LEDs from AliExpress as planned this at the start of November. But, as their shipping is 20-40 days—and it’s now a little close to Christmas to order from China. 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 then gave me an even white across the LEDs. For calculating the power requirements I found this handy website that gives all the information needed: http://www.da-share.com/calculators/led-strip-string-current/ 

Arduino – Physical

For the project, I’m using an Arduino Uno. This is because I’m using a DMX Shield from Conceptinetics that fits it. 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, controlling these LEDs has proved far easier than controlling the 5050s. Note: 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.

/* 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);
}

Playing with DMX

After uploading the code, I connected the Arduino back to the LEDs and DMX Cable. This system will work with any DMX controller; I’m using QLC+ as it has a nice Web GUI included so I can select my effects from any device. I’ve got it installed 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 anyone’s followed this post, I’d love to see what you’ve come up with. Even if it’s not a Christmas Tree, send them over on Twitter—@Brzam. If you have questions about the project, I’d be more than happy to answer them.


Featured Equipment and Gear

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


by Sam Brooks

Sam is the founder and editor for Tech Trail. With a background in Broadcast Engineering, and great enthusiasm for smart home and emerging technologies.

More by Sam →

  • Twitter
  • KoFi
  • Email

Sam Brooks

Sam is the founder and editor for Tech Trail. A Broadcast Engineer with a passion for technology and design. Working on the bleeding edge of technology Sam is exposed to a vast amount of emerging technologies and likes to keep up to date on the latest tech in general.

4 Comments

  1. Cordeau

    Thanks for the instructions, all in all it was pretty simple to throw together and looks amazing.

    I have an issue with my DMX to usb interface causing things to flicker… but that’s what I get for buying cheap stuff.

    There is one small thing with the code however. Unmodified the entire string would go red when channel 1 was at full, and G when channel 2 was at full (ch 4 and 5 would do nothing). Blue was behaving fine however (ch 3 would light the first blue, ch 6 the second, and so on).

    The below modification fixed that up.

    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)));
    }

    1. Thanks, yeah I’ve played around with cheap dongles before and got the same flickering. My DMX to USB of choice is the ENNTEC PRO MK2, I took the initial plunge and have never regretted it!

      Ahh yes I had some similar issues when doing my tree, I forgot to append the code on here! Thank you for noticing, I’ve now updated it 🙂

  2. Christian Drake

    Hi, great looking Christmas tree! I’ve been trying to find a dmx to HomeKit network gateway, so that I could use simple dmx ledbars/pars to light up around my home (and outside) but all the stuff I’ve not found a smooth solution to either homebrigde or otherwise that can make the conversion, do you got any tips?

    1. Thanks! That’s an interesting idea! Off the top of my head the best method I can think of would to be to use a ESP2668 combined with a MAX485 chip, then setup a very basic web interface that would work with this plugin https://www.npmjs.com/package/homebridge-better-http-rgb.

      Then on the ESP (running Arduino) you could use the same DMX library as above but using the master example as a template! Let me know whatcha think of the method, and if I get some free time I might dabble, and if prove successful then I’ll write it up! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *