MKR1010 FastLED Addressing Issue - WS2812B

I am experiencing a strange issue FastLED used on a MKR1010 and a strip of WS2812B LED's (length = 141 LED's). This problem seems unique to the MKR1010 - the issue does not repeat with identical setup using an Uno.

I have a simple program which cycles through the LED's one at a time, turning an LED on, delaying a short bit, then turning the LED off. Then the next LED in line is turned on and off. This is done in a For loop from 0 to NUM_LEDs. Once the last LED is cycled on then off, the code reverses the sequence cycling each LED from NUM_LEDs to zero.

Here is my issue - The code works as expected if I define my total number of LED's (NUM_LEDs) at a number less that 66 or less. If I define the number of LED's > 66 then I get unexpected results. When I define the number of LED's to larger than 66 the sequence starts at that highest LED and works up from there. As an example If I define the NUM_LEDs = 70, the code starts by turning on LED 70, then 71 through LED 140.

Interestingly I do not get the same problem when using the identical code and wiring, but with an Uno board.

The Logic level for the MKR is 3.3V, however I use a Texas Instruments SN74AHCT125N to bring the MKR logic up to the 5v logic needed by the WS2812B.

MKR Wiring diagram and code provided. The leads between my Arduino and first LED are about 18 inches long with the Capacitor on the Arduino side.

Testing with the UNO did not use the SN74AHCT125N or capacitor. I was able to get all 141 LED's to work as expected.

Any guesses?

#define NUM_LEDS 70
#define DATA_PIN 5

// Define the array of leds

void setup() { 
   FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);  // GRB ordering is typical 

void loop() { 
  // Turn the LED on, then pause
    for (int i=0;i<NUM_LEDS-1;i++){
      leds[i] = CRGB::Red;
      if (i ==0) delay(1000);
      else delay(10);
      if (i < NUM_LEDS-1){
        leds[i] = CRGB::Black;
      if (i == NUM_LEDS-1){

   for (int i=NUM_LEDS-1;i>=0;i--){
      leds[i] = CRGB::Green;;
      if (i == NUM_LEDS-1) delay(1000);
      else delay(10);
      leds[i] = CRGB::Black;;

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