-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: switch power to LEDstrip using WLED controller and relay: how? #631
Comments
Don't worry, using a relay in WLED is now fully supported and should offer a great replacement for your current setup, which isn't bad, but some simplification would indeed be nice! Yes, that's true, they use about a milliamp per LED when unlit, which can add up quickly when running more than 100 or so LEDs. Setting it up is quite easy, just get a generic Arduino relay shield like this one and connect its input to GPIO12 (D6). You can choose whether you want the relay to interrupt the LED 5V power line or the live wire to the LED power supply. I would use the former for safety reasons and since you don't need another power supply for the ESP. Yes, D6 as relay pin is enabled by default in all recent binaries :) The relay operates automatically (turns on when LEDs are on and off a second after lights are fully off), but that is basically all you need, so there is no manual control of the relay possible at this point, it always depends on the WLED power state. Hope I was able to help and let me know how it goes or if you have more questions! |
Will try it somewhere in the future/when i find the time. Thank you @Aircoookie ! |
@Aircoookie is it possible to swap the logic of GPIO12. my relay needs to get ground to power on. actually the D1 mini is serving 3.3 volt on GPIO12 if the LEDs are switched on |
The relay can be inverted in the script if you want to compile yourself in the ide. |
@austwhite where can i change it? i tried it but no success |
(sorry for the long post) On the relay, one wire (from the power supply plug) goes to COMM, and i have a wire running from NC to the LED-strip. Although everything seems to work, i'm just a little unsure whether i accomplish what my intention with adding the relay is: making sure the LEDstrip doesn't use power when WLED is off. I'm confused by the green LED turning on. I've tried to measure power running over the system with a multi meter, but i'm such a noob with this, that when i tried, i seem to short something, the Wemos turns off, and when i remove a probe, everything turns on again. I've resorted to a smart plug, and i do see low electricity use when the strip is off, just not sure whether it can be even lower (the Wemos keeps being powered off course, and maybe there is a little loss in the relay). I measure about 1W (and 224 V and .02 A). When i, while the LED-strip is on, unplug the wire that enables the Wemos to control the relay, and than switch off WLED, the LEDstrip switches off, the relay does not change state (nor click), and i measure 1.6W (and 224V and .02A). One more thing i tried to verify correct working: while everything was off (but powered, so the relay should make sure there is no power to the LED strip, the green led on the relay was on), i unplugged the wire from the relay that the Wemos/WLED uses to control the relay. I hoped the relay would retain its state, but when i unplug the control wire, i hear it click, and the green LED turns off. Can anyone confirm this looks o.k. / seems o.k. / relay probably works as intended :-)? |
@Aircoookie one question please: i have a circuit with a relay. When i press the Power-button in WLED, i hear the relay click, the green LED on the relay switches on, the LED strip turns off. Am i right that current D6 behaviour in WLED is to turn on D6 (am i right the correct language is: switch the pin to high?) when WLED is switched off? (when i use the COMM and NO on the relay, the LED strip never lights, so i use COMM and NC) |
@raoulteeuwen I just checked in the code and the default behavior is to turn D6 on (high) when the LEDs are on and off (low) when the LEDs are off. It can be changed though with the |
Tried to compile from master (haven't done that a lot, but was able to compile without errors, so seemed ok). Change RLYMDE from 1 to 0 in NbpWrapper.h. After uploading, the Wemos started to flip flop its blue LED every 1.5 sec or so, i heard a relay kind of click every time, but this made the whole config unaccessible. So went back to the compiled bin and leave it like this for now (is working fine, just now using the NC port on the relay, which means WemosD1 with WLED is powering the relay when WLED is off: would rather had it the other way around ... will look into another relay as well) |
Just tried it and RLYMDE 0 seems to work fine for me, rather I believe that you are having bootloops with the version you compiled. Here is a rlymde 0 binary, you can try if that works :) |
Guess you were right, and that bin works, thank you, i can now use the NO port, and the relay only gets powered when WLED is on. Buying you a <beer/coffee/tea...>. Will search what could cause that boot loop (bad flash, wrong baud rate...) |
Awesome, thank you for the coffee :) |
reversing the relay pin might be a nice feature to have a checkbox for in the webinterface. |
Could you reupload a binary for 10.2 again? @Aircoookie I tried to compile it but it did not work and after 2,5h I can't find anything that I can change for it to work. Thanks a lot in advance. |
@Chaosflori25 here you go (assuming you were asking for a ESP8266 binary with RLYMDE 0) |
I was wondering if there is a built-in delay from the time you fire GPIO12 for the relay until you actually start pushing data to the LEDS. Reason is this; when using high led counts and a large supply you actually want to switch on that supply (separate small supply for ESP of course) at mains which takes some time to ramp to nominal voltage. This eliminates the "idle" draw of about 15 watts of a large supply being on continuously, plus of course "idle" current of the LEDS. Otherwise you see strange behavior on the undersupplied string until supply ramps. By the way, very nice software but in my initial testing last year on my current hardware which is very reliable using my custom software I was getting some undesirable "flashing" effects with WLED. But I shortly will be taking one unit offline and will give WLED another test. Thanks and I'll keep you updates |
@fpovoski no, there isn't yet but I agree that at least like 50ms are needed for the power to stabilize before sending data. There is an FR for this: #346 For getting rid of the flashing, you'll most likely need a level shifter to convert the 3.3v data signal to 5v. If your own software doesn't exhibit this flashing, it is probably either running the LEDs at a higher brightness (causing voltage drop and the voltage differential between LED supply voltage and data signal voltage to lower, thus making the signal readable to the LEDs) or at a lower framerate than the 42 fps WLED uses for most effects. |
I do level shifting the using the proper level shifting 74AHCT125/series resister and very short run to first LED. I run 1000 LEDs per controller using a tweaked FastLED (to optimize for any delay) and achieve a high frame rate with APA102s. I have very robust power distribution along the strips using 10 gauge wire, 5V/60 amp supply for each. I’ll give your sw a flash and see if I see that problem again. Also with the turn on delay a programable time might be nice since different supplies ramp differently. But I will give it a measure under a slight load. This was the one I used in past:
https://www.amazon.com/gp/product/B017YEOAPA/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
and a current one
https://www.amazon.com/SHNITPWR-Adapter-Converter-Transformer-Lighting/dp/B07TXWFSZ9/ref=psdc_10967761_t1_B017YEOAPA
Thanks
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
From: Aircoookie<mailto:notifications@github.com>
Sent: Monday, September 28, 2020 5:35 AM
To: Aircoookie/WLED<mailto:WLED@noreply.github.com>
Cc: fpovoski<mailto:fpovoski@outlook.com>; Mention<mailto:mention@noreply.github.com>
Subject: Re: [Aircoookie/WLED] Question: switch power to LEDstrip using WLED controller and relay: how? (#631)
@fpovoski<https://github.com/fpovoski> no, there isn't yet but I agree that at least like 50ms are needed for the power to stabilize before sending data. There is an FR for this: #346<#346>
For getting rid of the flashing, you'll most likely need a level shifter to convert the 3.3v data signal to 5v. If your own software doesn't exhibit this flashing, it is probably either running the LEDs at a higher brightness (causing voltage drop and the voltage differential between LED supply voltage and data signal voltage to lower, thus making the signal readable to the LEDs) or at a lower framerate than the 42 fps WLED uses for most effects.
https://github.com/Aircoookie/WLED/wiki/FAQ#reason-2
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#631 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFIUPZJVOAVICANHKIYV5SDSIBKGBANCNFSM4KLY5CUQ>.
|
Where can i see relay button in wled app? |
@mortenx you can set the Relay pin and mode in LED settings/Hardware Setup if you are running WLED 0.12.0 or newer. |
Hi all, i'm also struggling with the 5v relay. Would be wonderful if someone could help me out...
The D6 pin just hangs with the ON signal, even after a restart of my ESP. Only when I change the relay pin in the settings menu to a different pin, I can start over and turn ON the relay, but again I can't turn it off. It feels like a software problem but I can't figure it out.... Thanks for your help! |
Just checking: if ON, does WLED still work, and does it change your LED-strip? Did you try to change the wires on the relay to check whether NC/NO is making any difference (only needs 1 wire changed on the output side)? Does wiring the relay with ground directly from the power supply make any difference? |
Thanks for your quick response!
|
No one? It feels like a software bug because the D6 pin for the relay just keeps the ON signal forever . If I remove the cable from pin D6 my relay immediately switches off as it should... |
Hi @snorrebot, I had a similar issue a while ago. Turns out hyperion/ledfx was keeping WLED on despite it not showing streaming on the UI. Your wiring looks okay. Also test the relay separately, I had a defective one too. Finally the latest version has a pull high / low in the config it's worth trying both. |
@snorrebot I ran into this exact issue, with this exact (or extremely similar) relay module. I'm not terribly sure why this was necessary for this relay module, so I ended up selecting a different "higher quality" relay module that didn't have this problem. |
The relay module in question is a 5V relay, taking 5V logic as input. This is important since ESP can only provide 3.3V. What you need to do is add simple MOSFET between D6 and relay input. Don't forget to add 10k pull-down resistor to D6 and 4k7 resistor between 5V and drain on MOSFET, connect source to GND. |
Thanks ChuckMash and blazoncek for the great options! |
Another option is to use level shifter in the same way as for LEDs. |
@snorrebot The 5v Relay module by HiLetgo. |
Hi. First of all, sorry for my English. |
hello all, great to see relays being supported, but is there a way to also have an external switch (like a momentary switch). logically this would be considered a 3 way setup so that the LEDs can be toggled by both the UI and the physical switch? |
These are supported as well. |
Hey @Aircoookie, you mention that it’s safer to interrupt the led power line as opposed to the psu live wire. Why is that? I would have assumed the opposite. |
Well since most people are powering with the same PSU for both the ESP and the LED strip removing power from the PSU input would effectively shut everything off. So if it turns off then it's off and it likely wouldn't turn on again unless you use something like the Adafruit Huzzah32 which has it's own onboard battery, but if the battery dies then it won't turn on unless you modify the software to include battery monitoring. And remember that having 2 psu's you still have to unify the ground lines anyway and that will potentially cause issues if one PSU is on and powering the ESP and the other is off. Just removing the power from the LED strip saves a good amount of power use. If you really have to have ultra low power then put everything on a wall switch and manually turn it on and off. I have my 1242 LED strip setup this way so that I can reboot without much effort, just turn off the switch and turn it back on. I am also using the same PSU for an ESP8266 that I use for a few other functions with my HA install as well. |
I had the same problem, solved it by powering relay from 3.3v, seems that the relay only works when both IN and VCC has same voltage. (GPIO from esp or nodemcu gives 3.3v) |
I read a couple of tickets about using a relay, like #301 .
I currently have 2 strips, one with a NodeMCU , one with a Wemos D1 which both run WLED. I'm also using Home Assistant.
I read LED strips still consume power when 'off', so for now, i use a Sonoff Basic (on one strip) and a Tuya-kind of smart plug to totally switch off power to the strip and NodeMCU/Wemos. So my automation from HA basically is: switch on the Sonoff/Tuya, wait a couple of seconds, send any commands to the WLED NodeMCU/Wemos.
This works, but means for every LED strip i need 2 devices. Would it make more sense to connect a relay to the NodeMCU/Wemos, and use the relay to switch on/off power to the LED-strip? What are advantages/disadvantages?
If it is recommended instead of my current config, can someone help me a little? Never used a relay: am i right i need to to run 5v and gnd to the relay, and connecting a pin from the NodeMCU/Wemos (D6) to the relay to switch/control the relay? And connect the LED-strip to the other side of the relay, running either gnd or live through the relay?
How does the software side work? Do the standard bin-files have this option, or do you need to compile your own version to control the relay? How do you control the relay (MQTT-commands, GUI...)?
The text was updated successfully, but these errors were encountered: