Trinket running FastLED, limited number of LEDs?

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cogzoid
 
Posts: 4
Joined: Tue Jul 16, 2019 12:56 am

Trinket running FastLED, limited number of LEDs?

Post by cogzoid »

Ultimately I'm trying to run a strip of 201 LEDs with a 5V Trinket running some simple FastLED code. I have a short test strip of 39 LEDs on my desk, and I was working out some of the effects with that. Currently I'm running these 39 LEDs through the USB power on the Trinket, but I'll upgrade to a dedicated power supply when I have the code working. I've been playing with some simple fading effects and things like that.

For some reason when I try the code with more than ~120 LEDs the Trinket becomes unstable. It continually resets and fails to run through the program once. I don't believe I'm up against the limit of the flash bytes. And I'm not actually pulling any more current (still just have the 39 LEDs). I decided to strip down the code to just "show a simple color" and it still locks up.

You can see how simple this version of the code is, and it still locks up on anything over ~120 but runs fine on anything less.

Code: Select all

#include <FastLED.h>

#define LED_PIN     1

#define NUM_LEDS    100 //201
#define BRIGHTNESS  20
#define LED_TYPE    NEOPIXEL
#define COLOR_ORDER RGB
CRGB leds[NUM_LEDS];

#define UPDATES_PER_SECOND 10

void setup() {

  delay( 2000 ); // power-up safety delay

  FastLED.addLeds<LED_TYPE, LED_PIN>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(  BRIGHTNESS );
  FastLED.BANNED(5,500);

  SetValues();
  FastLED.show();
}

void loop() {
  // put your main code here, to run repeatedly:
 
  //FastLED.delay(1000 / UPDATES_PER_SECOND);
}

void SetValues(){
  for (int i=0; i < NUM_LEDS;i++){
    leds[i]              = CHSV(150, 255, 255);
  }
}

User avatar
cogzoid
 
Posts: 4
Joined: Tue Jul 16, 2019 12:56 am

Re: Trinket running FastLED, limited number of LEDs?

Post by cogzoid »

Upon some further digging it seems that the Trinket can only run about ~100 Neopixels. That's on the bottom of this page: https://learn.adafruit.com/introducing- ... ot-dot-dot

So, it looks like I'll have to upgrade the board I'm using.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Trinket running FastLED, limited number of LEDs?

Post by adafruit_support_bill »

Yes. Neopixels require at least 3 bytes of RAM per pixel - plus more for the system stack, heap and any dynamic variables in your code. The Trinkets have only 512 bytes of RAM to work with.

https://learn.adafruit.com/memories-of-an-arduino

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”