Libraries for remote control over USB

Hi y’all,

I’m relatively new to Teensy (and Arduino and embedded computing in general), so this may be a rather basic question.

I have a Teensy 3.6 with SmartLED shield v4 controlling a few HUB75 matrices, hooked up to a Raspberry Pi 4 via USB. Ultimately I’d like to be able to send packetized commands to the Teensy from the Raspberry Pi over USB to make API calls given by the SmartMatrix_GFX library.

I’ve been able to accomplish this via what seemed to be the most basic method, namely sending commands via the serial monitor that are read with and call something using the SmartMatrix3 library (I have not actually tried SmartMatrix_GFX yet). However I understand that there a number of ways in which this could be improved - such as using packets, buffers, JSON, TPM2, OPC, DMX, ArtNet…

I have been trying to find a software library to improve this process, but so far everything I have looked at or tried either is not compatible with Linux+Teensy 3.6, or suffering from bit rot and I cannot get it to compile.

Things I have tried, or looked into:

  • Aurora, which uses TPM2. I was not able to get it to compile and gave up after a few hours. But the code in looks like something I could use.
  • The SmartMatrix FadeCandy port. I didn’t really expect this to work just because it was not adapted for Teensy 3.6 AFAIK. This uses Open Pixel Control though, which might be something I find useful.
  • ALA (Arduino Light Animation) and ALAWeb. Not compatible with Teensy 3.6.
  • PixelController - seems like it might work, I found this config file for SmartMatrix but it’s from 2015 so I’m guessing it won’t work with Teensy 3.6.

There’s a few other things I’ve looked at too but those are the main ones. As you can see, my main issue seems to be that nothing I’ve tried is compatible with the Teensy 3.6. This seems like a problem that many people would have though, so I assume that something out there exists and I just haven’t found out or overlooked it.

To be clear, I’m mostly looking to solve the USB communications problem, but I’m also interested in controller software like OPC, Jinx (which is Windows only, unfortunately). For now I am just trying to get the HUB75 matrix working, but eventually this project will include APA102 and possibly WS281x’s, so I’m trying to get something that works with SmartMatrix_GFX.

I’m not married to using USB serial, I would be fine with Ethernet, and I have some ESP’s sitting around that I can do tests with, but based on how my project will end up being used I’m trying to avoid wifi. I’m considering using a protocol like DMX or ArtNet, but being able to pass something like JSON files around seems like it would provide more flexibility. For now though, I’m interested in just about any sort of library that will packetize the USB communications and go from there.

Thank you in advance!

Hi, good well researched question! There’s no easy answer, but some hopefully promising directions.

Aurora can run on the Teensy 3.6, sorry it’s not easier to do so right now, but there’s info in here on how to get it to work: Too many errors compiling Aurora sketch

I just tried compiling the SmartMatrix Fadecandy port and it compiled to my surprise, not sure if it runs. It has worked on the Teensy 3.6 in the past. There might be some bit rot to clear after a number of years of no one that I know of running it. I do plan on really finishing up that port and getting it integrated into Fadecandy. I did just this last week put some work into a Teensy 4 Fadecandy port:

ALA and PixelController I’m not that familiar with.

I’m going to be focusing on Fadecandy for streaming to LEDs over USB for my projects/products. With my Teensy 4 port, you can drive APA102 and HUB75 panels, and with the original Fadecandy Controller you can drive WS2812s.

Hope this gets you going in the right direction. Please post back with questions or updates!

Thanks, I had not yet seen that thread on compiling Aurora. I’ll give it another shot soon.

Yeah I was also able to get the Fadecandy sketch to compile (I just realized I wasn’t clear about that in my post), but I could not get it to work (I only spent a few minutes doing so though).

I spent the evening since writing this trying to work with PixelController and TPM2, mostly borrowing code from Aurora but nothing yet on the PixelController side besides figuring out how to get it to compile (short version: use Java 8 and the latest version of Maven, not the suggested old version). I am having some early success - enough to make me think I can get it working. I’ll update once I have more to share.

Progress update: I’ve mostly stolen the code from StreamingMode.h for Aurora and made it so that the LED matrix can read and execute a couple of commands sent via the TPM2 protocol with packets sent using pyserial from the Raspberry Pi… At the moment this repo is completely bare bones and will be developed into a project that goes beyond this. Once I have a stable configuration for this I’ll fork it off into its own repo for just that function.

I’ve spent a few hours looking around PixelController but the code base is big enough that I haven’t actually figured out how to use the CLI, and I don’t have a GUI installed on my RPi so I can’t try GUI mode. In any case I don’t know Java, so I might just reinvent the wheel and make a Python library instead.

I was working on other parts of the project in the interim, but have gotten back to this this weekend. Sending commands over USB serial and parsing them into SmartMatrix commands is now working at an absolute bare minimum level in the library I linked above.

I think it would be painful for anyone else to read the code right now, since I am very much a low-level novice at Python and C/C++, and programming in general, but with enough elbow grease it might evolve into a full API for SmartMatrix someday.

I ditched TPM2 and the Aurora code. There is now just a dead simple parser on the Arduino side. The format for commands is currently <command+args+> sent over serial, and there are debugging prints sent back. Everything is subject to change, though. On the Raspberry Pi side, there is a virtual representation of the Arduino, its connection, and possible commands in Python. The goal is to be able to make it compatible with a wide range of front-ends, as I eventually want to evolve this into a custom hardware controller.

The goal for tomorrow is to hook this up to a web interface.