DATA problem with the WS2812B LED Strip

Hello,

my problem is the communication between PIN6 from the controller (Arduino Uno) and DIN. I have tried FastLED and NeoPixel library, but the problem stays the same. I have written a code which should power every color (red, green, blue) of every single LED, starting with the first.

What happens is that the first LED does its job correct, but then it is the second's task, the second in the strip shows wrong colors and changes the first LED too. The third LED does the same with the second one, and then the fourth LED should do it's task, only the third changes colors.

I'm guessing the DATA words that get overhanded are like shortened with every WS2812B, since the fourth LED gets no signal to do something and the other tasks before in the strip are messed up.

Hopefully you know what's going on, thanks for reply =)

Setup:

  • Arduino Uno
  • LED strip WS2812B (4 LEDs)
  • 330 ohms resistor between PIN6 and DIN (strip)
  • 5V and GND from Uno to strip
  • Arduino IDE 1.8.4
  • Adafruit NeoPixel library

The code I use:

#include <Adafruit_NeoPixel.h>
#define PIXEL_PIN 6
#define PIXEL_COUNT 4

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
}

void loop() {
  // RGB LED1
  pixels.setPixelColor(0, pixels.Color(150,0,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(0, pixels.Color(0,150,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(0, pixels.Color(0,0,150));
  pixels.show();
  delay(1000);

  // RGB LED2
  pixels.setPixelColor(1, pixels.Color(150,0,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(1, pixels.Color(0,150,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(1, pixels.Color(0,0,150));
  pixels.show();
  delay(1000);

  // RGB LED3
  pixels.setPixelColor(2, pixels.Color(150,0,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(2, pixels.Color(0,150,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(2, pixels.Color(0,0,150));
  pixels.show();
  delay(1000);

  // RGB LED4
  pixels.setPixelColor(3, pixels.Color(150,0,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(3, pixels.Color(0,150,0));
  pixels.show();
  delay(500);
  pixels.setPixelColor(3, pixels.Color(0,0,150));
  pixels.show();
  delay(1000);
}

I can't see a fault with your sketch, but the first thing you should do is try to determine if you have a hardware or a software problem.

Have you tried some of the standard example sketches from the neopixel or fastLED libraries? Configure them for your pin and length 4 but make no other changes. Do they work?

Try changing things around. Different pin, different LEDs, different resistor. Change only one thing at a time and check the results after each change.

Also post some close-up, well lit and well focussed pictures of your circuit.

What sort of Arduino do you have? Is it one of the 3V3 types?

I've tried other pins, other segments of the light strip, and an other controller (Wemos D1 mini).

The Arduino Uno I use has an 5V and 3.3V output, I use the 5V (5.1V measured) directly because there is not that much current needed for 4 LEDs.

Attached a picture of the setup

Circuit looks OK. Maybe try putting a cap across the power connections to the strip, e.g. 10uF

Did you test the resistor? Is it truly 330R?

What happens is that the first LED does its job correct, but then it is the second's task, the second in the strip shows wrong colors and changes the first LED too. The third LED does the same with the second one, and then the fourth LED should do it's task, only the third changes colors.

I tried your code and I didn't get that. Each of the 4 LEDs go red / green / blue in turn. When it moves on, the LED that was changing stays blue, which is no surprise because you never turn the LED off after you have finished changing one.

However on that photograph you seem to be powering the LEDs off 3V3 and not 5V, that might have damaged them seeing as the data signal is 5V. The resistor does not look like a 330R because i can see at least two black bands. If it is only a very small resistor it might not have been enough to protect the strip from the over voltage of the data line.

It was a 220 ohms resistor, my fault.

Changing the resistor and adding a capacitor didn't solve the problem. I will try an other strip and write here if it works with that (same WS2812B). In my opinion its the LED strip which is maybe the malefactor.

This will take some time since the strip goes from Hongkong to Germany.

220R is fine. The exact value is not critical here, anything around 100R to 1K. I was more concerned that the resistor might have been 33K or 330K...