DMX Controlled Christmas Tree

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.

Stuff Used

Arduino Uno
DMX Shield / MAX485
WS2811 String Lights
5V Power-Supply (Use the calculator to work out required ampage)
– DMX Controller Surface
– A Christmas Tree

2
Leave a Reply

avatar
  Subscribe  
Notify of
Cordeau
Guest
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… Read more »