dullage / ESP-LED-MQTT

ESP8266 firmware to control WS2812 LEDs over MQTT. Works well with Home Assistant.
MIT License
39 stars 14 forks source link

Can't turn LEDs back on after turning them off? #4

Closed georgbachmann closed 4 years ago

georgbachmann commented 5 years ago

Hello, I am not sure if I use if wrong, or if there's a bug... What I am doing is I am sending the mqtt message {0:0} and it properly powers off my LEDs. Now I want to power them back on again and send f.e. {0:1,2:[20,0,255]} but nothing happens. I have to restart my NodeMCU and then it works again. Am I doing it wrong? Or is this supposed to work?

Thank you very much and cheers, Georg

georgbachmann commented 5 years ago

Also as a little follow up if I may... I noticed that when i turn the brightness very low. Like f.e. {0:1,2:[4,0,0]} some of the pixels of my LED strip turn off, others turn into random colors. Most LEDs are very dark red, but some are off or a random color. Do you have any idea why that might happen? It seems not to happen any more if my values are >10

dullage commented 5 years ago

Hi @georgbachmann, what you are doing looks ok, {0:1,2:[20,0,255]} should indeed set the lights to on and to blue.

Are you saying that you can only send 1 command and then after that it becomes unresponsive?

If you monitor the device over serial do you see > MQTT Received when you send the second command?

I'm not sure about the low brightness, for the most part I'm just handing the values over to Adafruit_NeoPixel, have you tried the same brightness just using that directly?

georgbachmann commented 5 years ago

Hey @Dullage thanks for your help! So I can send a 0 and it's powering off. Then I send a 1 and it's not always powering on again. In serial monitor I tried to debug a bit but could not find the cause... It's receiving the mqtt command and also going into the correct methods, but it stays dark :( Is it working for you? So when you send like 0, 1, 0, 1, 0, 1... will it always work like it should?

dullage commented 5 years ago

Yup, I have 3 strips in my house running this code for a number of years now and it's never missed a beat. 2 are using WemosD1s but 1 of them is also a NodeMCU.

I probably haven't updated my dependencies recently so there's a chance later versions (presuming your're on later versions) might have affected things. Doesn't seem too likely though.

Have you tried other boards, pins or LED strips? Might be worth ruling that out?

georgbachmann commented 5 years ago

Currently I only have one board and one strip here... Hm... will try to order something else to test :) Would you show me your circuit? I am not a hardware-man... so I just build what somebody else showed :) Also... which stripes are you using? Thank you very much!

dullage commented 5 years ago

These are the strips I'm using: https://www.amazon.co.uk/gp/product/B01EJ0EXXQ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

I have a single 5v power supply going to VCC and GND on both the NodeMCU and the LED strip. I then have a signal pin going from the NodeMCU to the DIN pin on the LED strip. I'm not sure it matters too much which pin but worth trying others if you're having issues.

Also, I think the DIN pin is designed for 5v but the GPIOs on the NodeMCU are 3.3v. I've never found this to be an issue but I know others have. You can get a component to up this voltage if needed.

You can use a separate power supply for the strip but it's important that the grounds are shared between the NodeMCU and the LED strip.

You could also power the strip through the NodeMCU. For small strips (30 or so LEDs) this is "probably" fine but I'm not sure about any bigger?

I'm no expert on this stuff, I just know what's worked for me in the past. Hope this helps.