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.32k stars 3.05k forks source link

Discrepancy between max current draw per RGB channel and max current per white channel when using RGBW strips leads to system overcurrent when using automatic brightness limiter #3707

Open benanerson opened 6 months ago

benanerson commented 6 months ago

Is your feature request related to a problem? Please describe.

ISSUE: Automatic current limiter does not take in to account different power draw for white channel on RGBW strips. If you set your "Max current per LED" to reflect the max current of the RGB channel, and then use only the white channel, WLED estimated current is significantly lower than actual current being drawn. Could easily lead to accidentally drawing more current than your system can safely handle if you are not aware of this.

Describe the solution you'd like In the app, would like to have a prompt for "Max current per LED (RGB channel)" & "Max current per LED (White channel)" when using RGBW strips. Then WLED can properly implement software current limiting and you will not have to sacrifice RGB brightness, or risk drawing too much current.

Describe alternatives you've considered

Set "Max current per led" to the max current draw of the white channel instead of the RGB channel. This is safe, but then you significantly reduce the max brightness you can get from the RGB channels.

Additional context

TEST SETUP

RESULTS

White, full brightness, RGB channels only Power supply current reading: 1.40A Wled "Estimated current draw": 1.30A

White, full brightness, white channel only Power supply current reading: 1.04A Wled "Estimated current draw": 0.55A

blazoncek commented 6 months ago

Excerpt from the source code:

//DISCLAIMER
//The following function attemps to calculate the current LED power usage,
//and will limit the brightness to stay below a set amperage threshold.
//It is NOT a measurement and NOT guaranteed to stay within the ablMilliampsMax margin.
//Stay safe with high amperage and have a reasonable safety margin!
//I am NOT to be held liable for burned down garages or houses!

and

...
      if(useWackyWS2815PowerModel) { //ignore white component on WS2815 power calculation
        busPowerSum += (MAX(MAX(r,g),b)) * 3;
      } else {
        busPowerSum += (r + g + b + w);
      }

...

  if (bus->hasWhite()) { //RGBW led total output with white LEDs enabled is still 50mA, so each channel uses less
    busPowerSum *= 3;
    busPowerSum >>= 2; //same as /= 4
  }

This was by design. Do not ask me why. The error with White channel only being lit up (for SK6812) is 1/4th of the actual current. According to calculation.

Looking at this article the calculation for SK6812 may be off also due to non-linear consumption. When using RGB together with W the current draw for all LEDs is lower than having RGB or W separately lit. This is probably why the above assumption regarding current draw was made.

I understand the concerns but fuses and proper wiring and correctly sized PSUs are the only safety mechanisms. Not brightness limitation based on mathematical current consumption. The code will most likely not change in that regards.