0

Neopixel ring one LED stays on
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Neopixel ring one LED stays on

by LadyPrelude on Fri Mar 09, 2018 8:02 pm

Hi there, I'm using a 24 Neopixel ring and one of the pixels won't go out. I've checked my code and can't see a problem there, I've also tried sample codes and get the same result. The LED is also a slightly different colour to the others, they are blue and the one LED has a green tint to it. Any ideas what might cause this please? The video link below is one I've uploaded to show what I mean, the pixel at the bottom stays on, it should go out with the others. Many thanks
https://youtu.be/ccWEBcMZKhU

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by adafruit_support_bill on Fri Mar 09, 2018 8:15 pm

Please post the code you are using to drive the ring.

adafruit_support_bill
 
Posts: 67257
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel ring one LED stays on

by LadyPrelude on Fri Mar 09, 2018 8:34 pm

this is the code. Thanks

Code: Select all | TOGGLE FULL SIZE
#define PIN 1

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino 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(29, PIN, NEO_GRB + NEO_KHZ800);

int ringRightSide[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int ringLeftSide[] = {0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12};
int singlePixels[] = {24, 25, 26, 27, 28};

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

int pos = 0;
int pos2 = 0;

void loop() {
    // Draw 5 pixels centered on pos.  setPixelColor() will clip any
  // pixels off the ends of the strip, we don't need to watch for that.
  strip.setPixelColor(ringRightSide[abs((pos - 2)%13)], strip.Color(0, 0, 80)); // Dark blue
  strip.setPixelColor(ringRightSide[abs((pos - 1)%13)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringRightSide[abs((pos    )%13)], strip.Color(15, 15, 200)); // Center pixel is brightest
  strip.setPixelColor(ringRightSide[abs((pos + 1)%13)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringRightSide[abs((pos + 2)%13)], strip.Color(0, 0, 80)); // Dark blue
 
  strip.setPixelColor(ringLeftSide[abs((pos - 2)%13)], strip.Color(0, 0, 80)); // Dark blue
  strip.setPixelColor(ringLeftSide[abs((pos - 1)%13)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringLeftSide[abs((pos    )%13)], strip.Color(15, 15, 200)); // Center pixel is brightest
  strip.setPixelColor(ringLeftSide[abs((pos + 1)%13)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringLeftSide[abs((pos + 2)%13)], strip.Color(0, 0, 80)); // Dark blue
 
  strip.setPixelColor(singlePixels[abs(pos2 - 1)], strip.Color(0, 0, 80)); // Dark blue
  strip.setPixelColor(singlePixels[abs(pos2    )], strip.Color(15, 15, 200)); // Center pixel is brightest
  strip.setPixelColor(singlePixels[abs(pos2 + 1)], strip.Color(0, 0, 80)); // Dark blue
 
    strip.show();
  delay(100);
 
    // Rather than being sneaky and erasing just the tail pixel,
  // it's easier to erase it all and draw a new one next time.
  for(int j=-2; j<= 2; j++) {
    strip.setPixelColor(ringRightSide[(pos+j)%13], 0);
    strip.setPixelColor(ringLeftSide[(pos+j)%13], 0);
    strip.setPixelColor(singlePixels[(pos2+j)%5], 0);
  }
 

  pos += 1;
  if(pos < 0) {
    pos = 1;

  } else if(pos >= 13) {
    pos = 0;

  }

  pos2 += 1;
  if(pos2 < 0) {
    pos2 = 1;
  } else if(pos2 >= 6) {
    pos2 = 0;

  }

}
Last edited by adafruit_support_bill on Sat Mar 10, 2018 6:53 am, edited 1 time in total.
Reason: please use [code] tags when posting code to the forums.

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by adafruit_support_bill on Sat Mar 10, 2018 7:48 am

You have the ring defined as 29 pixels. But I think that the math still works out. Just to be sure, let's try a simple test.

Run this code and check to see if the pixel is still stuck:

Code: Select all | TOGGLE FULL SIZE
#define PIN 1

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino 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(29, PIN, NEO_GRB + NEO_KHZ800);

int ringRightSide[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int ringLeftSide[] = {0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12};
int singlePixels[] = {24, 25, 26, 27, 28};

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

int pos = 0;
int pos2 = 0;

void loop()
{
    for int i = 0; i < strip.numPixels(), i++)
    {
        strip.setPixelColor(i, strip.Color(15, 15, 200)); // Center pixel is brightest
        strip.show();
        delay(100);
       
        strip.setPixelColor(i, 0); // off
        strip.show();
   }
}

adafruit_support_bill
 
Posts: 67257
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel ring one LED stays on

by LadyPrelude on Sat Mar 10, 2018 9:20 am

sorry code doesn't run?
I get the following errors
code error2.jpg
code error2.jpg (131.27 KiB) Viewed 216 times


The reason for 29 is because I want to add 10 flora pixels as well, 5 each side. I havent tested to see if this works yet.

Many thanks

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by adafruit_support_bill on Sat Mar 10, 2018 9:32 am

Sorry, That's what happens when I code before I have my coffee.

Try this:

Code: Select all | TOGGLE FULL SIZE
   
#define PIN 1
#include <Adafruit_NeoPixel.h>
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino 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(29, PIN, NEO_GRB + NEO_KHZ800);

int ringRightSide[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int ringLeftSide[] = {0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12};
int singlePixels[] = {24, 25, 26, 27, 28};

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

int pos = 0;
int pos2 = 0;

void loop()
{
    for (int i = 0; i < strip.numPixels(); i++)
    {
        strip.setPixelColor(i, strip.Color(15, 15, 200)); // Center pixel is brightest
        strip.show();
        delay(100);
       
        strip.setPixelColor(i, 0); // off
        strip.show();
   }
}

adafruit_support_bill
 
Posts: 67257
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel ring one LED stays on

by LadyPrelude on Sat Mar 10, 2018 10:57 am

LOL! thank you.
Got the follow error code when uploading.
code error.jpg
code error.jpg (184.22 KiB) Viewed 202 times

The ring did light up, and the one pixel that won't go out is a different colour? I'll post a picture. Do you think its faulty?

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by LadyPrelude on Sat Mar 10, 2018 11:01 am

Pixel at the top
Attachments
_20180310_145915.JPG
_20180310_145915.JPG (715.39 KiB) Viewed 201 times

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by adafruit_support_bill on Sat Mar 10, 2018 11:04 am

Ok. Please contact support@adafruit.com with a link to this thread and we can send out a replacement.

adafruit_support_bill
 
Posts: 67257
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel ring one LED stays on

by LadyPrelude on Sat Mar 10, 2018 1:19 pm

Will do. I've just placed another order, so hopefully they can be sent at the same time.
Thank you for your help :)

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by LadyPrelude on Sun Mar 11, 2018 2:50 pm

Hi, thanks for sorting this out for me. I wonder if I could ask you another question please. The flora pixels are not working, and looking at the code I am using it does say V1 not V2 and yep I am using V2. Can I ask what do I need to do to this code to make it work with flora v2 please? Many thanks.

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Re: Neopixel ring one LED stays on

by adafruit_support_bill on Sun Mar 11, 2018 3:04 pm

In your code where you declare the pixels, make sure you specify NEO_KHZ800.
NEO_KHZ400 is for V1 pixels
NEO_KHZ800 is for V2.

adafruit_support_bill
 
Posts: 67257
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel ring one LED stays on

by LadyPrelude on Sun Mar 11, 2018 4:50 pm

Fantastic, thanks so much :)

LadyPrelude
 
Posts: 15
Joined: Tue Feb 27, 2018 2:03 pm

Please be positive and constructive with your questions and comments.