Ws2812b not working

Hi..... I recently got my WS2812B LED strip. I am not able to run it. I hove connected the vcc to +5v the gnd to gnd and the data pin to the pin 7 of an arduino nano with a 330 ohm resister in between.
Code:-

#include <FastLED.h>

#define LEDPIN     7
#define NUMOFLEDS   60

CRGB leds[NUMOFLEDS];

void setup() {

  FastLED.addLeds<WS2812, LEDPIN, GRB>(leds, NUMOFLEDS);

}

void loop() {

  for (int i = 0; i <= 9; i++) {
    leds[i] = CRGB ( 0, 0, 255);
    FastLED.show();
    delay(40);
  }
  for (int i = 9; i >= 0; i--) {
    leds[i] = CRGB ( 255, 0, 0);
    FastLED.show();
    delay(40);
  }
}

What sort of Arduino are you using?

Each LED can draw a maximum of 60mA you have 60 LEDs, you can't get that much current from the 5V output of any kind of Arduino. You have to use an external 5V power source, with the negative wire also connected to the Arduino's ground pin.

Arduino Nano

Show us good images of your wiring.

What sort of nano, there are seven different types of Nano.

The generic nano with CH430G driver

  • If you upload the blink sketch, does a LED flash on the NANO ?

  • Make sure the resistor is making good contact.

Yes

  • Your code works here.

  • Do you have a voltmeter ?

1 Like

yeah

  • Measure the voltage between 5v and GND at the LED strip, what is it.

  • just for the heck of it change this to 9 #define NUMOFLEDS 60

BTW
The NANO may be able to power 9 LEDs but 60 will not work, for that you will need an external power supply.

1 Like

If it has a CH4030G then it is not a real Arduino it is a clone or a fake Arduino. However this tell me you have a 5V data signal. Many of the different Nano types only produce 3V3 signals that need to be boosted to 5V to get it to work correctly, that is why I was asking.

I found out that the led strip was bad so I replaced it and it worked

3 Likes

It may be that you only damaged the first LED on the strip. If you have more time than money, you can look forward to seeing if any part(s) of the bad strip still work.

a7

It would appear by this photo that YOU HAVE IT CONNECTED BACKWARDS

Check the arrows on the LED Strip.

That connector is not used for going towards the power supply
that connector is used for connecting to other strips
meaning.... it's an Output, Not an Input

Very common Mistake

2 Likes
  • Neopixel +5v >> red >> connector >> green >> Nano 5v pin
  • Neopixel SIG >> green >> connector >> purple + resistor >> white >> Nano D7
  • Neopixel GND >> white >> connector >> black >> Nano GND pin

    I think it is good.

To know if it's good the markings on the PCB Strip must be checked, current must flow in the direction of the arrows.
this connector is usually at the opposite end of the strip so as to allow interconnection to the next strip which is why it's a common mistake to connect to it

Yes, now I see how the Nano output is likely hooked to the Output end of the Pixel strip.

1 Like

No.
The data signal must flow in the directions of the arrow, not the current.

1 Like