Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Thiyraash96 on Feb 15, 2017, 06:09 pm

Title: WS2812B LEDs are not working with Arduino Uno
Post by: Thiyraash96 on Feb 15, 2017, 06:09 pm
I recently bought 1m of WS2812B with 60 LEDs to be controlled with an Arduino Uno. I build my circuit based on the picture attached below. I have included the code (strandtest)that I tried to use to light up WS2812B. Out off 60 leds, I just used 30 leds

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

#define PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(30, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
    strip.begin();
    strip.show(); // Initialize all pixels to 'off'
}

 void loop() {
    // Some example procedures showing how to display to the pixels:
    colorWipe(strip.Color(255, 0, 0), 50); // Red
    colorWipe(strip.Color(0, 255, 0), 50); // Green
    colorWipe(strip.Color(0, 0, 255), 50); // Blue
    // Send a theater pixel chase in...
    theaterChase(strip.Color(127, 127, 127), 50); // White
    theaterChase(strip.Color(127,   0,   0), 50); // Red
    theaterChase(strip.Color(  0,   0, 127), 50); // Blue

    rainbow(20);
    rainbowCycle(20);
    theaterChaseRainbow(50);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
    for(uint16_t i=0; i<strip.numPixels(); i++) {
        strip.setPixelColor(i, c);
        strip.show();
        delay(wait);
    }
}

void rainbow(uint8_t wait) {
    uint16_t i, j;

    for(j=0; j<256; j++) {
        for(i=0; i<strip.numPixels(); i++) {
            strip.setPixelColor(i, Wheel((i+j) & 255));
        }
        strip.show();
        delay(wait);
    }
}

// Slightly different, this makes the rainbow equally distributed         throughout
void rainbowCycle(uint8_t wait) {
    uint16_t i, j;

    for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
        for(i=0; i< strip.numPixels(); i++) {
            strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
        }
        strip.show();
        delay(wait);
    }
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
    for (int j=0; j<10; j++) {  //do 10 cycles of chasing
        for (int q=0; q < 3; q++) {
            for (int i=0; i < strip.numPixels(); i=i+3) {
                strip.setPixelColor(i+q, c);    //turn every third pixel on
            }
            strip.show();

            delay(wait);

            for (int i=0; i < strip.numPixels(); i=i+3) {
                strip.setPixelColor(i+q, 0);        //turn every third pixel off
            }
        }
    }
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
    for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
        for (int q=0; q < 3; q++) {
            for (int i=0; i < strip.numPixels(); i=i+3) {
                strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every   third       pixel on
            }
            strip.show();

            delay(wait);

            for (int i=0; i < strip.numPixels(); i=i+3) {
                strip.setPixelColor(i+q, 0);        //turn every third pixel off
            }
        }
    }
    // The colours are a transition r - g - b - back to r.
    if(WheelPos < 85) {
        return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
    } else if(WheelPos < 170) {
        WheelPos -= 85;
        return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
    } else {
        WheelPos -= 170;
        return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
    }
}



After set up the circuit based on the picture below.I powered up WS2818B LEDs by using 5V 2A Samsung's power adapter. When I switch on the power adapter, two leds light up with green color( I haven't load the code yet). I off the power adapter and on back now three led with different color light up.Then I load the strandtest code(ADAFRUIT) to the arduino uno but the WS2818B LEDs still output the same result (Only two green colored LEDs light up). I have checked many forums regarding this problem but none of them can resolve my problem. Can someone help me about it?
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: PaulRB on Feb 15, 2017, 08:11 pm
(http://forum.arduino.cc/index.php?action=dlattach;topic=455962.0;attach=199328)
(http://forum.arduino.cc/index.php?action=dlattach;topic=455962.0;attach=199330)

Can you post a close up of the connections to the strip?

Can you upload the blink sketch and see the built-in led flashing?
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Grumpy_Mike on Feb 16, 2017, 12:06 am
Basically you either have faulty components or more than likely you are doing something wrong. Until we can see what you have done we can't say what you have done wrong. That code works and that circuit works, so we can rule out design errors, so that only leaves your implementation.

As you claim to have asked on other forums I am astonished you provide so little information to us.
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Thiyraash96 on Feb 16, 2017, 12:58 pm
PaulRB this is my connection to strip. My soldering skills sucks but I have make sure that any of the wires does not touch each other. As you said I have upload the blink sketch code too to make the build in led of arduno to blink and the build in led is blink.
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Thiyraash96 on Feb 16, 2017, 01:47 pm
Grumpy_Mike what you said is true. It is my fault that I does not provide enough information on other forum.
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Grumpy_Mike on Feb 16, 2017, 02:43 pm
Your pictures show only part if the circuit. We need to see it all.
The choice of yellow, yellow and yellow for +5, signal and ground is not good for spotting errors.

That signal joint doesn't look correctly soldered to me. It looks like "dry joint".
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: PaulRB on Feb 16, 2017, 04:23 pm
Please learn to post pictures correctly. Helps us to help you!

(http://forum.arduino.cc/index.php?action=dlattach;topic=455962.0;attach=199432)

(http://forum.arduino.cc/index.php?action=dlattach;topic=455962.0;attach=199434)

(http://forum.arduino.cc/index.php?action=dlattach;topic=455962.0;attach=199436)
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Thiyraash96 on Feb 16, 2017, 06:05 pm
Sorry to use the same color for all three wires. I have reconstruct the circuit so that it look more tidy and clear. I have no idea how to upload the image that is why I attached the image.


https://drive.google.com/file/d/0B8B-fzL3uIGzQzZNcERvLXE0bFU/view?usp=sharing(https://drive.google.com/file/d/0B8B-fzL3uIGzQzZNcERvLXE0bFU/view?usp=sharing)
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Grumpy_Mike on Feb 16, 2017, 07:53 pm
Quote
no idea how to upload the image
see this image guide (http://forum.arduino.cc/index.php?topic=364156.0)
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: PaulRB on Feb 16, 2017, 07:58 pm
I have no idea how to upload the image that is why I attached the image.
You were half way there when you attached the images before. Now you have gone backwards. If you were in charge of a forum, how would you let people know how to post images, links and code?
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Thiyraash96 on Feb 17, 2017, 07:31 pm
I'm sorry for does not post the picture properly.(http://forum.arduino.cc/index.php?action=dlattach;topic=455962.0;attach=199740)
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Grumpy_Mike on Feb 18, 2017, 12:10 am
You have no common ground between the Arduino and your external power supply.

Run a wire from the Arduino ground to the ground on the bread board.

That is why we needed to see all your wiring.
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: PaulRB on Feb 18, 2017, 08:52 am
You have no common ground between the Arduino and your external power supply.
Mike, I think that's the white dupont wire you can see.
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: Thiyraash96 on Feb 19, 2017, 10:14 am
So what might be the problem? Faulty component?
Title: Re: WS2812B LEDs are not working with Arduino Uno
Post by: PaulRB on Feb 19, 2017, 11:07 am
Next, check all the wiring with a multimeter. Perhaps you have faulty connections somewhere. Those DuPont wires are notoriously unreliable in my experience. Check each one using the resistance mode on the multimeter. Check the resistance of that resistor is as expected. Use the voltage mode to check that you have 5V all the way to the end of the strip.

Another possibility is that the first led in the strip is faulty. See what happens if you connect the data wire to the pad for the second led.