Go Down

Topic: WS2812B LEDs are not working with Arduino Uno (Read 5100 times) previous topic - next topic

Thiyraash96

Feb 15, 2017, 06:09 pm Last Edit: Feb 15, 2017, 06:34 pm by Thiyraash96
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?

PaulRB

#1
Feb 15, 2017, 08:11 pm Last Edit: Feb 15, 2017, 08:21 pm by PaulRB



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?

Grumpy_Mike

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.

Thiyraash96

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.

Thiyraash96

Grumpy_Mike what you said is true. It is my fault that I does not provide enough information on other forum.

Grumpy_Mike

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".

PaulRB

Please learn to post pictures correctly. Helps us to help you!






Thiyraash96

#7
Feb 16, 2017, 06:05 pm Last Edit: Feb 16, 2017, 06:11 pm by Thiyraash96
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

Grumpy_Mike


PaulRB

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?

Thiyraash96

#10
Feb 17, 2017, 07:31 pm Last Edit: Feb 17, 2017, 07:38 pm by Thiyraash96
I'm sorry for does not post the picture properly.

Grumpy_Mike

#11
Feb 18, 2017, 12:10 am Last Edit: Feb 18, 2017, 12:10 am by Grumpy_Mike
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.

PaulRB

#12
Feb 18, 2017, 08:52 am Last Edit: Feb 18, 2017, 08:56 am by PaulRB
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.

Thiyraash96

So what might be the problem? Faulty component?

PaulRB

#14
Feb 19, 2017, 11:07 am Last Edit: Feb 19, 2017, 11:14 am by PaulRB
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.

Go Up