Xlights controlled relay

How did you set it up in Xlights?

I have the esp8266 set up as the first controller on the xLights Controllers tab (before I did this the controller wasnā€™t getting the data from xLights - I spent several hours trying to troubleshoot this and moving the controller to the top of the list is what made it suddenly work).
Vendor/Model/Vaiant: WLED/WLED/Generic ESP8266
Protocol: E131 (my other controllers are esp32s with DDP protocol - donā€™t know if that is a factor in needing to put this controller first or not)
Start Universe: 1
I used the visualize button to link the model that uses the relay

Settings for the model are as follows:
number of nodes: 200 (I donā€™t think this matters but I drew the model in xLights and you canā€™t see it when itā€™s set to 1 node)
Protocol: WS2811
String Type: Node Single Color
Color: White

All the other settings are typical. I us the ā€œOnā€ effect at 100% white to switch the relay on in the xLights sequence.

I discovered an issue when I have the relay/lights and ESP8266 on the same power switch (not how I had it for testing) in that the relay activates and WLED locks up when I switch power on. My current work-around is to disconnect the relay ground wire, power everything on, and then reconnect the relay ground wire to the esp8266 - Iā€™m thinking I need resistors/capacitors somewhere to fix this but I donā€™t have the electronics knowledge to know what needs to go where (a capacitor between ground and the GPIO signal pin maybe?). I tried a 470 microfarad capacitor across ground and the enable pin of the esp8266 but, other than delaying startup, it made no difference.

1st - Maker sure you have an EMF diode across the relay coil.
Thatā€™s a small rectifier diode in reverse polarity (Cathode to V+ on coil, Anode to V- on coil) across the relay coil.
That deals with the reverse voltage spike generated by the coil switching off which could damage a GPIO pin.

2nd - What GPIO pin are you using for the relay.?
With the relay connected to a GPIO, the ESP8266 will ā€œseeā€ that as a pull-down resistor on power up. Depending on what GPIO you picked, that can stop the 8266 from booting.
Lookup: ESP8266 Best pins to use for a list of GPIOs and their flavours at Boot time.

Itā€™s a solid state relay - no relay coil that I know of. I tried GPIO pins 2 & 1 (in that order). I thought I had read somewhere that for WLED you had to use GPIO 1, 2, or 3 (and 3 was discouraged) but it may have been on some previous version. Based on your link above (excellent info!) itā€™s obvious those pins were being pulled low at boot by the low voltage side of the relay and causing the boot to fail. I just moved it to GPIO 12, problem solved. Thanks for the info!

Hereā€™s a follow-up on xLights settings. I was wanting to control more than 1 relay with this set-up and, after some tinkering I can now control 3 relays with the ESP8266 and xLights. I used GPIO pins 12, 13, & 14 on the ESP8266 for signal output to the relays (i.e. connected to Solid State Relay positive). On xLights the number of nodes in each model is critical or the relays wonā€™t work correctly. Each model should have 3 nodes (I assume R-G-B) so that the subsequent models correspond correctly with the controller. This makes the models hard to see in the xLights preview screen but, to me, thatā€™s a minor inconvenience.

Thanks, FINALLY got it working. 3 relays GPIO 1,2,3.

Awesome, just a warning on those GPIO pins, depending on the relay circuit if they are pulled low on boot by the relay your controller may not work (see discussion above).
To fix the issue I was having with xLights model display I have 2 models I put in a group, one model is the 3 node configuration on the controller I needed to get the relay to function, the other model is configured with ā€œno controllerā€ and drawn to match the prop with the actual number of lights connected to the relay. When I want to activate the prop I use the ā€œonā€ effect with the group, that way I see it activate in the house preview window.

Ran across this topic today. Iā€™m trying to do exactly the same thing. I was able to get the relay status leds to light up when WLED GPIO pins 12,13,14 are set to PWM White with inverted output box checked.
I canā€™t however get anything to work from xlights. Iā€™m very new to xlights but I was able to sequence 800 pixels on an ESP8266 so I know a little.
In Xlights version 2024.17 I set the model to:

  • Single Line
  • ā€˜#ā€™ of Strings: 1
  • Nodes/String: 3
  • String Type: Node Single Color
  • Color: White
    Add the model to port 1 with protocol ws2811.
    In sequence I set a simple on of and then play sequence and I get nothing on the ESP8266.
    What am I missing? Iā€™ve spent the last 3 days trying to get something to work with SSR relays and this is the closest Iā€™ve come. I would GREATLY appreciate any assistance.

I remember having similar issues, and I struggled with many different configurations. I did finally get it to work and as I recall I had to change where the controller was on the list of controllers, I canā€™t recall if I moved it to the first or last controller. I am no longer using an ESP8266 as I needed more circuits so I switched to an ESP32 controlling mechanical relays. I donā€™t recall having issues with the ESP32 so if you can switch it may be worth it.

Would you mind sharing your WLED settings for ESP32 with multi relay and what the visualize tab is configured to in xlights? Currently working on the same thing, after just learning of multi-relay mod this week. Had been using another github repository that would control relays and it worked but wanted to integrate into HA also.

Thanks in advance.

Hereā€™s the layout with Visualize:

And hereā€™s the xLights controller settings:

In WLED hereā€™s what I have for LED settings:
LED Outputs:
1: ON/OFF Index 0, GPIO 4, Inverted Output - True
2: ON/OFF Index 1, GPIO 13, Inverted Output - True
3: ON/OFF Index 2, GPIO 16, Inverted Output - True
4: ON/OFF Index 3, GPIO 17, Inverted Output - True
5: ON/OFF Index 4, GPIO 18, Inverted Output - True
6: ON/OFF Index 5, GPIO 19, Inverted Output - True
7: ON/OFF Index 6, GPIO 21, Inverted Output - True
8: ON/OFF Index 7, GPIO 25, Inverted Output - False (I use this output to trigger a servo with an Arduino Nano)
9: ON/OFF Index 8, GPIO 22, Inverted Output - True (I m not using this output, as I recall xLights limited me to 8 relays on one WLED controller)

Make a segment for each output: True

Just a word of caution on using HA to control, I have a matrix I had put on HA and the pixels would randomly pulse. This was a couple years ago, and through input from others I was able to trace it to HA doing some sort of polling for updates. It may be fixed now, and the pulse probably wouldnā€™t be noticeable on relays anyway but I didnā€™t need these WLED controllers on HA anyway so I took them off of HA.

I see, so youā€™re using the built-in on/off under LED Settings rather than using the multi-relay mod?

I also have a matrix in HA, I donā€™t run it all the time but thatā€™s good to know and will keep in mind when it does get more use.

Lol, I set this up a couple of years ago and have NOT been keeping up on WLED improvements, I was not aware of the multi-relay mod. There may be a better way, this has always worked for me so I havenā€™t messed with it.

Let me tell you, I was pulling the little bit of hair out I still had when I was getting that pulsing on my matrix randomly throughout my show. I was so relieved to see that taking it out of HA fixed the problem so I havenā€™t looked back. I use MQTT through HA to trigger my xLights shows and thatā€™s the only interface I have between my show pixels and HA. I do have other WLED devices in HA that arenā€™t in my shows but they are just running WLED effects - no xLights.