Neopixel LEDs turning off if more than a few used simultaneously(ESP32-WROOM-32)

Hi all and a happy new year.
I am pretty new to the scene and running into an issue that I have spent a couple of days googling/searching for answers on:

Board: Az-Delivery ESP32-WROOM-32
Arduino IDE: 1.8.13
LEDs: BTF-LIGHTING WS2812b
Power: A 12V configured supply from Amazon, via an Elegoo power mb v2 into my breadboard (See attached image)

I am running a simple piece of code to try and turn on all the lights of the strip, and keep them on (as a basis for something more advanced). When I turn on say 10 LEDs, it works as designed and the LEDs turn on and remain on, but when I turn on say >20 (haven't found exact breaking point but I assume it doesn't matter) the lights turn on briefly then turn off.

Have attached picture of setup, but there isn't much to it!

Code that causes the fail is commented:

#include <Adafruit_NeoPixel.h>
bool lightsOn = false;

// Define strip
Adafruit_NeoPixel ledStrip = Adafruit_NeoPixel(60, 25, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(115200);
  ledStrip.begin();
  ledStrip.show();
}

void loop() {
  if (lightsOn != true) {
    Serial.println("Turning lights on");
    ledStrip.setPixelColor(0, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(1, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(2, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(3, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(4, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(5, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(6, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(7, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(8, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(9, ledStrip.Color(255,0,0)); // Red
    ledStrip.setPixelColor(10, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(11, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(12, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(13, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(14, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(15, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(16, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(17, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(18, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(19, ledStrip.Color(255,0,0)); // Red
//    ledStrip.setPixelColor(20, ledStrip.Color(255,0,0)); // Red
    ledStrip.show();
    lightsOn = true;
  }
}

Its probably something very daft but no end of searching has found an answer, most people seem to have issues turning things off! I do have another LED strip to test, but wanted to ensure I wasn't doing anything breaking first if possible. Please help! Thanks :slight_smile:

I imagine there is not enough current capability in your power supply or the way you are wiring it up.
I see you have no capacitor across he strip input,

You also seem to be running the power through a solderless bread board, bad idea because you get too much voltage drop across it.

What is probably happening is that as the current requirement increases the output is sagging and causing the LEDs and your processor to shut down. Also the ESP32 only produces 3V3 signals which is not enough to drive it correctly.

Can you post a link to your strip so we can check the voltage it needs.

Thanks for the response.
Is a capacitor necessary/recommended? (I imagine I need to do some more reading up but any advice appreciated).

Led strip: https://www.amazon.co.uk/dp/B01CDTEE5W/ref=twister_B077YY6B3Z (It is the 1M, 60 LED, IP65 variant)

OK, it's pretty simple. :grinning:

That "MB102 power supply module" is severely limited by the (absence of) heatsinking of its regulator, in the same manner as the on-board regulator on the older Arduinos. If you load it with more than a few of your 55 mA LEDs, it overheats and shuts down.

You can use it to supply 5 V to a few logic ICs or an ATMega328 chip and a few indicator LEDs at 10 or 20 mA each. That is its purpose. If however you need to power something that does not fit on the breadboard or requires more than 100 mA, then you need a suitable power supply. If you can find the (male "A") adapter to the USB connector, you can plug an actual 5 V power supply such as a "phone charger" into the USB port on the MB102 power supply module and have it reticulate that 5 V to the side rails on the motherboard up to 500 mA or a little more; this is its purpose - a convenient power adapter; not a power "supply". :grinning:

This version for example has a mini USB connector for which you might find a matching "phone charger":

Of course, 60 LEDs at 55 mA each full white would be 3.3 Amps, for which you need a much more serious power supply connected directly and you will need to connect that 5 V supply (with ground) to both ends of the strip to avoid colour distortion at higher brightness levels due to loss of voltage along the relatively flimsy foils in the strip.

Paul - thanks for the info, very useful! I do actually have one of the connectors you showed so will try a direct supply to the lights.

One thing though is that it may also be worth noting that things like the Strandtest example script: Adafruit_NeoPixel/strandtest.ino at master · adafruit/Adafruit_NeoPixel · GitHub work absolutely fine, and there are a number of parts of these demonstrations that involve powering all 60 LEDs simultaneously. I can't see any obviously difference, other than that they are changing something on every single loop execution

Can confirm that using a direct supply has solved the problem for me, thanks Paul and Mike for the help. If you have any ideas as to the above though I would still be interested to learn.

Many thanks,
Josh

Your link to the code is bad so I can’t say.

Fixed, the ) got caught up in the link...

Thanks. The reason why this code works and yours didn’t is because of this line in the setup function

   strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)

So this sets up the current consumption to be a lot lower than your code.
Also because it is lower current you get a lower voltage drop caused by your bread board and the thin foil connectors used in the strip. It is always best powering these strips from both ends.

Your earlier comment of

is a capacitor necessary/recommended?

Can be answered by reading the comments at the start of the code.

Mike - big thanks for looking into it! The brightness aspect makes sense, I didn't even think of that, and regarding the capacitor I will have a closer look and work it all out.

Cheers again for the help