WS2812B LEDs powered by Arduiono go crazy

Hello everybody,
I'm totally new to the arduino stuff and also on using LEDs and I really need help, because I don't understand this problem at all.

First of, I'm trying to reattempt this project http://www.instructables.com/id/Make-Your-Own-10x10-LED-Matrix/ which consists of using LEDs to build a frame that is controllable by an arduino.

I already soldered all LEDs into place and bought a fitting power supply (see attachement 3).

I then tried running a simple test code

    #include <FastLED.h>
    #define NUM_LEDS 100
    
    #define DATA_PIN 6
        CRGB leds[NUM_LEDS];

        
void setup() {
  // put your setup code here, to run once:
FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);
}

void loop() {
  // put your main code here, to run repeatedly:
        for(int dot = 0; dot < NUM_LEDS; dot++) { 
            leds[dot] = CRGB::Blue;
            FastLED.show();
            // clear this led for the next time around the loop
            leds[dot] = CRGB::Black;
            delay(30);
        }
}

which works just fine, all LEDs light up after each other.

But if I change the color to for example red, all LEDs light up after each other, but in green.
If I change the color to green, they just go crazy:

I first tried to power the with my PSU (see attachment 3 and 5) , but they only started blinking and doing random stuff, the PSU also made weird noises, so I power them now with my arduino and USB until the capacitor and resistor arrives (which I read about here FastLED WS2812B not displaying correct LEDs - LEDs and Multiplexing - Arduino Forum).

I hope you can help me solving this problem and could explain, why blue works and red gives me problems which I absolutely don't understand.

Thanks in advance.

I somehow can't upload the pictures, I always get
413 Request Entity Too Large, so they can be found here:
[1]https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/1-min_1.jpg
[2]https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/2-min_1.jpg
[3]https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/3-min_1.jpg
[4]https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/4-min_1.jpg
[5]https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/5-min_1.jpg
[6]https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/6-min_1.jpg

Are you sure the power supply was 5v ?
Perhaps you have damaged the leds ?

WS2812B's are GRB, not RGB

FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);

should be

FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

Do you have a ground wire from your power supply connected to Arduino ground?

First of, I'm trying to reattempt this project http://www.instructables.com/id/Make-Your-Own-10x10-LED-Matrix/

Most instructables are crap and this is no exception. There is no resistor between the data pin and the LEDs, also there is no large capacitor across the supply.

Read how to do it properly here:-

There ought to be a law banning this crappy site.

mcnobby:
Are you sure the power supply was 5v ?

Yes, my power supply is definitely rated at 5V:
https://dl.dropboxusercontent.com/u/47611022/Arduino_Bug/3-min_1.jpg

INTP:
WS2812B's are GRB, not RGB

FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);

should be

FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

Do you have a ground wire from your power supply connected to Arduino ground?

Thanks for the tip, I also noticed that when I ran an example script by FastLED, but this also doesn't solve my problem unfortunately.

Grumpy_Mike:
Most instructables are crap and this is no exception. There is no resistor between the data pin and the LEDs, also there is no large capacitor across the supply.

Read how to do it properly here:-
Basic Connections | Adafruit NeoPixel Überguide | Adafruit Learning System

There ought to be a law banning this crappy site.

I also read about the resistor and capacitor on another thread in this forum and already ordered them. Is it likely that this will solve my problem, or could my WS2812B LEDs already have been damaged by running the project without these components?

Blinking and going crazy is a symptom of a power supply issue. If only certain colors run as they should, then your program is essentially fine.

INTP:
Blinking and going crazy is a symptom of a power supply issue. If only certain colors run as they should, then your program is essentially fine.

Ok, thanks for your answer.
I will then just wait for the capacitors to arrive and see whether that solves my problem or not :slight_smile:

oh and btw:
Is there a certain orientation in which the capacitors or resistors have to be soldered on?

I frankly wouldn't pin too much hope on that, the power brick should have enough regulation in it. How are you physically plugging/unplugging the power to the leds, brick to wall or brick to leds?

I connect/disconnect the PSU directly to the leds, I don't unplug the whole power supply from the wall each time. Should I rather do that?

Would've been quicker just to try it, no?

It doesn't make any difference wheter I connect/disconnect the PSU directly to the LEDs or to the power.

Okay, gonna have to take it really slow then.
Remove the for loop from the code, extend the delay, and manually manipulate the led number and colors.
So, be able to turn on an led to different colors. It's a good learning exercise to lead into making your own animations, but can help with troubleshooting, too.

Is there a certain orientation in which the capacitors or resistors have to be soldered on?

Resistors no, electrolitic capacitors yes.

If you get a capacitor the wrong way round it will explode.

The capacitors are marked with + and - to show you the right way to connect it. Sometimes however, just the - is marked.

Hi,
sorry for the late response, I had to wait for the resistors and capacitors to arrive.

I already figured out a solution by powering each LED after each other and when I toggled one LED, others changed their colors and went crazy. After replacing the failing LEDs, everything works fine now.

Thanks for your answers!

Btw: Soldering in the capacitors worked fine, but when I add a resistor, the LEDs receive no signal from my Arduino.. :frowning:

but when I add a resistor, the LEDs receive no signal from my Arduino

You sure you got the right value, between 220 and 510 Ohms not K Ohms?

Yes, my resistors have a value of 470 Ohm
I'm actually powering the LEDs without it and it works just fine.
What's the purpose of the resistor again?

The purpose of the resistor is to keep component and board manufacturers from making more money when you have to buy new components because you run too much current through them.

The resistor has two purposes:-

  1. To limit the current if the drive signal is above the LED strip's supply voltage. This happens frequently because most people do not use a correctly rated power supply.

  2. To absorb reflections due to the rapid changing output signal and impedance discontinuity.

If putting a 470R resistor in line with the data signal stops the strip working you have something else seriously wrong with your setup.

Hi,

after a second try, the resistor worked well and I was finally able to finish my project.

Thank you so much for your help and assistance :slight_smile: