WS2812B led strip flickering

Hello.

I recently bought a 300 LED strip (WS2812B 5meters)
As in tutorials, I plugged the DATA pin to my arduino pin 6, +5V to my power supply and the ground to both arduino and power supply.

I use my computer's power supply, the specification says the 5V pin outputs 18A so I should be good as long as it comes to current.

The problem is, whenever I upload the FastLED code, only the first 10-15 LED's light up properly, the rest just flicker random colors.

What could be the problem?

P.S. I connect everything using arduino jumper wires, I heard that they cannot provide such current so the LED's flicker for that reason. Could that be it? Do I need thicker wires?

No resistor, no capacitor, see this for best practice

You should at least power the strip at both ends.
Using 300 LED require 18A, no hook up wire is not good enough try something thicker. Don’t use solderless bread board, and check the voltage when running.

Possible, jumper wires will probably drop the voltage A LOT. And 300 is a lot and neopixels like a lot of power. I would at least use 2,5mm2, run it parallel to the strip, connect at least every meter and run both ends back to the power supply.

Don't forget to add a resistor in the data-line of the first led to protect it.

Here is a video of the problem:

Could it be related to the code or the arduino itself? All leds are glowing, its just that they flicker random colors instead of a pattern.

I still think the lack of power may cause those leds down the line to reset and thus flicker.

nedaso:
Here is a video of the problem:
https://www.youtube.com/watch?v=y2KNjBuj6NU

Could it be related to the code or the arduino itself? All leds are glowing, its just that they flicker random colors instead of a pattern.

So ignoring reply #1 then. Good luck.

I added a 330R resistor on the data wire, as well as a 1000uF capacitor on the power supply. I ran a code to turn all LED's white, but only first 10-15 LED's turn white, then they start going yellow and red at the end. I connected the end of the strip back to the power supply, and that end is now also white. It's just the middle that's yellow. So I guess I need a couple more connections at the middle.

However, when I ran a code to turn all LED's blue, only first 10 lit up blue, others lit up absolutely random colors, including the end of the strip (which is also connected to the power supply). Is this supposed to happen until I connect middle segments to the power supply?

Also, is 2.5mm^2 wire really required for the power? It's pretty thick, and running 2 wires (positive and ground) across the entire strip seems too bulky.

If you can turn the strip white then there is nothing stopping you from turning it blue, because when an RGB LED is showing white all of the LEDs are showing at maximum brightness.
What sort of Arduino are you using?
You could have a problem with your timing, have you checked you are specifying the right drivers for the strip you have?

but only first 10-15 LED's turn white, then they start going yellow and red at the end. I connected the end of the strip back to the power supply, and that end is now also white. It's just the middle that's yellow.

That suggests your wiring or your power supply is very poor. Have you checked the power supply voltage when it is running the code?

"It's just the middle that's yellow."

So connect the middle to the power supply as well.

Either the supply is poor, or the power/gnd traces on the strip are poor, or the strip is too long for the traces.

nedaso:
It's just the middle that's yellow. So I guess I need a couple more connections at the middle.

Correct deduction. As you lose voltage, the blue LEDs which require the highest voltage, are lost first, followed by the green and the last to fade are the reds.

Precisely as you would expect from sagging voltage.

nedaso:
However, when I ran a code to turn all LED's blue, only first 10 lit up blue, others lit up absolutely random colors, including the end of the strip (which is also connected to the power supply). Is this supposed to happen until I connect middle segments to the power supply?

Random colours indicate that the data itself is failing to get through in a valid form.

nedaso:
Also, is 2.5mm^2 wire really required for the power? It's pretty thick, and running 2 wires (positive and ground) across the entire strip seems too bulky.

Tough ti^^ies! :astonished:

2.5 mm2 is (most likely) what is required in your house wiring for 18 Amps or so and that can tolerate a couple of volts drop. 5 V systems cannot tolerate a couple of volts drop.

You wanted to use a strip which requires serious power (current) and the relatively flimsy foil on these strips simply cannot manage such current (it is probably getting rather warm, too!).

Yep, everybody is right :slight_smile: And what you told definitely makes me belief it's just the power drop that's causing it all. So yeah, 2,5mm2 (of which you connect both ends to the power supply) pretty much is the minimum.

Thanks to all of you for your responses.
I uploaded another video:

This time I'm running only 30 LED's and I still have problems.

I'm new at electronics so this is a total mindf**k for me...
As seen in the video, the last 2 LED's sometimes flash random colors, which is not supposed to happen...
I'm running them only on very little brightness, so the current should not even exceed 0.5A.

Also, I'm using an arduino uno r3 clone for the controller.

This is the code:

#include <FastLED.h>

#define LED_PIN     6
#define NUM_LEDS    30
#define BRIGHTNESS  10
#define LED_TYPE    WS2812B
#define COLOR_ORDER RGB
CRGB leds[NUM_LEDS];

#define UPDATES_PER_SECOND 100


CRGBPalette16 currentPalette;
TBlendType    currentBlending;

extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;


void setup() {
    delay( 3000 ); // power-up safety delay
    FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
    FastLED.setBrightness(  BRIGHTNESS );
    
    currentPalette = RainbowColors_p;
    currentBlending = LINEARBLEND;
}


void loop()
{
    ChangePalettePeriodically();
    
    static uint8_t startIndex = 0;
    startIndex = startIndex + 1; /* motion speed */
    
    FillLEDsFromPaletteColors( startIndex);
    
    FastLED.show();
    FastLED.delay(1000 / UPDATES_PER_SECOND);
}

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
    uint8_t brightness = 255;
    
    for( int i = 0; i < NUM_LEDS; i++) {
        leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
        colorIndex += 3;
    }
}

void ChangePalettePeriodically()
{
    uint8_t secondHand = (millis() / 1000) % 60;
    static uint8_t lastSecond = 99;
    
    if( lastSecond != secondHand) {
        lastSecond = secondHand;
        if( secondHand ==  0)  { currentPalette = RainbowColors_p;         currentBlending = LINEARBLEND; }
        if( secondHand == 10)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
        if( secondHand == 15)  { currentPalette = RainbowStripeColors_p;   currentBlending = LINEARBLEND; }
        if( secondHand == 20)  { SetupPurpleAndGreenPalette();             currentBlending = LINEARBLEND; }
        if( secondHand == 25)  { SetupTotallyRandomPalette();              currentBlending = LINEARBLEND; }
        if( secondHand == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
        if( secondHand == 35)  { SetupBlackAndWhiteStripedPalette();       currentBlending = LINEARBLEND; }
        if( secondHand == 40)  { currentPalette = CloudColors_p;           currentBlending = LINEARBLEND; }
        if( secondHand == 45)  { currentPalette = PartyColors_p;           currentBlending = LINEARBLEND; }
        if( secondHand == 50)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
        if( secondHand == 55)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = LINEARBLEND; }
    }
}

void SetupTotallyRandomPalette()
{
    for( int i = 0; i < 16; i++) {
        currentPalette[i] = CHSV( random8(), 255, random8());
    }
}

void SetupBlackAndWhiteStripedPalette()
{
    // 'black out' all 16 palette entries...
    fill_solid( currentPalette, 16, CRGB::Black);
    // and set every fourth one to white.
    currentPalette[0] = CRGB::White;
    currentPalette[4] = CRGB::White;
    currentPalette[8] = CRGB::White;
    currentPalette[12] = CRGB::White;
    
}

// This function sets up a palette of purple and green stripes.
void SetupPurpleAndGreenPalette()
{
    CRGB purple = CHSV( HUE_PURPLE, 255, 255);
    CRGB green  = CHSV( HUE_GREEN, 255, 255);
    CRGB black  = CRGB::Black;
    
    currentPalette = CRGBPalette16(
                                   green,  green,  black,  black,
                                   purple, purple, black,  black,
                                   green,  green,  black,  black,
                                   purple, purple, black,  black );
}

const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
    CRGB::Red,
    CRGB::Gray, // 'white' is too bright compared to red and blue
    CRGB::Blue,
    CRGB::Black,
    
    CRGB::Red,
    CRGB::Gray,
    CRGB::Blue,
    CRGB::Black,
    
    CRGB::Red,
    CRGB::Red,
    CRGB::Gray,
    CRGB::Gray,
    CRGB::Blue,
    CRGB::Blue,
    CRGB::Black,
    CRGB::Black
};

I'm curious, if you have used an DVM to ohm out the led strip? With the ohm meter connected to ground pins on each end, what is the reading? Flex the strip does the reading fluctuate? Do the same thing with the V+ and signal line.

Idahowalker:
I'm curious, if you have used an DVM to ohm out the led strip? With the ohm meter connected to ground pins on each end, what is the reading? Flex the strip does the reading fluctuate? Do the same thing with the V+ and signal line.

Unfortunately I do not have a multimeter or a voltmeter to check the readings...

OK, best put aside your electronics projects and take up knitting until you get a multimeter. Seriously! :astonished:

Frankly, a $5 one on eBay or I understand in the US, "Home Depot", will do just fine for this sort of work.

Actually, get two of the cheap ones so you can observe two things without changing connections.

(Now just what is bizarrely wrong about that image?)

Paul__B:
OK, best put aside your electronics projects and take up knitting until you get a multimeter. Seriously! :astonished:

Frankly, a $5 one on eBay or I understand in the US, "Home Depot", will do just fine for this sort of work.

Actually, get two of the cheap ones so you can observe two things without changing connections.

(Now just what is bizarrely wrong about that image?)

You're right, I should definitely get one. However I can't find cheap ones that could measure more than 10 amps

You're right, I should definitely get one. However I can't find cheap ones that could measure more than 10 amps

You can measure the voltage at various points along the strip.

Current measurement isn't common anyway. Usually we calculate or estimate it... I work in electronics and I measure voltage & resistance "every day" but I can't remember the last time I measured current with a multimeter. (My bench power supplies at work have built-in current meters so I do keep an eye on it.)

Current measurement is a pain because you have to break the circuit and insert the meter.

Plus, it's a little "dangerous" because in current-mode the meter is essentially a short circuit so if you connect the meter wrong (or if you forget it's set-up to measure current) you can fry your electronics or blow the fuse inside the meter. That's why most meters have a separate connection for current measurement... It makes it less-likely to accidently short something out.

A multimeter is essential if you are an electronics hobbyist (or professional :wink: ). If you are just doing one project you may not need one... Unless you have problems and you need to troubleshoot...

And I agree, a cheap meter is better than no meter. In most applications it doesn't have to be super-accurate. My (home) meter isn't "cheap" but it doesn't have a low voltage (millivolt) AC range so I may upgrade at some point.

nedaso:
You're right, I should definitely get one. However I can't find cheap ones that could measure more than 10 amps

Multimeters are not really useful for higher current, some can handle 20A for a short time (A couple of seconds).
If you want to measure 10A or more for more than 30 seconds get a clamp meter.
This one is fairly cheap and fairly good: Review of UNI-T UT210E

But for more general purpose a clamp meter is not as good as a real multimeter, there a cheap meter like this is better: Review of Aneng AN8009

So is it really a voltage issue? Seems weird as I do not see any dimming at the end, also the entire strip is lit at different colors (blue included, which draws the most amps)

I have played with 1 meter 144 led strips (WS2812B and others) and they worked without capacitors (I will not recommend this, but at that time I was testing and if anything had been unstable I had capacitors within easy reach), I just used a good power bench supply for the 5 volt.
What is important is that Arduino GND, LED GND and power supply minus/GND is well connected. For strips with separate power wires it is easy enough, you just connect the supply to the two power supply wires and the Arduino to the GND and data on the 3 data wires.