New SmartMatrix Library Release: Support for Teensy 3.5/3.6 and SmartLED Shield V4

It’s been a year and a half since the last SmartMatrix Library release, so this latest release is long overdue. Paul made it very easy to add Teensy 3.5/3.6 support as those boards are very similar in architecture to the Teensy 3.2/3.1. Still, there were some challenges that came from the faster processor speeds the Teensy 3.5 and 3.6 are capable of running.

It will be interesting to see what people build with the SmartMatrix Library and a Teensy 3.6, as the higher speed and larger memory should allow for refreshing much larger panels while still keeping high frame rates.

There’s a preview in the /extras/hardware folder of the new SmartLED Shield V4, stay tuned for a full announcement of the shield when it’s available for purchase from Adafruit, likely in the first half of November.

New Features

  • Initial support for Teensy 3.5/3.6
    • Workaround for other DMA use (e.g. SDIO) delaying shifting data out to panel and messing up timing
    • Workaround for faster clock speed of Teensy 3.5/3.6 shifting out data too fast to panel and causing glitches (observed at 140MHz and higher)
  • Support for new SmartLED Shield V4 (formerly “SmartMatrix Shield”)
    • SmartLED Shield V4 hardware design added to /extras/hardware folder
    • ADDX signals are now output on matrix data lines, to be stored by external 74AHCT374 flip flop, triggered by LATCH signal. Driving ADDX pins separately via Teensy pins is now optional, for more efficient DMA usage and savings of 4 GPIO pins over SmartMatrix Shield V3 and earlier.
    • Add extra #include <SmartLEDShieldV4.h> to all examples. Needs to be uncommented if using SmartLED Shield V4

Bug Fixes

  • Fix bug when using swapBuffers(false) and backBuffer() - add new isSwapPending() function


  • Bring AnimatedGIFs sketch up to date
    • Add SmartLED Shield V4 and Teensy 3.5/3.6 support
    • Refactored with GifDecoder class that uses templates to set the max size of the GIF and LZW decoder complexity: GIF Decoding is now a lot more stable
  • Added example for SmartMatrix Library V4: FastLED_Panel_Plus_APA. Example shows how to set up FastLED to drive APA102 LEDs through the 4-pin JST connector on the SmartLED Shield, in parallel with driving the panel.
1 Like

Some questions please.

This new firmware version is compatible with before hardware ?
Why when I donwload ZIP from Github, AnimatedGIF folder is always empty ??.

It is essential to put the buffers 74LS245 and 74HCT1G08 ?
My current hardware with before firmware version and Kinetis MK66 does not install 74LS245 and apparently it works fine.

I want to check Smartmatrix with APA102 and Teensy 3.6 or Kinetis MK66, is the 74HCT1G08 buffer necessary, or is it optional?

This new firmware version is compatible with before hardware ?

Yes of course. Just don’t uncomment the #include <SmartLEDShieldV4.h> for use with older shields or circuits.

Why when I donwload ZIP from Github, AnimatedGIF folder is always empty ??.

Download the release linked above, not the zip from the homepage. The reason the AnimatedGIFs folder is empty is because the AnimatedGIFs sketch is kept at a second independent repo on github and linked as a submodule. You can also download it separately if you prefer.

It is essential to put the buffers 74LS245 and 74HCT1G08 ?

The buffers are only needed if your panel doesn’t work with 3.3V signals. Some do, some don’t.

is the 74HCT1G08 buffer necessary, or is it optional?

The buffers are only needed if your APA102 LEDs work with 3.3V signals. Some do, some don’t.

As always a great update. I have been using 2 x 32x64 panels to make one 64x64 panel after seeing jasons videos running a few of the Aurora patterns. But settled on using your animated gif example which looks amazing. Heres a link to my collection if anyone is interested :

Since the update i am now using a teensy 3.5, on the old smartmatrix board without issue and using the latest animated gif software again without issue. My only question is, it it likely the Aurora software will be updated ? i did try it but it had to many compile problems which is way out of my league.

Also a quick question to Jason… off topic, i did message you via fastled regarding the ( torch) lamp you made a little while with a strip of 240 leds wrapped around a 2.5 inch tube. amazing work as usual. especially the pattern converted from the original torch. i assembled the torch and had it working in a test build until i could find a decent glass lamp to complete the build. i was using a 5v 10amp supply to power the leds as well as the teensy. using the vin and ground pin located next the the usb socket. it worked fine. until i went to relocate it and had a puff of unhappy smoke, and off it went to teensy heaven. i know the limits of the vin pin is 6 volts. so not sure what happend. i was wondering ho you power yours ?

1 Like

@mannymiller1, I just updated Aurora 2 days ago, in a new branch:

I used a Teensy 3.6. I have not tried a 3.5, but will try to soon. I’m using Arduino 1.6.12 and Teensyduino 1.31. I see that those are quite outdated now, so I will also try to test with the latest soon.

Thanks! That sounds great, have any pics or video of it before it died? I also used a 5V power supply. Did you include a large capacitor across power and ground? Data line resistor? Was it the Teensy that died, or the first LED?

Hey jason, Thanks for your reply. it was def the teensy, As i heard a nice or not so nice crack / pop sound before it died, i have a brief video of it working it didnt power after, and wasnt recognized via the usb.
I have done a fair ammount with the ws2812s but mainly with the arduino. im still quite new to the teensy, even though i have them running 3 smartmatrix setups.

i printed the base and top, internals were 12x20, but have another lamp with a taller glass but same diameter with chrome base, so may go 12x24 on the next build then take all the precautions

Brilliant news on the Aurora update., i will give it a try later. i ordered the 3.5 when they first came out, wasnt expecting 3.6 to come out so quick, so hopefully it will work fine. it runs the animated gifs great.

Interesting. Did you include a large capacitor across power and ground? That could help to protect both the LEDs and the Teensy from power surges or drops as the LEDs use more or less power depending on the number, color, and brightness of the lit LEDs.

Looks great!

Definitely let me know what you find with Aurora. If you get any compile errors, please share them via gist or pastebin.

Hi jason again… i didnt add one, but will do next time…

Ok i tried Aurora with the latest Arduino ide and teensyduino and had lots of errors regarding The gif library. so i reverted back to the exact versions of arduino ide and teensyduino you are, and upgraded to the latest version of fastLED. Still getting lots of errors I have opened a pastebin account with the error, just working out how to get them here… not sure if thats right.

i copied over the gif decoder that was supplied withn the smartmatrix library into a library folder. which seems to have fixed a few old errrors

I have reduced some of the errors… i was getting errors with the time library and tmElements_t, i changed it too TimeLib.h instead, but still getting errors regarding the animated gifs. i have downloaded Louis library which i know works well due to having it run on the 64x64 already, less errors can be seen here

Ah, yes, sorry. I had to make some slight changes to AnimatedGifs to get it to work with Aurora:

Thanks… Perfect… that cleared all the errors… one remaining
" aJson\aJSON.cpp:42:22: fatal error: pgmspace.h: No such file or directory
#include <pgmspace.h> "

Then i am good to go… i hope…

update… fixed that problem… now have another error…

Aurora64x64: In function ‘void setup()’:
Hardware.h:25: error: ‘BUILTIN_SDCARD’ was not declared in this scope

fixed that error to #define SD_CARD_CS 15, as in the old version. it seems to work for the animated gifs.

then it threw me a load of errors which went right over my head.

if i compile it under a teensy 3.6 i lose the fast led errors and get lots of irremote errors

updating the the latest ide and teensyduino i get lesser but all new errrors

Hello Louis.

Its latest version of SmartMatrix supports P2 Led Panels, 1/32 Scan, 64*64 ?.

I modified your previous version to add support for 1/32 Scan Led panels and it worked very well, except the Animated GIF with Teensy 3.6. I see that your new version seems to work well with Animated GIF, but I also need to support P2 Led Panels 1/32 Scan 64*64.

If it does not support them, I will modify the source code again to add it, I hope only need to modify the same sources, I still use the hardware for previous versions without 74AHCT374.

What exactly is the improvement for DMA? In the before version I did not notice any problem, except with Animated GIF and Teensy 3.6. Even with 3 x P2 64*64, a total of 192x64 pixels, it works perfectly with the previous version.


You should be able to modify the same source files to enable 1/32 scan. Let’s work together to get that in the next SmartMatrix Library release. Can you make a github pull request for the changes? I’ll test with the new hardware before releasing.

There’s details of the DMA changes here: Teensy 3.6 onboard sd slot

OK, thank you Louis, I will test all.
Let me check how works the “pull request”, I never I have do it before.

Hi Louis.

I do not know exactly how to make an “pull request” and lately I’m a bit busy, to do tests until I discover it. Something I was looking at, but I’m not sure yet how it is done.

These are all the modifications of the sources I made in the previous version of Smartmatrix to add support for Led panels 1/32 Scan, I have it working perfectly since then without problems with panels P2
64 * 64, in my application with 3 x P2 64*64 to make a 192x64 pixel screen.

I have looked at the sources of the latest version of Smartmatrix and they look the same for these modifications, if I do not use the new Shield V4 with a new chip to generate signals A, B, C, D (and E for panels 1/32 Scan). I do not know what specific modifications may be needed (if any) to add 1/32 Scan panels with the V4 shield, I do not have that hardware and I do not think I will use it because it would lose compatibility with what I have already done.

I will make these changes again in the sources of version 3.1.0 and I will try them, I think they will work, because the sources seem the same for these characteristics. I’m mostly interested in being able to use GIF animations with Teensy 3.6, which in the previous version gave problems.

in bold the changes/additions in every source file.

1.- Modify in MatrixHardware_KitV1, add the 5th pin (E) to Scan 1/32:

#define ADDX_PIN_0 3
#define ADDX_PIN_1 4
#define ADDX_PIN_2 1
#define ADDX_PIN_3 2
#define ADDX_PIN_4 10 // LUIS, pin E para barrer paneles con 5 pines por linea
#define ADDX_PIN_MASK ( (1 << ADDX_PIN_0) | (1 << ADDX_PIN_1) | (1 << ADDX_PIN_2) | (1 << ADDX_PIN_3) | (1 << ADDX_PIN_4) )

#define ADDX_TEENSY_PIN_0 9
#define ADDX_TEENSY_PIN_1 10
#define ADDX_TEENSY_PIN_2 22
#define ADDX_TEENSY_PIN_3 23
#define ADDX_TEENSY_PIN_4 37

2.- Modify in SmartMatrix.h (SmartMatrix3.h in v3.1.0) , add SMARTMATRIX_HUB75_64ROW_MOD32SCAN

(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 16 : 0) | (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 64 : 0) )

(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0) )

(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | (x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0) )

3.- Modify in SmartMatrix_Impl.h, Add ADDX_TEENSY_PIN_4

// fill addressLUT
for (i = 0; i < matrixRowsPerFrame; i++) {

// set all bits that are 1 in address
addressLUT[i].bits_to_set = 0x00;
if (i & 0x01) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_0);
if (i & 0x02) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_1);
if (i & 0x04) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_2);
#ifdef ADDX_PIN_3
if (i & 0x08) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_3);
#ifdef ADDX_PIN_4
if (i & 0x10) addressLUT[i].bits_to_set |= (1 << ADDX_PIN_4);
// set all bits that are clear in address
addressLUT[i].bits_to_clear = (~addressLUT[i].bits_to_set) & ADDX_PIN_MASK;

// configure the address pins

1 Like