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.