Because the controller will be outdoors (sitting under the mega tree), I purchased a Dri-Box. This does a good job of keeping water and moisture from entering the box due to rain, snow, changing temperatures, etc. The disadvantage is that the power supply has no ventilation, no way to dissipate heat. But, I have not had any controller failure due to overheating, so I think it is OK.
There are five areas where wires can enter the box. That is a far cry from the 16 wires that need to enter it. I clustered 3-4 wires per area and anchored them inside their areas with black tape.
Mounting the Arduino and network board
Use only an Arduino Mega 2560 board for the WS2811 & RGB controller. This is necessary as this boards has additional RAM and plenty of output pins on it. I found a plastic bumper on www.thingiverse.com for the Arduino. I press-fit the Arduino in the bumper, then used foam tape to affix the bumper to a wall in the box. I also mounted the network board to the wall of the enclosure, inserting the board in a 3D printed bracket that sticks to the box's side. Here is where you can download the bracket if you wish to print your own.
Mounting the power supply
The controller uses a computer power supply that I had lying around. This power supply provides 5V to power the ws2811 lights and 12V to power the RGB lights. I mounted it to the floor of the box with foam tape. I also attached an inexpensive voltage display to the box's side. You can search for "dc voltage display" on eBay to find similar displays. This way, the power supply displays the current voltage as the lights are running, as it's important to keep the voltage as close to 5V as possible (at least for the 5V ws2811 strings).
Mounting the relays
Each of the three trees using two strings of "dumb" RGB lights for a total of six strings. Each string require three relays to switch on/off 12V to them, a total of 18 relays. I purchased three of the below 8-relay boards. To mount them in the box, I cut two strips of wood, mounted them vertically on the box floor, then screwed down the three relay boards horizontally down the wooden strips.
Important, before mounting the relays in in the box, it will be much easier to connect wires to the relays' screw-down terminals first! Especially all of the 18 ground wires. Please see the "Connecting the "dumb" RGB strings to the Arduino" section below on how to connect wires to the relays.
Mounting the ws2811 connectors
The original ws2811 strings either came with bare ended wires or already connected to a JST-style connector; I cannot remember. Regardless, I terminated each of the eight ws2811 strings with a female 4-pin JST connector like the one below. I foam tape mounted an eight-terminal strip on top of the power supply, then connected eight wires to the input pins on the Arduino (see this diagram for details).
NOT mounting the power terminal strip
In the below picture, attached to the power supply, is a terminal strip of red & black wires with capacitors mixed in. When I first built the controller, the ws2811 strings on the mega tree would randomly "glitch" (bulbs would change to unexpected colors). I tried placing capacitors between the power and ground connections to each string, but that did not fix the problem. The true solution was placing 220-ohm resistors in-line the strings' data wire, absorbing "signal bounce". Instead of removing the power terminal strip and capacitors (which didn't help anything), I lazily left it all there. You do not have to wire this portion of the controller.
Wiring everything up
You can download the wiring diagram here.
First off, wire all components to power. The computer power supply has 4-pin Molex hard drive female power connectors. I connected a male Molex connector to that, then ran the red wire to the power terminal strip that I stuck to the top of the power supply. This strip powers the ws2811 strings.
I then ran the yellow wire from the Molex connector to a small power terminal that I stuck to the side of the computer power supply. I also ran 5V and ground from the main power terminal to this smaller terminal. Thus the smaller terminal provides "12V, 5V, and GND" connections. This terminal is used to power the RGB strings and relays. From this smaller terminal, wires from the 12V terminal runs to each RGB string (six wires). The 5V and GND terminals runs wires to power and ground each of the three relays. It also grounds the Arduino.
Lastly, I placed a 6V 2A DC "wall wart" in the box, then connected its power connector to the Arduino. This provides a power source to the Arduino that is independent of the computer power supply, as the latter's voltage level could fluctuate when the strings were lit with different colors. Also, since my computer power supply didn't quite produce 5V of power, the network board could not operate correctly. Giving the Arduino a dedicated 6V power connection and powering the network board from the Arduino solved my problem with dropped network connections.
Important! Make sure that you use a male Molex connector with thick wires or multiple wires per pin, when connecting this plug to the computer power supply! The eight ws2811 and six RGB strips pull more amps that I realized.
The final step to powering everything is grounding everything. The Arduino, network board, relays, and ws2811 & RGB strings need to share a common ground so that their circuitry works properly. If you don't do this, the lights will behave unpredictably. Thankfully, this is fairly easy to do. The Arduino have multiple ground ports, so run a ground wire from that to the power terminal strip The network board can be grounded to the GND pin on the Arduino. The relays get their ground from the side mounted, smaller power terminal, which in-turn gets its ground from the main power terminal strip on top of the power supply.
Connecting the ws2811 strings to the Arduino
This is fairly easy to do. Each of the eight ws2811 strings (for the mega tree) has a single data wire, a total of data wires. I mounted a terminal strip to the lower-right top of the power supply with foam tape, then ran wires from the terminal to eight pins on the Arduino (see the above wiring diagram for pin number assignments). On the other end of the terminal, I connected eight 220-ohm resistors. I soldered the other end of the resistors to the green "data" wire on eight female JST connectors. The in-line resistor for the strings' data line is important to absorb "signal bounce" that can cause glitching problems in the bulb colors.
I ran the eight red "power" wires from the JST connectors to the 5V power terminal strip and the eight black ground wires from the JST connectors to the GND power terminal strip. Since the amperage from eight ws2811 strings can be high, either use thick wires if your power and ground wires are sharing one terminal or scatter the 8 power/ground wires to several terminals on the power strip. This prevents the wires from getting too hot and melting!
I clustered all eight JST connectors together, then held them together with a wire clamp that is foam taped to the top of the power supply. That keeps the connectors from pulling on the wiring as you connected/disconnect the strings to them.
On the ws2811 strings themselves, I soldered male JST connectors on them. Each string has a 5V, data, and GND line, so make sure that you match these wires with the proper wires on the female plug in the controller.
Connecting the "dumb" RGB strings to the Arduino
These strings are analog in nature and require relays to properly light them. So it's (sadly) a lot more work to connect them to the Arduino. My controller box controls three trees that each have two strings of RGB lights on them. Each RGB string uses four wires, a 12V wire and three ground wires. Setting the ground signal in different combinations on these three ground wires is what changes the color on these strings (seven combinations). Each ground wire must be connected to the Arduino's data pins, which means there are 18 connections!
Even though the relay strips have eight relays on them, I am currently only using six relays per strip (this controls two RGB per strip). Thus, in my case, each relay strip controls one tree (two strings per tree, six ground wires total).
To start, connect six wires from the Arduino to pins IN3 through IN8 on each relay strip. The GND pin on the strip goes to GND on the power terminal, while the VOC pin goes to 5V on the power terminal. In the lower-right corner of my relay strip, there is a small set of pins labeled "GND VCC JD-VCC". Run a wire from GND to GND on the power terminal, then use a jumper to connect VCC and JD-VCC together.
On each relay are three screw-down terminals. The middle terminal is the "input" signal and the right terminal is the "output" signal. The left-side terminal is not used. The relays are used to send the GND signal from the Arduino to the ground wires on the RGB strings. This is what controls the color combinations. Run wires from the GND power terminal to the middle screw-down "input" terminals on all 18 relays. It may be easier to run one GND wire from the power terminal to the first relay in the strip, then daisy-chain from that relay to each relay in the strip.
Next, connect three wires from six female JST connectors (18 wires total) to each of the right-side screw-down terminals on the 18 relays. These are the "output" wires that send GND signals to the strings.
The four wire on the JST connector is to provide 12V power to the string. Connect these wires (one wire per string, six wires total) to the 12V power terminal. These are are not connected to the relays. The relays are only switching GND off and on, not power.
That's it! Connecting "dumb" RGB strings to the Arduino is a lot of work. Overall, it's easier to use ws2811 strings for everything and not bother with "dumb" RGB at all. :) However, RGB strings require less processing power and memory on the Arduino, so it is easier to control lots of RGB strings than the same amount of ws2811 strings.
You may find that bulbs light-up sporadically, changing to unwanted colors or not changing colors at all. If your ws2811 strings are glitching (particularly as more strings are connected to the controller), consider adding 100-220 ohm resistors to the data lines between the Arduino and lights (closer to the Arduino). This may help absorb "signal bounce" in the data lines, affecting the other strings.
Programming the Arduino
When you create animations on your computer with xLights then hit "play" to playback the animations to your strings of lights, xLights sends commands in a language called "DMX". These commands leave your computer, travel on Ethernet cables via a protocol called "E131", then are received by light controllers can speak the DMX language. These controllers then animate the strings of lights connected to them.
You need to install a program on the Arduino that makes it become a DMX controller. This program was written by Keith Westley, allowing inexpensive Arduino microcontrollers to replace expensive, dedicated DMX controllers costing hundreds of dollars.
To program the Arduino, you need to download the Arduino IDE. This allows you to upload programs from your computer to the Arduino board. Normally, you download Keith's DMX program, open it into the IDE, then upload the DMX program to the Arduino board. This is trickier than it sounds, as Keith's program needs installed a special way into the IDE. To save you time, you can download the Arduino IDE with Keith's program already installed from here. Simply unzip this file into a folder on your computer.
Configuring the DMX program
The next step is configuring the DMX program for your particular lights, such as the number of strings that are connected to the Arduino and the IP address that you will assign to the Arduino, which is important for xLights to "see" your controller. To do this, edit the global.h file in the arduino-1.6.5-r2\examples\DMXControllerWs2811 folder with your favorite text editor. These are the important lines that need changed:
A "Universe" is a number that represents all of the strings connected to your Arduino. In my case, I have two Arduinos, one set to universe 1 and the other set to universe 18. These numbers are defined in xLights. So when xLights is sending DMX commands to light-up strings in a particular universe, the Arduino is listening and acts upon commands only for its universe. If you don't know the universe for your particular controller,first read the section on setting up xLights on this website before continuing with these instructions.
If the strings of ws2811 lights connected to your Arduino have different number of bulbs on them, MAXBULBS indicates the number of bulbs on the longest string.
This defines how many ws2811 strings are connected to the Arduino (a maximum of eight are allowed)
#define IP_BYTE_1 169
#define IP_BYTE_2 101
#define IP_BYTE_3 200
#define IP_BYTE_4 203
These four lines define the IP address for this Arduino. This way, xLights on your computer can "find" your Arduino on your Ethernet network and send DMX commands to it.
Uploading the DMX program
The next step is sending the DMX program to the Arduino's memory. To do this, open the folder that contains the Arduino IDE that you downloaded above. Then run arduino.exe. When the program starts, click File > Examples > DMXControllerWs2811. A second Arduino IDE window will appear with the Keith's DMX program open.
Before connecting your Arduino, verify this first:
* Make sure that you are using the Arduino Mega 2560. DMX program only works with this board.
* If you have strings of ws2811 and/or RGB ights connected to the Arduino, it is a good idea to temporarily disconnect them. If the Arduino already has an older version of the DMX program and you connect the Arduino to your computer, the Arduino may draw too much power from the USB port to power the lights.
When you have met the above requirements, connect the Arduino to your computer via a USB cable. If this is the first time you have connected the Arduino, Windows will attempt to install hardware drivers for it. Depending on the version of Windows that you have and the brand of Arduino, the driver may install automatically or you may be prompted to provide the driver software (you may have to download the driver software for that particular brand of Arduino). Either way, the drivers must be installed successfully before proceeding to the next step.
When you connect the Arduino via USB and the computer accepts the connection with no errors (indicating that the drivers are installed and functional), tell the Arduino IDE the type of Arduino you are using. Click Tools > Board > "Arduino Mega or Arduino Mega 2560". Next, choose Tools > Ports > COM x where "COM x" is the virtual communications port that was assigned by the driver. If you see more that one listing under "Ports" and are not sure which one to choose, try the first one, then try uploading the DMX program as explained below. If the upload fails, choose the next COM port under Ports, then try uploading again.
Next, verify that the DMX program code is valid by clicking the checkmark icon in the Arduino IDE toolbar (below the File menu). You will see "Compiling sketch..." in the window's lower status bar while the program is verified. This may take several moments. If you see an orange message stating "Error compiling", then there is something wrong with the DMX program or perhaps there is a typo in the global.h file that you modified above. In this case, you will need to close the Arduino IDE program, fix the problem, then open the Arduino IDE and try to verify the program again.
If the DMX program verifies correctly, you will see the "Done compiling" message in the status bar. At this point, you can upload the DMX program to the Arduino via the Upload button (the right-arrow button next to the checkmark button in the toolbar). When you click Upload, the DMX program will be verified again, then you will see "Uploading" in the lower status area. A light on your Arduino will rapidly flash during the upload process. When the upload is complete, you will see a message stating so in the status area. You can disconnect the Arduino from the USB cable.
After the DMX program is uploaded to the Arduino, it will begin running the DMX program immediately. We now need to see if the controller can be contacted on an Ethernet network. To do this, connect one end of an Ethernet cable to the Arduino's network board and the other end to an Ethernet switch or hub. Connect your computer to the Ethernet hub/switch via another cable.
Next, verify your computer's IP address. It must be on the same subnet as the IP address that is assigned to your Arduino. For instance, if your Arduino is assigned an IP address of 126.96.36.199, your computer's Ethernet card must be assigned a similar IP address of 169.101.200.x where "x" is a number from 1-254, but not 203. Having a similar subnet on both your computer and the Arduino is important for them to "see" each other on the Ethernet network.
Then you can power-on your light controller. Lights should appear on the Arduino. On the end of the network cable that plugs into the Arduino's network board, there are two lights. One should be solid, indicating a connection to the Ethernet hub/switch. The second light should be flickering occasionally, indicating that the Arduino is sending/receiving information on the Ethernet network.
At this point, you are finished building the ws2811 & RGB light controller! The next step is configuring xLights to "see" your light controller, then running a sample animation to determine if xLights can properly communicate with it. If all goes well, the sample animation will begin flashing the ws2811 & RGB lights that are connected to your controller. This is explained in the "How to test it" section on this website.