Go Down

Topic: ws2812b not working (Read 566 times) previous topic - next topic


So I'm trying to get a strand of ws2812b but I've been having no luck most of the day... This is also my first project so I don't know if I broke something or my Arduino/strand was just faulty...

I'm using Arduino as a power source cause I'm only trying to get 3 led's blinking at this time...

So I have Pin 3, GND, and 5.5V filled on the Arduino... I tried many different pins, tried all grounds, and tried adding an extra 5 volt power supply and still nothing...

Code: [Select]
#include <FastLED.h>

// How many leds in your strip?
#define NUM_LEDS 3

// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 3
#define CLOCK_PIN 13

// Define the array of leds

void setup() {
      // Uncomment/edit one of the following lines for your leds arrangement.
      // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
    FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
      // FastLED.addLeds<APA104, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<P9813, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<APA102, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<DOTSTAR, RGB>(leds, NUM_LEDS);

      // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);

void loop() {
  // Turn the LED on, then pause
  leds[3] = CRGB::Red;
  // Now turn the LED off, then pause
  leds[3] = CRGB::Black;

Heres a picture of what I have...
Blue= data pin 3 (no luck when adding a resistor)
Black = ground
Pink = 5.5V

Can someone point me into the right direction on what I'm doing wrong? I also tried the adafruit strand test... no luck either


Aug 28, 2018, 11:04 pm Last Edit: Aug 28, 2018, 11:05 pm by 3dprinter
I do not know of the FastLED library. I used the code snippets described here
I needed to user the newer setup routines - and a fragment of the loop. The array R, G,  B contain values which "scroll" along the two pixel line - this was just a quicky test code, not meant to be pretty.
Code: [Select]
#include <SPI.h> // H/W uses pin 13, 12, 11, 10, pin 11 is MOSI output
void setup() {
  SPI.begin ();
  SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE3));
void loop() {
  static int i ;
// NB: *all* pixles for the entire string must follow "immediatly" after each other
  sendPixel (R[i],G[i],B[i]); 
  sendPixel (255-R[i],255-G[i],255-B[i]);  // even the little expression here is "suspect"
  show ();
  i++ ; if ( i>=sizeof(R)-1 ) i=0 ;


Code: [Select]
leds[3] = CRGB::Red
But you only have three LEDs according to your code. Index values, the part in the [ ] brackets run from zero to one less than the number of leds you have. So use the numbers 0 or 1 or 2, but not 3.


change the 3 to 2's... Now my Arduino has L, TX, RX, and On lit up... nothing on the strand yet though


That does not sound right - the TX/RX should be off after the program has loaded, as your code does not show any serial IO. The "L" (presuambly pin 13 LED) might be on if that FastLED library uses the SPI (As I wrote, dont know that library).


I grabbed one of my other adruinos that I use to read EEPROM batteries.... Strand works perfectly with the fast led library as well as the other one posted here... I guess this Arduino is a dud


Always try swapping back.  Sometimes surprising.

Go Up