Neopixels stop working after certain pixel

Hello,

I am currently working on a project where I have Neopixels assembled to form a 7-segment display forming a clock to an Arduino UNO.

Each strand (a segment of the clock) is made of 9 pixels where I connect each strand together through wiring.

The current problem I'm having is when I define 103 pixels and fill them with a color the pixels work fine, but when I try 104 the pixels won't turn on at that point. I've tried replacing a couple of the strips and checked to make sure they're all getting the proper voltage across the clock and it all looks fine. I'm fairly sure it's an electrical problem, as opposed to a code problem, and the only thing I can think of is that the Din signal is getting lost at that point, and was wondering If anyone had any suggestions.

Thanks!

What power supply are you using, and how is it connected?

I've tried both powering from the 5V line of the Arduino and using a buck converter to step 12v down from this 12v plug to the wall and they both yield the same results.

There are quite a few wires crammed next to each other and I'm wondering if that has anything to do with it. I'm to familiar with electrical stuff very much so I don't know if you can get interference that way.

DON'T power them from the 5V line on the Arduino. 12V buck converter at what amp rating? 100 Pixels at full white would need 6Amps.

Its rated for 2A but I set the brightness low to 15 and the color to red with a value of 15 to make sure I'm not drawing too much current. Is there a particular reason for not powering them with the Arduino?

Which arduino are you using, and how much dynamic memory does the compiler show the sketch uses? Unlikely you have a memory problem, 104 pixels only need 312 bytes.

You could just have a bad neopixel, or a bad connection, since this is a custom assembly. Do not try to feed all the power from one end of the pixel string, connect power to both ends at least.

The reason for not using the Arduino to provide power is that the onboard voltage regulator will overheat if you need more than a couple of hundred milliamps.

Do not use "Vin" or the "barrel jack" for serious projects.

Power the UNO from the same fully regulated 5 V supply that you use for the NeoPixels, connected to the "5V" pin except while you have the UNO connected to your PC USB port.

Disconnect the strip which includes the 104th pixel from its data and connect its data input and ground directly to the UNO to see if the pixels are actually working. The code will not matter as long as it generates a pattern.

So I have this wire I've been using connected to the Pin that outputs Din and if I touch din on any pixel it will work except when I increase it to a certain point. For example in the code when the pixel count is defined as 22 it will work but when I try it when it is 23 or higher it won't work on any of the pixels if that makes sense.

Please post your test code

UPDATE: The shorter my wire is the more pixels I can control until it hits the point that none of them work which makes me think it's a resistance thing?

Here is my code below:

#include <IRLibAll.h>
#include <Adafruit_NeoPixel.h>
#include <RTClib.h>

#define P1_PIN 5

#define P1_COUNT 27
#define P3_COUNT 50

Adafruit_NeoPixel pixels_one(P1_COUNT, P1_PIN, NEO_GRB + NEO_KHZ800);

Adafruit_NeoPixel pixels_three(P3_COUNT, 13, NEO_GRB + NEO_KHZ800);

//Assign segmnet definitions

int current_brightness = 50;

void setup() {

Serial.begin(9600);

//Setup Pixels
pixels_one.begin();
pixels_one.clear();
//pixels_one.fill(pixels_one.Color(0, 0, 0), 0, P1_COUNT);
pixels_one.fill(pixels_one.Color(0, 40, 0), 0, 18);
pixels_one.setBrightness(current_brightness);
pixels_one.show();
Serial.print("Pixels One set");
delay(2000);

pixels_three.begin();
pixels_three.clear();
pixels_three.fill(pixels_three.Color(20, 110, 80), 0, P3_COUNT);
pixels_three.setBrightness(current_brightness);
pixels_three.show();

}

void loop()
{

int i = 0;
while (i < 100)
{
i++;
pixels_three.fill(pixels_one.Color(30, 10, i), 0, 63);
pixels_three.show();
pixels_one.fill(pixels_one.Color(i, 10, 30), 0, P3_COUNT);
pixels_one.show();
delay(50);
}

}

Please follow the advice on posting code given in Read this before posting a programming question in order to make your sketch easy to read, copy and test

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

If the code exceeds the 9000 character inline limit then attach it to a post

This wire you are using: it should be a pair of wires, data and ground, twisted or stuck together. You should have a resistor, around 470R, at the end of the data wire near the strip.

After many hours of playing around with it, I found out that if I comment out the rtc code that they work, which means it would be an onboard memory problem correct?

After many hours of playing around with it, I found out that if I comment out the rtc code that they work, which means it would be an onboard memory problem correct?

No - it means you did not post the code you were using above when explicitly asked to.

trythesauce:
After many hours of playing around with it, I found out that if I comment out the rtc code that they work, which means it would be an onboard memory problem correct?

Unlikely, because the code you posted only has the single reference to the rtc code in the include statement. The compiler will remove that in optimization since you never use it.

My apologies, I posted a redacted version to make it easier to read where I removed everything commented out and didn't catch that I removed the rtc_setup() line. I really do appreciate the help and don't want to waste anyone's time. I switched the libraries I was using from the adafruit library to FASTLED library. Now I can use my LEDs but the IR receiver I have won't work when rtc_start() is uncommented out (Same problem but with IR Reciever this time. Here is my code in the next set of posts below:

#include <IRLibAll.h>
#include <FastLED.h>
#include <RTClib.h>

#define current_mode

RTC_PCF8523 rtc;

CRGB leds_one[207];
CRGB leds_two[12];

//Create a receiver object to listen on pin 2
IRrecvPCI myReceiver(3);


//Create a decoder object
IRdecode myDecoder;

//myDecoder.value =0xFF1AE5;

int current_brightness = 70;

bool power = true;

int D1 = 0;
int D2 = 0;
int D3 = 0;
int D4 = 0;



void setup() {
  
  //setup rtc
  Serial.begin(9600);
  setup_rtc();

  // setup IR Receiver
  delay(2000); while (!Serial); //delay for Leonardo
  myReceiver.enableIRIn(); // Start the receiver
  Serial.println(F("Ready to receive IR signals"));





  FastLED.addLeds<WS2812B, 5, GRB>(leds_one, 207);
  FastLED.addLeds<WS2812B, 6, GRB>(leds_two, 12);


  for (uint8_t i = 0; i < 12 ; i++) {
    leds_two[i] = CRGB::Plum;
  }

  for (uint8_t i = 0; i < 207 ; i++) {
    leds_one[i] = CRGB::Blue;
  }
  FastLED.setBrightness(current_brightness);
  FastLED.show();

}

void loop()
{
   
  delay(500);
  input_controller();

  //timer_controller();


}
void input_controller() {
  //Continue looping until you get a complete signal received
  if (myReceiver.getResults()) {

    myDecoder.decode();           //Decode it
    myDecoder.dumpResults(false);  //Now print results. Use false for less detail
  myReceiver.enableIRIn();      //Restart receiver
  }

  if (myDecoder.protocolNum == NEC) {

    switch (myDecoder.value) {

      case 0xFF28D7: //Red Up
        brightness_up();
        break;

      case 0xFF3AC5: //Brightness Up
        brightness_up();
        myDecoder.value = 0;
        break;

      case 0xFFBA45: //Brightness Down
        brightness_down();
        myDecoder.value = 0;
        break;

      case 0xFF02FD: //Power Toggle
        power_toggle();
        myDecoder.value = 0;
        break;

      case 0xFF1AE5: //Red
        color_A1();
        break;

      case 0xFF9A65: //Green
        color_A2();
        break;

      case 0xFFA25D: //Blue
        color_A3();
        break;

      case 0xFF22DD: //White
        color_A4();
        break;

      //Removed List of cases to make this easier to read and less charachters

      default:
        break;
    }
   
    
  }
   
  delay(500);
  
}
void  timer_controller() {


  DateTime now = rtc.now(); // Define now

  D1 = ((now.hour() - 12) / 10); // Gets the left value of hour
  D2 = ((now.hour() - 12) % 10); // Gets the right value of hour
  D3 = (now.minute() / 10);
  D4 = (now.minute() % 10); 


  // Digit 4
  switch (D4) {
    
    case 0:
      for (uint8_t i = 27; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      
      break;

    case 1:
      for (uint8_t i = 0; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      for (uint8_t i = 9; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      for (uint8_t i = 27; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      for (uint8_t i = 36; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      for (uint8_t i = 45; i < 9 ; i++) { leds_one[i] = CRGB::Black;}

      break;

    case 2:
      for (uint8_t i = 18; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      for (uint8_t i = 36; i < 9 ; i++) { leds_one[i] = CRGB::Black;}
      break;

    //Removed cases to make it easier to read  and less charachters

  delay(100);
  FastLED.show();
  
  myReceiver.enableIRIn();      //Restart receiver
  delay(300);
}
//Absolute color keys
void color_A1()
{
  for (uint8_t i = 0; i < 207 ; i++) { leds_one[i] = CRGB::Red;}
  Serial.print("Red pressed");
}

void color_A2()
{
 for (uint8_t i = 0; i < 207 ; i++) { leds_one[i] = CRGB::Green;}
}

void color_A3()
{
  for (uint8_t i = 0; i < 207 ; i++) { leds_one[i] = CRGB::MidnightBlue;}
}

void color_A4()
{
 for (uint8_t i = 0; i < 207 ; i++) { leds_one[i] = CRGB::White;}
}

//Removed some of the functions to make this much shorter
void setup_rtc()
{

 // Cant fidn RTC
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    abort();
  }
  //RTC reset completly
  if (! rtc.initialized() || rtc.lostPower()) {
    Serial.println("RTC is NOT initialized, let's set the time!");
    // When time needs to be set on a new device, or after a power loss, the
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
    //
    // Note: allow 2 seconds after inserting battery or applying external power
    // without battery before calling adjust(). This gives the PCF8523's
    // crystal oscillator time to stabilize. If you call adjust() very quickly
    // after the RTC is powered, lostPower() may still return true.
  }

  // When time needs to be re-set on a previously configured device, the
  // following line sets the RTC to the date & time this sketch was compiled
  // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  // This line sets the RTC with an explicit date & time, for example to set
  // January 21, 2014 at 3am you would call:
  // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));

  // When the RTC was stopped and stays connected to the battery, it has
  // to be restarted by clearing the STOP bit. Let's do this to ensure
  // the RTC is running.
  rtc.start();

  // The PCF8523 can be calibrated for:
  //        - Aging adjustment
  //        - Temperature compensation
  //        - Accuracy tuning
  // The offset mode to use, once every two hours or once every minute.
  // The offset Offset value from -64 to +63. See the Application Note for calculation of offset values.
  // https://www.nxp.com/docs/en/application-note/AN11247.pdf
  // The deviation in parts per million can be calculated over a period of observation. Both the drift (which can be negative)
  // and the observation period must be in seconds. For accuracy the variation should be observed over about 1 week.
  // Note: any previous calibration should cancelled prior to any new observation period.
  // Example - RTC gaining 43 seconds in 1 week
  float drift = 0; // seconds plus or minus over oservation period - set to 0 to cancel previous calibration.
  float period_sec = (7 * 86400);  // total obsevation period in seconds (86400 = seconds in 1 day:  7 days = (7 * 86400) seconds )
  float deviation_ppm = (drift / period_sec * 1000000); //  deviation in parts per million (μs)
  float drift_unit = 4.34; // use with offset mode PCF8523_TwoHours
  // float drift_unit = 4.069; //For corrections every min the drift_unit is 4.069 ppm (use with offset mode PCF8523_OneMinute)
  int offset = round(deviation_ppm / drift_unit);
  // rtc.calibrate(PCF8523_TwoHours, offset); // Un-comment to perform calibration once drift (seconds) and observation period (seconds) are correct
  // rtc.calibrate(PCF8523_TwoHours, 0); // Un-comment to cancel previous calibration
  
   DateTime now = rtc.now(); // Define now

  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(" (");
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();

  delay(3000);
}

rtc_start() is uncommented out

I don't see that anywhere.

for (uint8_t i = 27; i < 9 ; i++) { leds_one[i] = CRGB::Black;}

Lines like this will do nothing because 27 is greater than 9.

delay(500);

There are two of these. I recommend removing both. Make timer_controller() check that the minute has changed before updating the pixels.