Practice for switching on power supply


I have an esp8266 with a big ledstrip of ws2813b leds. There is a power supply powering both the esp and the leds. This is big power supply which also draws 7W when the led strip is off. Therefore I put a separate switch on the power supply.

Now I am integrating wled with OpenHAB. What I want is that the power supply is switched off a couple of seconds after the led strip is turned off. This is not too difficult.

However, the power supply also must be switched on when the led strip is turned on in OpenHAB. The problem is that the esp also comes up AFTER the supply is turned on. Therefore the ON command will initially not reach the esp.

What I came up with is a script which is triggered by CHANGES from OFF to ON and where it will switch ON the power supply and after a couple of seconds repeat the initial command.

My question is: am I on the right track or is there something more sophisticated which I can use here.

Thanks. Kind regards,

You can connect a relay to the ESP and have WLED control it. DrZzs shows how to do this with a setup similar to yours where both the ESP and LED strip use their own power supply.

I use a single 5V power supply to power an ESP8266 and an LED strip. I use the relay connected to the ESP to switch the power to the led strip. This way the LEDs don’t draw any power when they are off.
The ESP and LED strip are connected in parallel to the power supply so that the current for the LED does not flow through ESP.

How are you communicating with the ESP? If it’s via MQTT and there is a different message for ON and OFF, send the ON command message as retained. When the ESP comes up it will receive the retained message as if it were online when the command was sent in the first place and turn on the lights. Couldn’t be simpler than that.

Obviously you wouldn’t want to use this technique blindly (e.g. don’t use it when triggering a garage door opener or they will open every time the ESP reboots) but for lights it works great.

Thank you both for your replies.

I’ve tried to power my ESP with a different power supply so that I would be able to switch off the big PSU for the leds, but it did not work out as my leds were going crazy. Probably need to figure that out!

The relay to control the PSU would be great. My go-to electronic part supplier has these € 2,50 relay boards available for sale so I’ll order a couple in the next few days and will try to put these things together next weekend.