Because my controller will be indoors, the enclosure did not have to be waterproof. I chose a plastic Sterilite container with a removable lid. I cut holes on the ends to allow Ethernet cables to be plugged into the network boards, USB cables to be plugged into the Arduinos for reprogramming, power supply fan ventilation, power supply power cord, a hole for the power switch, and a long slot for the switch's eight Ethernet ports.
Mounting the Arduino and network boards
Use only Arduino Mega 2560 boards for the GECE light controller. This is necessary as these boards have additional RAM and plenty of output pins on them. I used four bolts to attach the Arduino to the enclosure, screwing the bolts from bottom of the case through the holes in the Arduino's board corners. Because the enclosure's bottom has curved edges, the Ethernet jacks would be too far inside the floor to easily connect/disconnect the Ethernet cables. So I mounted the network boards to the side of the enclosure, inserting the boards in a 3D printed bracket that bolts to the enclosure'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 dedicated 5V power supply. It is a long supply that barely fits in the enclosure. I placed the power supply on a block of wood to raise its connectors above the Arduino boards so that things aren't too cramped. I also attached an inexpensive voltage display to the enclosure'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.
Mounting the GECE jacks
The controller is placed in the living room, though the 16 GECE strings are attached all over the house (windows, roof, driveway, house corners, etc.). Because some strings could originate up to 200 feet from the controller, I chose to extend the strings with 16-gauge power extension cords. These cords have three conductors, perfect for interfacing wtih the GECE strings. These strings also have three conductors for 5V, ground, and data. I cut-off the female extension cord plug, then wired the cord directly to the GECE string (described more below). To interface the extension cord to the light controller, I mounted inexpensive house outlet receptacles to the enclosure's lid. I mounted each receptacle, each offering two outlets for a total of 16 outlets. The two holes that normally mount the jacks to outlet boxes allow the receptacles to be bolted to the enclosure lid.
Mounting the Ethernet switch
Even though the GECE light controller only needs two Ethernet cables to control the lights, I mounted an eight-power Ethernet switch into the lid of the controller. I did this simply as a convenience, that way I wouldn't have to have the switch box outside laying around. The switch is powered by the dedicated 5V power supply that drives the lights, Arduinos, and network boards. The switch hangs from the inside bottom of the lid via a 3D printed bracket that bolts to the lid. Here is where you can download the bracket if you wish to print your own.
Wiring everything up
You can download the wiring diagram here.
First off, wire all of the components to power. My power supply has three 5V connectors (V+) and three GND (V-) connectors, so I spread the wires among these connectors. Run a wire from 5V (V+) on the power supply to Vin on each Arduino. Then run a wire from power supply ground (V-) to GND on each Arduino. Do the same to both network boards (the power pin is labeled 5V instead of Vin on the network boards).
Note: If you choose to power the Arduino with a larger voltage, do not go higher than 7V! Higher voltage will make the Arduino's voltage regulator overheat. The Arduino could start crashing from overheating.
Note: When connecting wires to the power supply and receptacles, I crimp wires onto red spade connectors. That save a lot of unnecessary soldering!
To power the receptacles, run a heavy-gauge wire from 5V on the power supply to the bronze terminals on the receptacles. To ground the receptacles, run a heavy-gauge wire from ground on the power supply to the green terminals on the receptacles. You can daisy chain the ground wire from receptacle to receptacle, requiring only one wire back to the power supply. However, if you plan to daisy chain the power wire, daisy chain only 2-3 receptacles per power supply wire. This allows the amps consumed by the lights doesn't overload the wires.
To power the Ethernet hub, my particular hub used a 5V AC to DC adapter. I originally powered the switch directly from the 5V power supply. This is acceptable, but later I chose to power the switch with its original adapter, wiring into the 5V power supply's AC input. This way, if the lights causes the power supply's 5V level to fluctuate, it doesn't affect the reliability of the hub.
The power supply requires an AC input. I removed a computer power supply's female port, then mounted it to the enclosure's side. This allows me to use a standard computer power cord to connect the controller to an AC power outlet. I attached the AC cord's green wire to the AC ground input on the power supply and the AC cord's white wire to the neutral input on the power supply. I connected the AC cord's black wire to a two-pole switch, then continued the wire to the line input on the power supply. This allows me to switch the power supply on and off from outside the controller, as the switch is mounted to the enclosure's side.
The final step to powering everything is grounding everything. The two Arduinos, two network boards, and GECE 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 between the Arduinos. The network boards also have multiple ground ports, so run wires from the network boards to the GND ports on the Arduinos. If you are powering the Ethernet hub through it's AC to DC adapter, you don't need to share a ground with everything else. With the thick ground wire coming from the recepticles to the power supply, splice an extra wire to the thick wire, then run the splice wire to the GND pins on the Arduinos.
Connecting GECE strings to the Arduinos
Each of the eight receptacles has two outlets. Therefore eight receptacle supports 16 strings of GECE lights. These are the silver terminals on the receptacles. Simply run 16 wires from each silver receptacle terminal to the data ports on the Arduino (see the diagram for Arduino pin numbers). Each Arduino supports eight 50-bulb strings of GECE lights (400 bulbs per Arduino). Therefore I run eight strings to one Arduino, then the other eight strings to the second Arduino.
Look at the receptacles closely as the pair silver terminals may be joined with a metal tab. Be sure to break-off this tab with pliers to ensure that each silver terminal is electrically isolated.
Connecting network boards to the Arduinos
There are variations of the ENC28J60 Arduino-compatible Ethernet network boards. Some use 3.3V to power them, some use 5V, and some can use either. Be sure to use boards that use 5V; they seem to be more stable. Also, it is important not to power the network board from the Arduino; they cannot provide enough amps and will cause the network connection to sporadically fail. Power the network boards from the dedicated power supply, ensuring that the network board ground shares the power supply ground and Arduino ground (see "Powering everything" section above).
For the rest of the wires that need connected between the network board and the Arduino, refer to this diagram for pin numbers).
You may find that bulbs light-up sporadically, changing to unwanted colors or not changing colors at all. If your GECE 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. I have not tried this idea yet on my GECE controller. Also, adding 220 uF capacitors between the power and ground to each string may help as well (reduces interference), but I haven't tried this on my GECE controller yet, either.
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\DMXControllerColorEffects 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 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 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 201
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.
Note: You'll see that my particular setup has three global.h files: global.h, global (driveway).h, and global (house).h. The important file is global.h. Because I have two Arduino controllers that have different settings (the IP addresses are different, for example), the latter two files contain these differences. When I am ready to upload the DMX program to one of the Arduinos, I copy one of the latter two files to global.h, then upload the program. It's simply a convenience for me.
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 > DMXControllerColorEffects. 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 GECE lights 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 22.214.171.124, 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 201. 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 GECE 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 GECE lights that are connected to your controller. This is explained in the "How to test it" section on this website.