Help needed with code for WS2813

Hello,

I am working with the following LED strip:

The setup I use is the same as in the description in the link. A capacitor on + and -, a resistor between pin 6 and the data line.

And I have some trouble controlling the LEDs, the code I use is down below. It does not send the correct data to the LEDs, each LED has a different color, and some LEDs are triggered multiple times. With NUM_LEDS 7, it uses 6 LEDs, and one LED is used twice with a different color.

I am using the latest version of FastLED: 3.5.0. This does not include the WS2813 LEDs. I have tried NEOPIXEL, WS2812, WS2812B, but this does not fix my problem.

Swapping the data wires with pin 6 and ground, or connecting both data wires to pin 6 also does nog fix my problem. I couldn't find other ways to fix it.

Does anyone have experience with this type of LED strip and knows how to fix it?

#include <FastLED.h>
#define NUM_LEDS 7
#define DATA_PIN 6

CRGB leds[NUM_LEDS];

void setup() {
  // put your setup code here, to run once:
  FastLED.addLeds<NEOPIXEL, 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(500);
  }
}

To use FaslLED with 2813 you have to indicate led type to the library:

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

I'm sorry, in my haste I made a small error in my text. When using the ws2813, it still acts as described in the text

First of all an actual schematic (not Fritzing) is really helpful. Even when drawing you may find something that is not correct, and we can see what you have done.

I think that is the basic setup, or the backup line can be connected to GND.

I never use FastLED, but it should do the trick regardless.
Mind you the Data Transfer table in the datasheet doesn't look right to me.
Anyway try NeopixelBus, it claims to support WS2813, and i am confident that it does (The author doesn't claim things that it doesn't do)

Where are you getting power for the WS2813? Six LEDs at maximum white (R+G+B) should be powered externally (not with the Arduino 5v pin).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.