Arduino Uno + 8 SSR + ESP8266 + Xlights. Any guidance?

Fotofobia

New member
Hey guys.

I read a post somewhere of some user how he managed to get an 8 SSR and an Arduino and Vixen, so I immediately logged in to my amazon, got the SSR, got a power source 5v, got the Arduino Uno, fuses, cables....

Well, now all the hardware is put together, however, I simply cannot find a way to make this work with Xlights.

Some users told me to get some ESPSticks ---- but I don't want to waste the money I already spent on all this hardware.

Is there *any* way to make a simple Arduino Uno, with 8 solid state relays connected to the pins and an ESP8266 serving Wifi to communicate with Xlights?

I read about artnet, e131 and such but apparently I still need to get other hardware (Arduino Wifis, ESPSticks, etc).

Any help will be greatly appreciated.

EDIT: Why am I doing this? Because I want to integrate my regular AC lights to my shows.
 
Last edited:
I use Arduino and SSR's with Vixen 3. I do not use xLights to sequence AC lighting since it is more pixel-friendly. I find it harder to sequence AC with xLights.
 
Thank you for sharing. I'm looking for something to specifically handle AC lights (just On / Off).

My initial questions: which 8266 do you have? What is the purpose of using that and the uno? Can the 8266 do everything you need it to without dragging the uno into it? What have you gotten working so far? Can you control the relays with the uno? Can you connect to the wifi? Can you get xlights to talk to the board?

Since this is a very specific tool chain, you'll likely have to do a fair amount of programming on your own, i doubt there is a firmware floating around already that will run this exact setup. I'm sure it's doable to control your relays with the hardware you have. I'm sure that everyone is recommending you get an espixel stick because it runs on an 8266. but if your 8266 doesn't have a bootloader (its just the chip, not a board), you'll need a jtag programmer to get it working (which you could use the uno as a programmer). If you look at Shelby's code for the ESPixel Stick, you'll probably be 90% done with getting this to work. I use his code on an 8266 to run my inside pixels, some minor adjustments would probably get it driving your relays.

Just some brainstorming ...

Since the uno has more than 8 digital pins, you'll want to use 8 of them to switch the solid state relays on and off. I assume you're using the 8266 for the wifi connection? There is quite a bit of documentation on using that to communicate with an uno and how to set it up, but I've never done it. Which 8266 did you get? Those have more than 8 gpio pins that could be used for controlling the relays as well. The ESPixel Stick firmware works on the 8266, since thats basically what it is. (the firmware works much better on the ESP32, but that's just because its a dual core chip). You'll just need to find an artnet/dmx/E1.31 library that you can use to receive the packets from xlights and translate them into which pin should be on or off. There are several available that work on the uno. You may be able to modify the ESPixel Stick firmware to run relays on multiple pins instead of pixels. I've never coded E1.31 to control single relays, but I have used it to run pixel strings. You'd just treat each relay as a single pixel that only has two states, white and black. Black is off, and white is on. So when the E1.31 data says bulb 2 is on and everything else is off, you switch on relay 2 and off all the others. Take a look at the artnet, dmx, and e1.31 examples that come with the libraries and see which would be the easies to implement. XLights will talk those languages.

Basically you're code will need to consist of 3 parts:
- communicate with and control the ESP8266
- read the data coming from xlights
- use that data to switch individual pins high and low to turn the lights on and off

Obviously each one of those parts will have various other parts. Really the most complicated part will be pulling examples of each one and modifying them to communicate with each other and work with your specific hardware. Here is an example of someone doing something similar with the Mega board and the ethernet hat.

If I were coding it, i'd make sure I can get the uno to control each relay, once I have that down, make sure I can connect to the wifi network, once both of those pieces are working, add the artnet/dmx/E1.31 library of my choice and make sure I can read the data that xlights is sending (the serial monitor is great for that). Once I've got all that, I just need to translate the data coming from xlights into which relay should be switch which way. Its probably not a hard project broken down into small chunks. Sorry I can't help much with code as I mostly don't use arduino based chipsets anymore (i prefer the teensy and esp chips).

Just my thoughts, I hope this is helpful.
 
I'm watching this with interest as well, because I have the same questions. Except that I'm more interested in using the Ethernet shield. I can wire up SSR's to Arduinos and pi4's in my sleep, but presently I just run 16 GPIO as output on FPP which runs on my pi. The problem is, its representation in Xlights is awful. I haven't yet looked, but is this sketch a simple E1.31 to Arduino GPIO parser? Seems like that is all that is needed.

Edit:. Yeah, it looks like the sketch can simply take e1.31 and translate to SSR. However, same problem:. how to integrate to Xlights? You've basically got a DIY controller. Or maybe Renard is closer? I rely on that big Discover button in Xlights.
 
Last edited:
The examples that I linked to in post#5 has all of the requirements of the OP. Although I use a MEGA for 32 outputs, it should work with an UNO (with modification). Use a ESP-01 (8266) running ESPixelstick firmware configured for Renard protocol output. Connect output of ESP-01 to input of UNO (Rx pin 0?). Connect UNO I/O to relay/SSR board. Use xLights or Vixen to control A/C lights.

Pictured is an example of using a MEGA to control 48 channels, 16 A/C and 32 DC.
IMG_3469small.jpg
 
I did one using Shelby's e131 library example awhile back on an ESP-12, the library was dated 2015 and I know it has many updates and not sure still works, I use the first 8 channels(just short of 3 pixels) of the universe to switch the relay on when the value is > 127, off when it's less, see if you can use anything out of it, it just switch on/off, no dimming.
Code:
/*
* ESP8266_WS2811.ino - Simple sketch to listen for E1.31 data on an ESP8266
*                      and drive WS2811 LEDs.
*
* Project: E131 - E.131 (sACN) library for Arduino
* Copyright (c) 2015 Shelby Merrick
* http://www.forkineye.com
*
*  This program is provided free for you to use in any way that you wish,
*  subject to the laws and regulations where you are using it.  Due diligence
*  is strongly suggested before using this code.  Please give credit where due.
*
*  The Author makes no warranty of any kind, express or implied, with regard
*  to this program or the documentation contained in this document.  The
*  Author shall not be liable in any event for incidental or consequential
*  damages in connection with, or arising out of, the furnishing, performance
*  or use of these programs.
*
*/

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>
#include <E131.h>
#include <E131Web.h>

#define DATA_PIN1 16  
#define DATA_PIN2 5
#define DATA_PIN3 4
#define DATA_PIN4 14
#define DATA_PIN5 12
#define DATA_PIN6 13
#define DATA_PIN7 15
#define DATA_PIN8 2
#define UNIVERSE 100

const char ssid[] = "SSID";               /* Replace with your SSID */
const char passphrase[] = "PASSWORD";    /* Replace with your WPA2 passphrase */

E131 e131;
E131Web webserver(&e131);

void setup() {
  Serial.begin(115200);
  delay(10);

  /* Choose one to begin listening for E1.31 data */
  e131.begin(ssid, passphrase);               /* via Unicast on the default port */
  //e131.beginMulticast(ssid, passphrase, 1); /* via Multicast for Universe 1 */

  /* Start the web server */
  webserver.begin();

  /* Initialize output */
  pinMode(DATA_PIN1, OUTPUT);
  pinMode(DATA_PIN2, OUTPUT);
  pinMode(DATA_PIN3, OUTPUT);
  pinMode(DATA_PIN4, OUTPUT);
  pinMode(DATA_PIN5, OUTPUT);
  pinMode(DATA_PIN6, OUTPUT);
  pinMode(DATA_PIN7, OUTPUT);
  pinMode(DATA_PIN8, OUTPUT);
  digitalWrite(DATA_PIN1, LOW);
  digitalWrite(DATA_PIN2, LOW);
  digitalWrite(DATA_PIN3, LOW);
  digitalWrite(DATA_PIN4, LOW);
  digitalWrite(DATA_PIN5, LOW);
  digitalWrite(DATA_PIN6, LOW);
  digitalWrite(DATA_PIN7, LOW);
  digitalWrite(DATA_PIN8, LOW);

}

void loop() {
  /* Handle incoming web requests if needed */
  webserver.handleClient();

  /* Parse a packet and update pixels */
  if (e131.parsePacket()) {
    if (e131.universe == UNIVERSE) {
    
      if (e131.data[0] > 127) {
        Serial.print(" 1_ON ");
        digitalWrite(DATA_PIN1, HIGH);
      }
      else {
        Serial.print(" 1_OFF ");
        digitalWrite(DATA_PIN1, LOW);
      }

      if (e131.data[1] > 127 ) {
        Serial.print(" 2_ON ");
        digitalWrite(DATA_PIN2, HIGH);
      }
      else {
        Serial.print(" 2_OFF ");
        digitalWrite(DATA_PIN2, LOW);
      }
      if (e131.data[2] > 127 ) {
        Serial.print(" 3_ON ");
        digitalWrite(DATA_PIN3, HIGH);
      }
      else {
        Serial.print(" 3_OFF ");
        digitalWrite(DATA_PIN3, LOW);
      }
      if (e131.data[3] > 127 ) {
        Serial.print(" 4_ON ");
        digitalWrite(DATA_PIN4, HIGH);
      }
      else {
        Serial.print(" 4_OFF ");
        digitalWrite(DATA_PIN4, LOW);
      }
      if (e131.data[4] > 127) {
        Serial.print(" 5_ON ");
        digitalWrite(DATA_PIN5, HIGH);
      }
      else {
        Serial.print(" 5_OFF ");
        digitalWrite(DATA_PIN5, LOW);
      }
      if (e131.data[5] > 127 ) {
        Serial.print(" 6_ON ");
        digitalWrite(DATA_PIN6, HIGH);
      }
      else {
        Serial.print(" 6_OFF ");
        digitalWrite(DATA_PIN6, LOW);
      }
      if (e131.data[6] > 127 ) {
        Serial.print(" 7_ON ");
        digitalWrite(DATA_PIN7, HIGH);
      }
      else {
        Serial.print(" 7_OFF ");
        digitalWrite(DATA_PIN7, LOW);
      }
      if (e131.data[7] > 127 ) {
        Serial.println(" 8_ON ");
        digitalWrite(DATA_PIN8, HIGH);
      }
      else {
        Serial.print(" 8_OFF ");
        digitalWrite(DATA_PIN8, LOW);
      }

    }
  }
}
 
Back
Top