Hey,
I've been trying to solve this issue for like a year now.
I purchased a ws2812b led strip a while ago and I'm trying to power it with my arduino. I wrote a code that turns the leds on one by one to check if every LED is working (only one LED is on at the time). The first ~50 LED's are fine but the rest start to show random colors or even turn on together with their neighbor (two leds instead of one). I attached a GIF to this thread.
The board I have is an Arduino Uno R3 clone from ebay. The strip is 5m 300 LED WS2812B. At the moment I'm powering the strip only from the arduino.
The voltage at the point of error measures 4.6V. In the past I have tried powering the led strip from an old power supply, putting a 1000uF capacitor between the power and the ground but the issue persists. I also have a 300Ohm resistor on the data line.
Try powering the strip from both ends and at an intermediate point making sure that the wire used is thick enough to ensure minimum voltage drop across it
Thanks, it could be a memory issue on your clone. If it has some bad SRAM then it could be hitting that. Try declaring a second led array along side the first and show them one after the other. If the problem is on showing one array and not the other then that suggests a memory issue. If both work the same it suggests some sort of hardware issue.
By the way 3K is too high for the series resistor better to use 300 ohms.
Grumpy_Mike:
Thanks, it could be a memory issue on your clone. If it has some bad SRAM then it could be hitting that. Try declaring a second led array along side the first and show them one after the other. If the problem is on showing one array and not the other then that suggests a memory issue. If both work the same it suggests some sort of hardware issue.
By the way 3K is too high for the series resistor better to use 300 ohms.
I have tried that, both arrays give the same result. The resistor I'm using is 330 ohm, it just looks like a zero but it's a letter O.
I have attached the power supply I was talking about at the start of the strip. I still turn on LED's one by one (not all of them).I have connected arduino ground pin to power supply ground. The voltage measures 5V both at the beginning and towards the end. The problem persists, those further leds display random colors or light up 2 at a time.
The point is that the LED strip draws current - about 1 mA per LED so about 300 mA in total - when no LEDs are illuminated, so if you were to connect it to an Arduino "5V" pin while it is powered through the USB connector, you are drawing 300 mA plus the Arduino consumption before you even light any LEDs, The UNO has a polyfuse rated at 500 mA, so you are approaching that limit and if you start lighting LEDs - 56 mA each at full white - you can easily overload the fuse.
People are often misled by the suggestion that you can power the UNO via the "barrel jack" or "Vin". Well, you can if you want to connect nothing else apart from a couple of indicator LEDs. Even at only 9 V input to the "barrel jack", 300 mA drawn from the "5V" pin will generally overload (overheat) the regulator on the UNO which has negligible heatsinking, causing it to shut down partially or completely.
Paul__B:
The point is that the LED strip draws current - about 1 mA per LED so about 300 mA in total - when no LEDs are illuminated, so if you were to connect it to an Arduino "5V" pin while it is powered through the USB connector, you are drawing 300 mA plus the Arduino consumption before you even light any LEDs, The UNO has a polyfuse rated at 500 mA, so you are approaching that limit and if you start lighting LEDs - 56 mA each at full white - you can easily overload the fuse.
People are often misled by the suggestion that you can power the UNO via the "barrel jack" or "Vin". Well, you can if you want to connect nothing else apart from a couple of indicator LEDs. Even at only 9 V input to the "barrel jack", 300 mA drawn from the "5V" pin will generally overload (overheat) the regulator on the UNO which has negligible heatsinking, causing it to shut down partially or completely.
Thanks for pointing that out. However, as you can read in my comment #5, I have attached a power supply to the strip, which is rated at 5V 18A. I have connected the grounds but the issue still persists. ----------------------------------
If I create a program that turns on LED's one at a time, the point at which the leds go random is around the middle, however, if I launch an example program like "color palette", only the first ~20 LEDs are good, the others are random (the point of error is closer to the beginning).
You set the strip up as "GRB" but choose a colour as "CRGB" - why is that?
Sorry I did not update the code after my comments.
It now steps from 0 to 300 (start to end).
I use CRGB as it is an easy way to get colors from the FastLED library. I believe it has nothing to do with the problem as it sets the color correctly (for the first ~100LEDs as the other leds show random colors)
Hey, sorry for bumping this up. I tried to power up the strip using another arduino clone, however with same results.
If I set ALL led's to be white, it works quite fine, every one of them lights up white.
However, any other color or setting them on one by one and the issue comes back. If I set all leds to red, only first ~20 light up red, others just flash random colors. I'm really at a loss by now, could the strip be defective? Should I try to cut it in half to see if it works without the beginning?
If you want to try that without actually cutting the strip, just de-solder the data wire from the start of the strip and solder it, or maybe just touch it, to the pads half way along the strip.
I cut the strip in half and soldered everything from the new end, results are the same. I guess the problem is in the board itself, maybe it's sending corrupted data.
Beg, steal or borrow a board with different model or manufacturer to find out for sure. Seems like quite a coincidence to me that both faulty boards fail the same way.
UPDATE:
Got this fixed, it works flawlessly now. What I did is get another board from another manufacturer (which is still a clone but looks like the original uno, does not require extra drivers).