NeoPixel RGB strip library for use with SmartMatrix on Teensy 4.0?

What library is best for working with neo pixel RGB strips and a HUB75 using the SmartMatrix libary?

I have typically used the Adafruit_NeoPixel libary in the past for its simplicity but this is causing random white flashing LED on my matrix when it stops all interrupts to bit bang data NeoPixel strip. from what I have read it sounds like these two libary are not compatible and likely never will be.

I have tried FastLed.h and OctoWS811.h with various settings but they keep giving me weird results.

I would just like to know what library is everyone has been using and might be known to work with SmartMatrix libary on a Teensy 4?

EDIT:
I have seen this issue https://github.com/pixelmatix/SmartMatrix/issues/40 that is closed but I believe its closed as the library are not compatible.

you want to use FastLED, it’ll work fine and that’s what I use.

Any tips for getting it to work?

I tried briefly but it would not change the colours correctly and caused flicker on the RGB matrix.

I tried allow interrupts 0 but that gave me a compile error saying it was missing some definition in the library MS_CONFIG I think it was.

I also tried changing the interrupt retry value as per https://github.com/FastLED/FastLED/wiki/Interrupt-problems without any success either.

That is really all I tired before moving to OctoWS811 but I will play around with FastLed some more tonight.

If you could maybe point my in the direction of some sample code that it known working with both smartMatrix and FastLED(for neo pixel strip and not simply the FastLed colour functions like the example in the SmartMatrix libary) that would probably save me alot of time.

Thank you again

So, I’ve only used teensy 3.1/5/6, not 4, which is different code.
I now use ESP32 because it’s cheaper and simpler (+wifi)
You may want to try the fastled reddit? https://www.reddit.com/r/FastLED/
http://marc.merlins.org/perso/arduino/post_2019-04-01_SmartMatrix_-SmartMatrix-Shield-v4-for-Teensy_-ESP32-shield-with-level-shifter_-and-SmartMatrix_GFX.html
shows a demo of smartmatrix + fastled string. I have 0 problems whatsoever https://www.youtube.com/watch?v=Mjthr14VYkU

Yea I typically uses the ESP32 as well but when with the teensy on this project because of the smart matrix sheild.

When you use the teensy 3.x what method/settings have you used to get FastLed to work alongside a Hud75 panel maybe it will work for the 4 as well.

Thank you again.

I’m not sure what part of “it just worked” I can give more details about :slight_smile:
but teensy 4 and 3 are totally different CPUs, so something may be broken on teensy 4

So after a fair bit of trial and error I think I got SmartMatrix working with FastLED on teensy 4 so the interrupts do not conflict with each other and bot hthe NeoPixel strip and the Hud75 panel work flawlessly together.

In order to get it working I had to use “non-blocking WS2812Serial” that was originally written by Paul Stoffregen himself over a weekend and later merged into the FastLED.h library.

The draw back to this is it uses the serial interface on the teensy so we are limited to the following pins

// Usable pins:
// Teensy LC: 1, 4, 5, 24
// Teensy 3.2: 1, 5, 8, 10, 31 (overclock to 120 MHz for pin 8)
// Teensy 3.5: 1, 5, 8, 10, 26, 32, 33, 48
// Teensy 3.6: 1, 5, 8, 10, 26, 32, 33
// Teensy 4.0: 1, 8, 14, 16, 20, 24, 29, 39

Now of course my already made proto board was not using any these pins for the four strips I have so I will need to bust out that soldering iron again but thats on me for not testing all the various code components together before making my proto board. I did test each individually but not together for some reason.

Below is a bit of code that should get anyone going should they find this in the future.

#include <WS2812Serial.h>
#define USE_WS2812SERIAL
#include <FastLED.h>
// And then when you declare your strip (typically in setup())
FastLED.addLeds<WS2812SERIAL, DATA_PIN, RGB> (leds,NUM_LEDS);

I hope this helps someone in the future.

1 Like

Sorry I made a mistake to the listed usable pins for Teensy 4.0. Also added the usable pins for Teensy 4.1

// Usable pins:
//   Teensy LC:   1, 4, 5, 24
//   Teensy 3.2:  1, 5, 8, 10, 31   (overclock to 120 MHz for pin 8)
//   Teensy 3.5:  1, 5, 8, 10, 26, 32, 33, 48
//   Teensy 3.6:  1, 5, 8, 10, 26, 32, 33
//   Teensy 4.0:  1, 8, 14, **17**, 20, 24, 29, 39
//   **Teensy 4.1:  1, 8, 14, 17, 20, 24, 29, 35, 47, 53**
1 Like