WS2812B can not work!!

Hello everyone

I following as below setp, but WS2812B still not work ,could every one can be help me ,
thank you very much,

H/W

  1. WS2812B x1 pcs
  2. WS2812B DI pin used RESISTER 470R to MEGA 2560 PIN 6 ,(No mater have it(R) or not, It can not WORK)
  3. WS2812B VCC = power supply 5V
  4. Ground is also connected to Arduino MEGA 2560 and LED grounds.

S/W
#include <Adafruit_NeoPixel.h> // Include Adafruit NeoPixel library
#define PIN 6 // LED on digital pin 6
#define NUMLEDS 1 // Use total of 1 LED

// Create ‘leds’ object to drive LEDs
Adafruit_NeoPixel leds = Adafruit_NeoPixel(NUMLEDS, PIN, NEO_GRB + NEO_KHZ800);

int wait = 5; // Standard wait delay of 5 milliseconds

void setup() {
leds.begin(); // Initialize ‘leds’ object

//Make sure LED is off to demonstrate start of sketch
leds.setPixelColor(0, leds.Color(0, 0, 0)); // Turn off LED
leds.show(); // Set new value
delay(500);

}

// Loop through changing R, G, and B colors
// Each color fades in from off (i=0) to fully on (i=255)
void loop() {
for(int i=0; i<255; i++) { // Count up color units from 0 to 255
leds.setPixelColor(0, leds.Color(i, 0, 0)); // Color mix for LED
leds.show(); // Set the LED
delay(wait); // Delay for visual effect
}
for(int i=0; i<255; i++) { // Loop through next color change
leds.setPixelColor(0, leds.Color(0, i, 0));
leds.show();
delay(wait);
}
for(int i=0; i<255; i++) { // Loop through next color change
leds.setPixelColor(0, leds.Color(0, 0, i));
leds.show();
delay(wait);
}
}

e62ea6e7cf5f59abe16bf0e742689694f21caf03.jpg

There is nothing wrong with your sketch.

You only need one GND wire.

What power supply are you using?

What resistor value are you using?

You might have a bad jumper wire or there is a poor breadboard connection.

You may have a bad Arduino.

You may have damaged your LED strip.

Give us a link to the LED strip.

.

Hi Sir
Thank you for your reply and help me

After your suggestion;I modify circuit and measure MEGA2560 PIN 6
please kindly see att, file ,and give us any idea if you have,

Confirm the resistor is 330 ohms, use a DVM and measure it.

Try a different LED strip.

You were asked to give us a web Link to the LED strip so we can confirm it is usable.

Try using pin 3 instead, make the change in your code.

Your code works here.

.

Hi Sir Thank you very much for reply

1.Confirmed the R is 330ohm , It is no Problem ,

  1. we change it to using MEGA2560 Board pin form 6 to 3 & revised the Source Code , It is still can not WORK!!

3 we use the other LED strip , It is still can not WORK, too

  1. In the before JPG file , Does it the PWM timming chart is not correct ? 200KHZ??

  2. otherwise, It's seem issue that coused by across talk (NOISE)? ?

  1. In the before JPG file , Does it the PWM timming chart is not correct ? 200KHZ??

What does PWM have to do with anything at all?

Again we ask you to post a link to the LED strip you are using.

I have tried your code and it does what it is supposed to, that is it cycles through red green and blue for the first LED in the strip.

That scope display only shows the bursts of data, wind up the time base and see the actual data being sent.
You will see something like this:-

topic starter Osciloscope screenshot shows about 12mV of pulses, so no, it will never work like this. Try measuring the pulses with no load (ie Led strip not connected) so that to verify the pin works as expected. Also on the second screenshot it looks as if the red cables from the PS positive pole is connected to the black GND cable on the strip.

If you combine both of the above, it looks to me like a short somewhere... it could be the cable connection, or maybe even the cut of the led strip....

try using FastLED library,go to sketch,include library and than manage libraries and than type FastLED and install it,try their examples...

Kristijan1392: try using FastLED library,go to sketch,include library and than manage libraries and than type FastLED and install it,try their examples...

There is zero point in trying another library because his code works. When offering advice on a thread please read all the replies to the thread first to see if your advice is good.