Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 13 of 13

Thread: SmartLED Shield for Teensy 4 - Drive RGB Matrix with 10k+ Pixels

  1. #1

    SmartLED Shield for Teensy 4 - Drive RGB Matrix with 10k+ Pixels

    I'm excited to announce that the SmartLED Shield for Teensy 4 campaign has launched on Crowd Supply!



    The shield makes it easy to drive high quality graphics to HUB75 RGB matrix panels using the Teensy 4. As with my previous Teensy 3 based shields, this is a fully open source project: you can find the hardware files, and the work in progress but very functional latest branch of the SmartMatrix Library up on GitHub. If you don't want to wait for the shield to come out, there's an adapter board you can order (e.g. through OSH Park) that plugs into the SmartLED Shield for Teensy 3, or pick up a few ICs and a bunch of jumper wires and you can wire up the circuit yourself.

    The Teensy 4 shield truly wouldn't exist if not for open source, as I wasn't planning on porting SmartMatrix Library to run on the Teensy 4. SmartMatrix Library user Eric Eason figured out how to drive HUB75 panels with the DMA and FlexIO peripherals in the Teensy 4 (not an easy task!), and integrated his work into SmartMatrix Library, and we collaborated on the new SmartLED Shield.

    As with SmartMatrix Library and SmartLED Shield for Teensy 3, you get easy to assemble hardware, an accessible to program but powerful Arduino Library with a variety of examples, and the refreshing happens in the background (using interrupts and DMA) with high-quality graphics by default (36-bit color refresh, high refresh rate, automatic gamma correction). The Teensy 4 is so powerful, both the pixel count and refresh rate can be doubled compared to the Teensy 3 while keeping the same quality graphics. You can drive 128x64 pixels with 240Hz refresh rate, 36-bit color refresh, and plenty of CPU cycles and memory left to generate cool graphics or do other things needed for your application. 120 Hz refresh rate looks pretty smooth to most people, but 240Hz looks good on camera too, and just a little bit above 240Hz even looks good on a phone's 240Hz slow motion video setting.



    If you're willing to lower the quality a bit, you can drive even more pixels. 128x128 is very doable even with 36-bit color, though that is a long string of data that needs to be refreshed thousands of times a second. The long string is limiting the max refresh rate to 168 Hz, and limiting the max brightness as the LEDs need to be off sometimes while waiting to shift out the next set of data.

    https://youtu.be/QCdK5VGg_n8

    The latest SmartMatrix Library branch (which will be released later this year as SmartMatrix Library 4.0) has support for driving APA102 LEDs using DMA and FlexIO on the Teensy 4. The Library takes advantage of the Global Brightness Control (GBC) bits on APA102 LEDs to get more color depth, and refreshing is done in the background just like with HUB75 panels.

    I'm really looking forward to seeing what kind of projects can be made with SmartMatrix Library and the power of the Teensy 4.
    Last edited by embedded-creations; 08-20-2020 at 11:57 PM.

  2. #2
    Congrats! I'm very happy with how the performance turned out.

    I believe this is the first LED shield designed for Teensy 4!

  3. #3
    Thanks Eric! The OctoWS2811 Adapter supports Teensy 4, but I think it was designed years ago. Only Paul could tell us if it was designed for the Teensy 4 :-)

  4. #4
    Here's a link to the benchmark sketch if anyone is interested: https://gist.github.com/embedded-cre...91415dc6056b28

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,849
    One minor comment about the pinout. There are likely very good reasons for using it (flexio, dma, etc.) but using pin 8 would make it harder for a Teensy 4.0 to handle sound input via an I2S microphone.

    All of the other main I2S1 pins (7, 20, 21, and 23) are free. Unfortunately, the I2S2 pins are also used, so you can't use that. There are the S/PDIF pins (14, 15), and of course using an analog input pin for a traditional microphone. But I don't know whether people who build these things do adaptive sound graphics using a single board.

    But it may be possible on the Teensy 4.1 to use pin 38 as an alternate IN1 pin. If you wanted to use the audio shield, you would need to jury rig a wire from Teensy 4.1 pin 38 to audio shield pin 8 (plus of course the necessary changes in software to use the alternate pins).

    But good work!

  6. #6
    You have a great point! In order to get the right pins for FlexIO without resorting to any of the T4.0 back side pins, it's necessary to block either pin 7 or pin 8 from the audio board. However, the shield provides an option to switch from pin 8 to pin 7, so that would enable sound input (but not sound output).

  7. #7
    By the way, it's possible to use a pinout that leaves all the audio pins free, but it needs pin 32 (so you either need to use T4.1 or solder to the back of T4.0). If anyone is interested in building such a board, I can provide more details. SmartMatrix library supports those configurations as well.

  8. #8
    Quote Originally Posted by MichaelMeissner View Post
    using pin 8 would make it harder for a Teensy 4.0 to handle sound input via an I2S microphone.
    Good point. I wasn't sure if I2S/Audio Shield compatibility was important enough to include in the description on Crowd Supply, but it will be documented somewhere. I'm also considering asking for feedback from backers on what functionality they might want to use more, and setting the jumper accordingly. Right now pin 8 is blocked, so getting I2S audio out from the Teensy is possible, but not I2S audio in. This would support the use case of a device generating audio, and also doing music visualization of the audio for example.

    You can cut a trace and solder a jumper and now pin 7 is used, and pin 8 is free for I2S In. That would support the use case of a device receiving audio and doing music visualization of the audio. I did actually test that with the Audio Shield with electret microphone added.

    Can you recommend a popular I2S microphone breakout that works with the Teensy 4 and Audio Library? I think using the Audio Shield with the SmartLED Shield is a little inefficient as it's not easy to plug in, the microphone has to be added to the shield, and there's a lot of functionality on the Audio Shield that isn't needed for that use case.

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,849
    Quote Originally Posted by embedded-creations View Post
    Can you recommend a popular I2S microphone breakout that works with the Teensy 4 and Audio Library? I think using the Audio Shield with the SmartLED Shield is a little inefficient as it's not easy to plug in, the microphone has to be added to the shield, and there's a lot of functionality on the Audio Shield that isn't needed for that use case.
    I can't, but I'm sure others can. As I said, I imagine for visualization, that a plain analog microphone might be sufficient. I'm mostly just a dabbler.

  10. #10
    I agree about the plain analog microphone, but the Audio Library doesn't support ADC analog microphone input on the Teensy 4, as far as I was able to tell when trying this last week.

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,726
    I'm posting this to our blog now and will give it a shout-out on social networking. Hopefully that helps with the crowd funding campaign.


    Quote Originally Posted by embedded-creations View Post
    Only Paul could tell us if it was designed for the Teensy 4 :-)
    Indeed the OctoWS2811 shield was designed in the days of Teensy 3.1.

    When I ported OctoWS2811 to Teensy 4, I made it configurable to use any group of pins (less than 8, exactly 8, or more than 8). The default pin list is the same pins that old OctoWS2811 uses, which of course were chosen for an 8 bit port that didn't conflict with the SPI pins.


    Quote Originally Posted by embedded-creations View Post
    I agree about the plain analog microphone, but the Audio Library doesn't support ADC analog microphone input on the Teensy 4, as far as I was able to tell when trying this last week.
    Indeed ADC input for Teensy 4.x in audio library is still a work in progress. It sort-of works, but has many limitations. The DC level isn't tracked, so just a fixed constant is used. The input is approx 4X oversampled with a FIR filter that hasn't been tuned well. The overall gain isn't set well. Other lesser issues also remain, but those are the main ones.

  12. #12
    I'm in the process of adding the Teensy 4 as a USB device in Fadecandy Server, and have some great results to show as of this morning. Fadecandy Server easily handles pushing pixels for a 128x64 display at 60FPS to the Teensy 4, while the Teensy 4 is refreshing a HUB75 panel using the SmartLED Shield.



    A little background: "Fadecandy is a tool for creating interactive light art using addressable LED lighting" designed by Micah Elizabeth Scott (scanlime), and was made to drive WS2811 "Neopixel" addressable LEDs over USB with higher color depth and smoother interpolation than they normally have. I'm a fan of the high quality fades and colors that can be made with Fadecandy, and don't know of a better open-source cross-platform tool for driving LEDs over USB. The Fadecandy Controller design was based on the Teensy 3.0, and could handle up to 512 WS2811 pixels per controller, scaling to much larger installations with multiple controllers. I ported the Fadecandy Controller firmware to drive HUB75 panels with the SmartMatrix Library on larger Teensy 3 models, and used it for displays as large as 64x32 (2048 pixels), with the Full Speed USB bandwidth being the limiting factor for frame update rate. The Teensy 4 has High Speed USB with a lot more bandwidth (one benchmark I saw said 3.5MB/s from PC to Teensy), so I was excited to see how large of a display could be refreshed with Fadecandy Server driving the Teensy 4.

    I added Teensy 4 support specifically to drive HUB75 panels or APA102 LEDs using the SmartLED Shield for Teensy 4, but the modifications I'm making to Fadecandy Server can be used for other applications. I believe Paul's OctoWS2811 library update for Teensy 4 supports driving more than 8 strips of LEDs in parallel, and may only be limited by RAM and the number of pins on the Teensy 4, so some of the pieces are in place for a "Fadecandy Controller 2.0" if anyone wants to work on that.

    Some technical details: I ended up just using the Teensy USB Serial driver and writing the framebuffer to the serial port using fstream. I originally wanted to use the efficient custom USB driver that Micah wrote for the microcontroller family used on the Teensy 3, but it seemed like too much work to port that to the Teensy 4, and would probably involve modifying Teensyduino which I didn't want to do. I then wanted to use libusb to write data to the USB Serial device, but at least on the Mac the default serial port driver was claiming the device and libusb couldn't get access. Writing to a COM port seemed like a last resort, as Fadecandy elegantly identifies USB devices by their serial number so hot swapping devices works really well, and using COM ports by name would likely break that. I then found libusbp which can return the port name of a device given its serial number, which seemed like a roundabout but decent way to identify the device by serial number and connect via port name.

    The code isn't ready to share yet as it's been hacked together over the last 24 hours. If anyone wants to help out with some of the remaining pieces that aren't in my area of expertise, I'd be happy to put it up on GitHub before it's 100% polished and ready to go. Specifically I could use help with compiling in libusbp (Fadecandy uses CMake), and making sure things work on other platforms (I only tested on MacOS Catalina). Please let me know!

    Here's a link to the full 1080p quality demo video on Vimeo: https://vimeo.com/454405793/2e8d288b81

  13. #13
    I just posted details of a project I made with the SmartLED Shield for Teensy 4 and a Teensy 4.1 here: https://forum.pjrc.com/threads/63080...739#post252739


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •