top of page

Christmas Lights AC Controller Tutorial

I'm doing a Christmas light show to music this year and I thought I'd share various resources that I slowly pulled together about creating fancy light shows

My DIY Enclosure

I wanted an enclosure that could switch A/C lights and also run a decent amount of pixels. This is my solution - it has 8 AC power cords it can switch, and the two ESPixelSticks should be able to run up to 680 pixels each for 1360 total addressible RGB LED lights.

Parts list

12 position Screw Terminal Blocks - Amazon

Spade connectors 18-22AWG - Amazon

SainSmart 8-Channel Solid State Relay - Amazon

1 ft Power Cords - Amazon

Plastic Waterproof Cable Glands assorted sizes - Amazon

16AWG 4-conductor Speaker Wire - Amazon

CableGuard CG-1500 Enclosure - WiredWatts

5V 350W DC Power Supply - WiredWatts

ESP8266 module and adapter - Amazon

5V Power Supply and 120VAC input

The first priority was getting power to the 5V power supply that would run the pixels. I used power rails from amazon so that I could put each wire from the AC source on each rail, then ran another wire from the rail to the 5V power supply. As you can see I labelled each terminal block with the neutral on the left, ground in the middle, and live/hot on the right. I put hot on the right because my relay module will also be on the right and you want to switch the hot wire using the relays.

I used a cable gland to secure the cable. The cable gland screws on both sides of the plastic enclosure and the cable goes through it, then you tighten a nut which tightens down onto the cord and holds it in place. This should be water-tight and strong enough to withstand occasional tugs.

As you can see in the image above, I used the screw terminal blocks as bus bars for each individual AC channel. The relay should switch the HOT line on/off so that when the relay is off the wire should not be energized.

Wiring and Programming the Arduino Mega

I used a Mega because I already had the Mega attached and wired to the relay module - you don't need the full mega if you're only controlling 8 relays!! If you want to expand this and use more than 16 relays you'll need the extra outputs on the mega, but you can use an Uno for this and it will take up less space. Here's a wiring diagram of what I did - I powered the ESP8266 with the 3.3V out from the Mega. The Mega is supplied by the 5V from the power supply for my RGB lights so I put the 5V on the 5V pin. If you're powering it from 12V put the 12V into the Vin pin which uses the internal voltage regulator to step it down to 5V and 3.3V.

The code I used in the Arduino can be found below or here:

Note: This receives output from the GPIO2 pin on the ESP8266 module. NOT THE TX PIN!!! (RIP those 2 hours of my life)

Flash your ESP8266 with the most recent firmware following this tutorial, and when you can select the mode between WS2811 or Renard do Renard.

Here's my wiring in the first few AC outlets to relays - I used solid core wire because that's what was cheapest at Lowes and I was impatient to start. I highly recommend just using 14-16AWG stranded copper wire. It won't technically be rated for 120VAC, but it's fine for the <2A and <1ft distance in the controller.

Here's a closeup on the relay module and Arduino control board after wiring all the relays. You can see it got crowded but not impossibly so.

Here's a close-up on the ESPixelSticks I'm using to control all my lights. They only have one output so it takes some creativity and daisy chaining of props to do it, but you can control up to 680 RGB pixels each.

Here's the finished controller - it can control 8 AC elements (just on/off) and 1360 RGB nodes.

Outdoor Installation

Here are some different ways that people mount their enclosure outside:

I decided to use green fence T post like this:

You can get them at Lowes or Home Depot, it's <$10 depending on the length. I then used two adjustable steel hose clamps to attach it to the pole.

xLights Setup

Controlling the relays through xLights is as simple as using any other controller.

Add a new E1.31 controller and set it up as Unicast, put in the IP address, and set it to have 8 channels.

Go to the Layout tab and add whatever element you want - I typically use a matrix to represent a bush covered in lights, and a star or line for their respective shapes.

Then go into that element and under ___ RGB seetings? set the node type to single color.

Go to Controller Connection on the element and set it to Renard.

Set the Channel to whatever output it is on your Arduino - I tested these individually after all the wiring was done and used tape to label each output from my controller, this way I didn't have to keep track of wires very well as I went along.

bottom of page