Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.95k stars 3.23k forks source link

limit led power consumption (using estimation) #79

Closed viknet365 closed 5 years ago

viknet365 commented 5 years ago

Powering a full 5m led strip with 96 RGBW/m from an ESP8266 seems a bit crazy, but if the effect only drive a few leds its perfectly doable and can be very nice (hello meteor effect). the only problem is what happens when you crank up the volume :=)

Spoiler:

 Above one amp the schottky diode before the voltage regulator will remind it for you by emitting a strong odor of burned PCB.

Since there is already and estimation of the power consumption, it would be nice to avoid lighting more led when this limit is reached.

Assuming the test could be done in real time there is a few things we could do: 1 - Reboot and load probably failsafe settings. 2 - Reduce the overall brightness. 3 - Only light the leds at the start of the strip and don't light the other once the max consumption is reached. 4 - Something else.

Aircoookie commented 5 years ago

Thanks for the suggestion! The current estimation doesn't take effects into account, just the primary color. If it doesn't take too much performance, I could implement that before each Show() pixel update, the power for each LED is calculated and the master brightness scaled accordingly to meet the maximum set amperage. In fact, this is what OLED TVs do, it's called auto brightness limiter.

We could set the limiter to 750mA by default to stay on the safe side, which is still enough to have 15 LEDs on maximum white, or well over 100 in most effect modes with medium brightness :) The user could than, if using an external 5v supply, either increase the mA number to the rating of their power supply, or disable it entirely.

I'll try and implement this ABL feature over the next days! I wanted to do so last year already by the way, but I think I found of a way to calculate it using only addition, which should be efficient enough.

P.S.: Any burnt schottky diodes may be desoldered and replaced with a bit of solder to revive the ESP. Just make sure to only let the LEDs draw 1A (or absolute max. 1.5) after that, otherwise the board may become a fire hazard.

viknet365 commented 5 years ago

:+1: for the tip, in fact I already shorted the schottky wrapping wire on the top of it , but it's here for a reason: after a few unplug from usb something else was burned and the esp no longer boot :-) and I am too lazy reviving one of my many ESP.

Mariu86 commented 5 years ago

It's a good addition this thing ! I have 2 strips 1 with 300 LEDs and 1 with 200 and I must be careful not to set them to max brightness because the power supply it's only 8amp for the strip with 300 leds rgbw and a 4 amp for the strip with 200 LEDs rbg. will be useful to have some safety features.

debsahu commented 5 years ago

FastLed already has some code that can take care of current limitations: https://github.com/FastLED/FastLED/wiki/Power-notes