Issues with neopixel strip longer than 60 LEDS

Hi all. I'd like to run a simple "colorWipe" program using neopixel library on a length of WS2812B (60led/m) approximately 1.8m long or 106 leds(pixels).
It all seems to work fine for the first loop, but then everything goes pear shaped. The timing all seems to get out of sync and only some of the LEDS light up on subsequent loops.
Does anyone have an explanation for this? Is there a timing nuance within the libraries? I'm new to coding so I cant work out why. I'm just using the "colorWipe" example and changing the number of pixels to 106.
The code doesn't seem to work with anything above 60 pixels. If I keep it under that - no problems.
I have ample 5V power supply.
Help much appreciated. I can post code if neccessary. Thanks

Show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

Timing. Swipe slower?

"...NeoPixels process data from the host microcontroller at a fixed data rate; more pixels = more time and lower animation frame rates..."

1 Like

Try applying 5V power to both ends of the strip. You'll get a voltage drop through the "thin" conductors built-into the strip and Adafruit recommends "injecting" power every meter.

And/or as a test you can also try just lighting-up the last 1 or 2 LEDs because there is less voltage drop with less current (so you can get-away with long-thin conductors).

60mA x 120LEDs is 7.2 Amps "worst case".

Thanks. I will try powering at both ends and hope that helps minimise voltage drop. I don't think its a power supply issue. I have a 5V, 30A power supply. Yes 30A. Should be plenty.

Thanks "xfpd". That makes sense. Any solutions or work arounds that you are aware of.

I do not have a solution. But... maybe find a length that is satisfactory in timing and use an effect like hand drawn animation, which does not show every single movement, because our brain "knows" to fill gaps between frames?

This person says "1000 LEDs"

1 Like

What is a loop in this context?

Apart from the other requests, we don't know your code. Please post it using code tags as described in How to get the best out of this forum.

Thanks everyone for your help on this. I have attached the simple wiring schematic I am using with a 30A 5VDC power supply.
I have also attached some code below where the problem occurs. I have tried a few different codes obtained from online examples and just modified the number of pixels. All of them seem to have the same problem if I use more than 60 leds.(pixels).
@sterretje: to clarify loop in this context, I mean the first pass or colorWipe through all the leds 0-106, seems to work fine - then on the second pass it often stops at pixel 62 and/or pixels 80-106(approx) stay on all the time.
I have tried modifying the variable "speedDelay" but still get similar problems.

Ultimately all I need to do is slowly light up a strip of 107 LEDS (approx 1.8m) one by one over 13.8 minutes in total. Then turn all off and repeat from 0-106 again.

#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUM_LEDS 107
// 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(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

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

// *** REPLACE FROM HERE ***
void loop() {
  colorWipe(0x00,0xff,0x00, 50);
  colorWipe(0x00,0x00,0x00, 50);
}

void colorWipe(byte red, byte green, byte blue, int SpeedDelay) {
  for(uint16_t i=0; i<NUM_LEDS; i++) {
      setPixel(i, red, green, blue);
      showStrip();
      delay(SpeedDelay);
  }
}
// *** REPLACE TO HERE ***

void showStrip() {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.show();
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.setPixelColor(Pixel, strip.Color(red, green, blue));
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H 
   // FastLED
   leds[Pixel].r = red;
   leds[Pixel].g = green;
   leds[Pixel].b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue); 
  }
  showStrip();
}

Every time, without fail?

But not always? Sometimes it does work?

Does pressing around LEDs 62 or 63 with your finger or flexing the strip gently in different directions around those LEDs have any effect? It could be a bad solder connection.

I can't see anything in your code or wiring diagram that would account for this behaviour.

My best guess right now is a faulty led or faulty soldering of a led. Either the fault is in the output of led 62 or the input of led 63. If you cut out LEDs 62 & 63 and joined the two halves of the strip together and the problem is gone, that would confirm it.

But if the first wipe works correctly every time, that would indicate LEDs 62/63 are ok, and the problem is elsewhere.

Thanks @PaulRB for your reply. I have tried other strip and confirmed that its not a faulty led or connection. Yes the first wipe always works correctly. I'm pretty convinced its a timing and or RAM issue the more I read and look into it.
Big thanks @LarryD for the link . I think Josh.com is definitely onto it. I'd like to try his code but I dont know how to look up the port/bit combination for Arduino Uno board. Does anyone know how what I need to change these definitions to to suit Arduino Uno.

#define PIXEL_PORT  PORTB  // Port of the pin the pixels are connected to
#define PIXEL_DDR   DDRB   // Port of the pin the pixels are connected to
#define PIXEL_BIT   4      // Bit of the pin the pixels are connected to

Many thanks

Nothing. It's set for pin 12 on Uno.

Normally I would say it's a good idea to try another library to see if it fixes your problem, but in this case the Adafruit Neopixel has been around for a long time and had been used very many times on Uno, so I don't think it could have such a serious bug as this. Others would have discovered it long ago. Let us know what you find.

If the fault remains, next thing to try is another Arduino, even another Uno.

Cine Lights from youtube does nice LED work and mentions memory issues limits LEDs to 60, or a Mega should be used.

No chance. The sketch in post #9 compiles to 181 bytes RAM usage. Add 3x107 bytes for the NeoPixels and you're still far from the danger zone.

Is abstraction an issue? Would port manipulation help memory and timing?

The NeoPixel library already uses port manipulation when using the show() method; to add to the fun, it also uses assembly in that method.

Let's put unlimited power in the ledstrip:

Yep, that seems to solve the problem :smiley:

calclimb7, the copper traces of the ledstrip itself can not carry all the current. You can attach wires with power (both GND and 5V) every 50 cm or every meter.
I noticed that the picture is taken from the Adafruit Neopixel Überguide. That is a good place to start.

1 Like

Many thanks and great simulation program. Pretty confident I have it working now. A few more test runs to do. So far so good.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.