Inspiration

A brother in Tommy's fraternity wanted to rig up a set of custom animated LED strips that would flash along to his favorite dancing playlist that he would use for social events, but the setup of such lights was an involved task. In order to complete the lighting rig, he had to write the programming himself. As someone who didn't have a CS background, this took him almost 30 hours of combined work. This inspired our team to create aniMATE, so that creating animated lighting for LED decorations is more accessible, quick, and code-free.

What it does

aniMATE is a system that can parse through bitmap files, and control an attached LED strip. It emulates a USB mass storage device, allowing a user to drag-and-drop any bitmap file they desire into aniMATE. Bitmap files can be easily created in any commonplace painting software, such as Microsoft Paint. Since a light strip is one-dimensional and a bitmap is two-dimensional, each row of pixels in a given bitmap file represents one frame of animation in the light strip. So, if one is using a bitmap of 6x5 pixels, that means that a 6-frame animation is being made for a string of 5 lights.

How we built it

Our development environment was VSCode with the Arduino Command Line utility integration, Processing.exe for aniMATE application, and a GitHub repository to store the code. We started with a few code libraries, namely Adafruit_InternalFlash to use the ARM Cortex M0 chip's built-in flash storage, Adafruit_TinyUSB to handle the USB stack, and Adafruit_ImageReader to parse the bitmap file for dimensions and colors. Then, we used an example sketch from the Adafruit_TinyUSB library to emulate a mass storage device and verified that files could be written to the drive and retained after a power cycle. Then, we found a file called /pix.bmp in the root directory and parsed it for bitmap content. The resulting graphics canvas was used to determine the number of LEDs and the number of frames in the animation. We generated the current frame number using the number of milliseconds elapsed since startup multiplied by the number of frames and divided by the cycle duration in milliseconds. Finally, we iterated through each pixel in the strip and set the color to the pixel corresponding to the current frame number and the LED number.

Challenges we ran into

For a while, we had some issues with reformatting the emulated mass storage device. The disk utility would allow the device to be erased with a modern disk format, so we had to use a FAT/MS-DOS file format. We also had difficulty combining all of the necessary libraries to make the full system work. By using VSCode, we were able to trace references to C++ objects back to their libraries and check the datatypes in function calls.

Accomplishments that we're proud of

We are proud of how quickly this project came together in a span of under 24 hours. We were able to apply skills we learned in CS courses--both high-level and low-level--to make the proof-of-concept a success. The concept was a success, as the device could be plugged in to a computer without any programming IDE, and the stored bitmap file could be modified using built-in image editing programs.

What we learned

We learned about USB stack, mass storage devices, image processing, java.awt libraries, and the file format of bitmaps. We also learned about how to collaborate using Git, Processing.exe, and VSCode. Since we were all working on the same directory, we needed to communicate with each other about what our roles were for the project. When we encountered problems that greatly hindered success, we brainstormed approaches to overcome the challenges, finish the project in far less time than if each individual was responsible for their own debugging.

What's next for aniMATE

Currently, the proof-of-concept for aniMATE does not allow the user to specify the duration of the animation, so the next step will be to create a settings.txt file that allows the user to configure the device. Since the animations are drawn simply by specifying a frame number, it would be possible to control the animation with external sensors. For example, a microphone could be used to select the frame, where louder volumes correspond to greater frame numbers. After some bug fixes and feature additions, aniMATE will be ready to give artists both young and old access to a modern creative medium: LED light animation.

Share this project:

Updates