Creature Controller

I’ve got two versions of the Creature Controller. One runs on a Pi Pico 2040 and handles DMX decoding on the Pico itself via an RS-485 connection. The second runs on Linux and uses a Pi Pico as a microcontroller that talks to the motors.

The Pi Pico version is older. I’ve re-written it to Linux to make it easier for me to use. When it’s running on the Pi Pico alone, when I need to make changes to the creature’s configuration I need to do the edit code → compile code → flash to the Pi Pico dance. While I can do that pretty quickly, it’s not a super fast process. The Linux version defines the creature as a JSON file and loads its configuration at runtime.

Linux Version of the Creature Controller

I say “Linux,” but it runs on macOS too. 😍

The Creature Controller uses E1.31 for DMX-over-UDP as its control protocol from the Creature Server. The Linux host talks to a Pi Pico 2040 over a simple USB Serial (CDC) connection. Since TinyUSB implements the CDC protocol correctly, I don’t even need drivers on the Linux (and macOS!) host. Just plug it in and look for the device node.

How to Build It

First off, grab the source from GitHub.

Inside the source there are two distinct projects. One is called controller, which is the Linux software itself, and one is called firmware. This is what runs on the Pi Pico 2040.

The controller software complies down to a normal Linux binary, and the firmware compiles down to a uf2 file, as is typical on all Pi Pico projects.

You have to build each project independently. (See the GitHub action for how I do it for CI.) This is because CLion, the IDE that I use, is unable to handle two different toolchains in one project. If I try to combine them together it will attempt to use the normal C++ compiler on it, and it will fail in horrible ways.

cd into each of controller and firmware and type mkdir build && cd build && cmake .. && make -j4 to get binaries. The controller has unit tests that get built at the same time.

Original Pi Pico 2040 Version

I call the code that runs on the creature itself the “creature controller.” It runs on a Raspberry Pi Pico 2040.

It’s written in C++, and uses FreeRTOS.