Sketch not lighing all led strip

I am using the Arduino Uno with a 5mtr WS2812B led strip 60 leds / mtr. The strip is powerd by a 10A 5v power supply.
I was previously using a WS2812B 5mtr led strip 30 leds / mtr, but after a few years of more or less 4hours use per night, they started to fail. I then bought the 60 led / mtr strip to replace them, and thought it would look better with more leds.

I am using the Adafruit Neopixel / wx2812fx custom_fastLED sketch. This lit all 30 led / mtr strip which was 120 leds

Now with the 60 led / mtr, which would be 300 leds for a 5 mtr strip, I can only get 200 leds working
If I define NUM_LEDS as 300, then none light up, so I tried NUM_LEDS as 200 and they lit up.
.

What have I missed, as I have used a 60 led /mtr led strip before with another sketch and they all lit up.

Thanks

ws2812fx_custom_FastLED.ino (5.33 KB)

avalon66:
What have I missed

After 270 posts, you have missed learning how to post your code on the forum. Quite an achievement.

/*
  Demo sketch showing how to use the functions and features of the FastLED
  library to create custom effects. For this example we're going to implement
  Mark Kriegsman's Fire2012 effect from the FastLED examples folder here:
  https://github.com/FastLED/FastLED/tree/master/examples/Fire2012

  The basic idea is to use FastLED to create the LED color data, then
  copy the data to the ws2812fx instance for display.
  
  Keith Lord - 2018

  LICENSE

  The MIT License (MIT)

  Copyright (c) 2018  Keith Lord 

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
  
  CHANGELOG
  2018-05-13 initial version
*/
#include "FastLED.h" // be sure to install and include the FastLED lib
#include <WS2812FX.h>

#define NUM_LEDS 300
#define LED_PIN 7

WS2812FX ws2812fx = WS2812FX(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);

// declare global parameters used by Fire2012
bool gReverseDirection = false;

void setup() {
  Serial.begin(115200);

  // init WS2812FX to use a custom effect
  ws2812fx.init();
  ws2812fx.setBrightness(255);
  ws2812fx.setColor(BLUE);
  ws2812fx.setSpeed(1000);
  ws2812fx.setMode(FX_MODE_CUSTOM);
  ws2812fx.setCustomMode(myCustomEffect);
  ws2812fx.start();
}

void loop() {
  ws2812fx.service();
}

// in the custom effect run the Fire2012 algorithm
uint16_t myCustomEffect() {
  Fire2012();

  // return the animation speed based on the ws2812fx speed setting
  return (ws2812fx.getSpeed() / NUM_LEDS);
}

/*
 * paste in the Fire2012 code with a small edit at the end which uses the
 * setPixelColor() function to copy the color data to the ws2812fx instance. 
*/

// Fire2012 by Mark Kriegsman, July 2012
// as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
//// 
// This basic one-dimensional 'fire' simulation works roughly as follows:
// There's a underlying array of 'heat' cells, that model the temperature
// at each point along the line.  Every cycle through the simulation, 
// four steps are performed:
//  1) All cells cool down a little bit, losing heat to the air
//  2) The heat from each cell drifts 'up' and diffuses a little
//  3) Sometimes randomly new 'sparks' of heat are added at the bottom
//  4) The heat from each cell is rendered as a color into the leds array
//     The heat-to-color mapping uses a black-body radiation approximation.
//
// Temperature is in arbitrary units from 0 (cold black) to 255 (white hot).
//
// This simulation scales it self a bit depending on NUM_LEDS; it should look
// "OK" on anywhere from 20 to 100 LEDs without too much tweaking. 
//
// I recommend running this simulation at anywhere from 30-100 frames per second,
// meaning an interframe delay of about 10-35 milliseconds.
//
// Looks best on a high-density LED setup (60+ pixels/meter).
//
//
// There are two main parameters you can play with to control the look and
// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
// in step 3 above).
//
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames.  More cooling = shorter flames.
// Default 50, suggested range 20-100 
#define COOLING  55

// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire.  Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
#define SPARKING 120

void Fire2012()
{
// Array of temperature readings at each simulation cell
  static byte heat[NUM_LEDS];

  // Step 1.  Cool down every cell a little
    for( int i = 0; i < NUM_LEDS; i++) {
      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
    }
  
    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
    for( int k= NUM_LEDS - 1; k >= 2; k--) {
      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
    }
    
    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
    if( random8() < SPARKING ) {
      int y = random8(7);
      heat[y] = qadd8( heat[y], random8(160,255) );
    }

    // Step 4.  Map from heat cells to LED colors
    for( int j = 0; j < NUM_LEDS; j++) {
      CRGB color = HeatColor( heat[j]);
      int pixelnumber;
      if( gReverseDirection ) {
        pixelnumber = (NUM_LEDS-1) - j;
      } else {
        pixelnumber = j;
      }

// **** modified for use with WS2812FX ****
//    leds[pixelnumber] = color;
      ws2812fx.setPixelColor(pixelnumber, color.red, color.green, color.blue);
// **** modified for use with WS2812FX ****

    }
}

Have you tried using one of the standard example FastLED sketches with your 300 led strip?

I have just tried another FastLED sketch, and it runs all 300leds.

Sounds as if 300 LEDs is approaching the limit of available RAM on the UNO, so whether any particular sketch works or not will depend on how much ram the rest of the sketch uses! :astonished:

I cannot see why your sketch does not work with 300 leds but other sketches do work. I agree with Paul_B, ram memory is probably the reason for this, but I cannot understand why your sketch needs so much more than other sketches. 300 leds requires 900 bytes of ram memory, which is less than half what is available on uno. I am not familliar with the ws2812fx library, so I wonder if it keeps a second copy of the data for some reason. That would use up almost all the ram uno has, leaving too little for the Uno to operate.

That static array in Fire2012 isn’t doing any favours.

Maybe time to upgrade from Uno? If you have or can borrow a mega, try that. Otherwise, what about an Itsy Bitsy m0?