Problem with powering WS2812B

Hello, my first post here, please be gentle :slight_smile:

As a complete newbie in terms of overall electronics, Arduino etc. I have challenged myself to construct a prop, a “lightsaber” to be specific. I have decided to use 2 meters of 144 LED/1m WS2812B LED strips, control them with an Arduino Nano and power the whole thing with a stable 5V power source-a power bank.(As to not play around with batteries). Additionally, the power bank seems to be a good option considering the project portability and an easy way to recharge it. After a little struggle I have come up with a schematic visible in the attached image. It consists of a power source, 1000μF 6.3V capacitor, slide switch to toggle power, Arduino Nano, a push button to change effects on the LEDS, two WS2812B LED strips (144 leds each), two 470ohm resistors on the data wires.

The problem: Everything runs as it should (in 95%, the 5% is to be described at the end*) on my “big” 13000mAh (5V/2.1A output) powerbank, but it does not on my project-default “small” 2600mAh (5V/1A output) power bank. After connecting everything to the small powerbank, the LEDS and the Arduino flicker/blink for a milisecond and the powerbank turns off. I thought it had something to do with the output amps, but I dig up a third powerbank, 6000 mAh, with 2 output ports, one 2.1A and one 1A. No problems occured after connecting everything to the 1A output port, the Arduino and the LEDS worked as they should.

I really try to avoid using batteries as the power source. Everything (except the led strips) have to fit in a 27cm long tube, with 2.9cm inner diameter. That is why I had searched for a cylindrical, max 2.9 cm diameter powerbank.

I doubt there is something wrong with the sketch but here it is:

#include <FastLED.h>
#include <EEPROM.h>
#define BUTTON 2
byte selectedEffect=0;
#define NUM_LEDS_PER_STRIP    144
#define LED_TYPE    WS2812B
#define COLOR_ORDER RGB
#define BRIGHTNESS  64

CRGB leds[NUM_LEDS_PER_STRIP];

void setup() 
{
  FastLED.setMaxPowerInVoltsAndMilliamps(5,1000); 
  FastLED.addLeds<LED_TYPE, 4>(leds, NUM_LEDS_PER_STRIP);
  FastLED.addLeds<LED_TYPE, 7>(leds, NUM_LEDS_PER_STRIP);
  FastLED.setBrightness(BRIGHTNESS);
  digitalWrite (BUTTON, HIGH);  // internal pull-up resistor
  attachInterrupt (digitalPinToInterrupt (BUTTON), changeEffect, CHANGE); // pressed
}

void loop()
{
EEPROM.get(0,selectedEffect); 
   if(selectedEffect>5)
   { 
    selectedEffect=0;
    EEPROM.put(0,0); 
   } 
    
switch(selectedEffect) 
{
  case 1 :
  {
    black();
    break;
  }
    
  case 2 : 
  {
    red();
    break;
  }
  case 3 :
  {
    blue();
    break;
  }
  case 4 :
  {
    green();
    break;
  }
  case 5  :
  {
    purple();
    break;
  }
  case 6  :
  {
    gold();
    break;
  }
}
}
void changeEffect()
{
  if (digitalRead (BUTTON) == HIGH) 
  {
    selectedEffect++;
    EEPROM.put(0, selectedEffect);
    asm volatile ("  jmp 0");
  }
}

    
    
void red()
{
    for(int i=0;i<NUM_LEDS_PER_STRIP;i++)
      {
        leds[i].setRGB(255,0,0);
        FastLED.show();
      }
}

void blue()
{
    for(int i=0;i<NUM_LEDS_PER_STRIP;i++)
      {
        leds[i].setRGB(0,0,255);
        FastLED.show();
      }
}

void green()
{
    for(int i=0;i<NUM_LEDS_PER_STRIP;i++)
      {
        leds[i].setRGB(0,255,0);
        FastLED.show();
      }
}
void purple()
{
    for(int i=0;i<NUM_LEDS_PER_STRIP;i++)
      {
        leds[i].setRGB(191,62,255);
        FastLED.show();
      }
}
void black()
{
  leds[NUM_LEDS_PER_STRIP] = CRGB(0, 0, 0);
  FastLED.show();
}
void gold()
{
 for(int i=0;i<NUM_LEDS_PER_STRIP;i++)
      {
        leds[i].setRGB(255,215,0);
        FastLED.show();
      }
}

Additionally, as it may give someone a little hint, I have observed that when only one of the two led strips was powered by the small power bank the whole thing worked.

The problem here may prove trivial to you but as I said it is a personal challenge, I had never before done anything like it, nor had I have any expierence with any sort of electronics (including soldering haha). Everything present here was learned bit by bit with the help of oh the glorious internet. After searching for some time, unsuccessful in finding the answer on various forums I come here for your help. If some solution already exists posted somewhere then shame on me.

I hope there is nothing technically wrong with the post itself and I really hope someone will find a solution, something that I am missing here. Thanks in advance :slight_smile:

*when everything is connected to the working power bank and power is turned on all of the leds turn full white for ~0.01 seconds. After that the program from Arduino kicks in. It is not a big problem personally, as it is hard to spot anyway, but if anyone have a solution for that as well I will be glad :slight_smile:

Apply the power at both ends of the strips.
A power bank is made for charging batteries not supplying large amounts of current.
Never ever connect two or more power banks in parallel like that. You might think it is working but is a great way to cause a fire.

1 Like

Thank you for replying,

Grumpy_Mike:
Apply the power at both ends of the strips.

Do you mean to connect it as in the updated attached file?

Grumpy_Mike:
A power bank is made for charging batteries not supplying large amounts of current.
Never ever connect two or more power banks in parallel like that. You might think it is working but is a great way to cause a fire.

I don’t quite understand as I am always using only one power bank at a time, never two or more. Or is that a reference to the previous sentence and an advice to actually not using power bank at all in this project?

Do you mean to connect it as in the updated attached file?

Better but I would also add a direct connection to the far end of the strip as well where one strip’s power is fed into the end of the other strip.

Sorry I thought you mentioned connecting two power banks at once.

The way a power bank works is that the batteries are connected to a a circuit that converts one DC voltage to another. These circuits are known as DC to DC converters or buck or boost circuits depending if the output is lower than the input voltage ( buck ) or if the output is higher than the input voltage ( boost ).

The actual battery capacity has no effect on how much current the power bank can supply, it is the circuit of this DC/DC converter that controls that. The other factor is that the LEDs do generate a hell of a lot of interference when they are running and this interference can get into the DC/DC converter and interfere with it’s smooth operation. Different designs of the electronics in different power banks will have different responses to the same amount of interference.

Now to a certain extent that large capacitor on the power input of the strip will help, although I notice on your “diagram” that this capacitor is wired up backwards. The white stripe down the side should be connected to the negative wire, but this might just be a mistake in the “diagram”. These sorts of things ( Fritizing physical layout diagrams ) are not very welcome here because of exactly these sorts of issues. You could also add a 0.1uF ceramic capacitor in parallel with the large one to handle the high frequency noise.

But you have 288 LEDs and at a maximum of 60mA per LED that is a current of just over 17 Amps which in no way can you supply from a power bank. I would set a brightness limit in the software, I see you have one of 64 which is a quarter of the current and that still gives you a maximum current of 4.32 Amps so to get current down to 1A you have to limit the brightness to 16.

when everything is connected to the working power bank and power is turned on all of the LEDs turn full white for ~0.01 seconds. After that the program from Arduino kicks in.

Yes sometimes this happens. I have found this to be a pinky white colour but it will mean you are way overloading your power supply briefly. I did read some on advised you to put a 10K resistor to ground on each of the data output pins from the nano, but I have not tried this myself so can’t say if it works or not.

288 WS18B20 LEDs need 288 * 0.05 = 14.4A at full brightness. You offer a mere 7% of that power, that’s about what those LEDs take when almost completely off. No wonder your power bank craps out on you!

It’s also not a case of “power it from both sides”. It’s a case of “add a beefy parallel power wire and connect power to the strip at every ~50 LEDs”.

You can power this with multiple power banks, but not in parallel. Cut the 5V strip, leave the ground strip connected. One parallel ground wire to all the power points; separate 5V wires from each power bank to their respective sections.

A quality power bank is also recommended for long time high current draws, or when you want to actually get the rated power from them. El-cheapo power banks will offer 50-70% of rated capacity, if you’re lucky.

Grumpy_Mike:
You could also add a 0.1uF ceramic capacitor in parallel with the large one to handle the high frequency noise.

May not do much if anything - at least on my WS18B20 strips every single LED has it’s own capacitor on the strip, mounted right next to it. Of course no value given, I assume it’s 100 nF. That should take care of (most of) the high frequency noise. But tbh I’ve never attached my scope to the power lines.

May not do much if anything

I wouldn't disagree with that.

at least on my WS18B20 strips every single LED has it's own capacitor on the strip

Yes that is what I have normally seen. But the last LED strip I got only had a capacitor on one LED for every 16 LEDs.