Xlights controlled relay

Many people are using DigQuads and DigUnos with WLED pre installed and using them for Christmas light shows and Xlights. Many of us have no coding experience and compiling even pre-existing user mods are a little confusing and some times impossible to accomplish. Would it be possible to add a built in relay control that could be controlled in Xlights sequence along with the Christmas lights. I have some dumb LED outlined figures that I would like to turn off with all the other lights within the sequence. I do know that you could control a relay with the master WLED power button but that’s not what I want.

There is a multi relay usermod for that.

Unfortunately contoling multi relay usermod is only possible using MQTT, JSON API or HTTP API.
On the other hand if you just need to cut/provide LEDs with power when xLights streaming starts built-in functionality should be enough.

I have been trying to find how install the user mod but for someone that has never coded it makes no sense. Nobody has made a video or at least I haven’t found any.

1 Like

I found that you have a 8266 multi relay bin file. Will that work with a generic nodemcu esp8266?

It should.

Thanks! I’ll give it a try.

I got it to work in WLED. Now, is there a way to control then through Xlights?

Did you ever get this to work through xLights? I am wanting to do the exact same thing - just trigger a relay via an ESP8266 when xLights sends an “on” signal to WLED on an ESP8266. I was thinking the multi relay user mod might be worth a try but don’t want to mess with it if it can’t be triggered via xLights. I am using a really bad hack right now with Home Assistant - I use MQTT from HA to trigger xSchedule to play the show and then HA toggles a Smart Switch off and on based on elapsed time - it’s pretty ugly as it creates multiple points of failure but it works.

Internal relay as well as multi-relay usermod’s relays can be switched on when WLED receives On command or starts receiving live data (E1.31 etc).
If you need to control individual relay then unfortunately it is not possible.

Thanks, that’s the conclusion I was coming to so I am working plan B. I ordered some ws2811 led driver ICs from Adafruit (WS2811 NeoPixel LED Driver Chip - 10 Pack : ID 1378 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits). I’m thinking I should be able to connect one to the esp8266 (running WLED) output and use one of the IC’s output channels (e.g. red) to trigger a solid state relay. Seems like that should work unless there is an issue with the output signal of the red channel of the ws2811 IC. I’ll post my results on this thread.

The output of WS2811 chip is PWM.
It will not work except if you only use 0% and 100%.

Ok, I wondered if it was something like that. I’m thinking if I set WLED up with the output pin (GPIO 2) driving just one led at full brightness and only use the full “on” and “off” effects in xLights it should get the red PWM output at or near 100% to trigger the optocoupler in the SSR.

You can probably get a skimilar function by connecting a relay through a Mosfet on the pin and setting it to PWM White. You may or may not want to add a capacitor (100uF ?) across the the relay to widen the brightness range that will turn on the relay.

Thanks, I tried PWM White on WLED and I could see it working as expected with WLED (i.e. , as the output neared 100% I was getting close to 3.3 volts on the GPIO pin with a multimeter) but when I tried it from xLights I couldn’t find a setting for the model that would drive the same output. I can see where both xLights and WLED can work with dumb leds but I couldn’t find a compatible protocol that would do it.

For Xlights, the Pwm pin would correspond to a single white light.
Its position would depend on how you defined that LED strip in WLED.
If you make the first strip Pwm, then it will be LED 0 otherwise it will be 1+ the last RGB strip defined.
So in Xlights either the first or the last LED will be white and will control the relay with its brightness.

It’s possible you may need to define the control LED as Pwm RGB to maintain a consistent data stream with Xlights. That means you need 3 GPIOs (one for R,G, and B) but you could control 3 relays.

That works! I had tried it before but apparently I didn’t have xLights configured to work correctly with the ESP8622 WLED controller so it wasn’t getting xLights data (even though WLED indicated it was getting an e1.31 stream from xLights). I also got it to work (i.e. control an SSR) with the red led output pin from a WS8211 LED driver chip. FWIW, I couldn’t find a good solution anywhere on the internet for this use case, for which I believe both of these solutions are viable, with yours being the easiest to implement.

Glad you got it working.
Were you able to use a single White PWM or did you have to use RGB PWM?

I was able to use the single white PWM setting. I imagine I can use 2 other esp8266 GPIO pins to control 2 more relays using the same settings if I want to.