C0d1ng4fun

LED Matrix Animation

2015

Emulator visualization.
Desktop application with scrolling 'Hello'.
Assembly printout of scrolling 'Hello'.

Producing and deploying animations to LED Matrix 2 has never been easier. The LED Matrix 2 has a controller to drive the display but use hardcoded content. Creating frames and animation require updating the firmware of the controller. This project implements a configurable animation environment so that animation can be uploaded to the display remotely through a Bluetooth interface while it is in operation, from either a desktop or an Android application.

Animations are represented by a program that runs in a small virtual stack machine to generate content to be displayed. The ATmega8 has 1kB of SRAM, a frame buffer is not an option. Encoded frame data is stored in the program as a special instruction and is decoded on the fly. There are several "registers" in the machine to control offsets within the data to produce scrolling effects without duplicating any data. Here is an example program that infinitely repeats a scrolling "Hello":

Label Addr Operation Operands ----- ---- --------- -------- 0 CONSTANT_SCREEN 0 program_start_1 2 PUSH 65504 5 PUSH 63 scroll_3 8 SWAP 1 10 FRAME_LOAD OFFSET_X 12 PUSH 1 15 ADD 16 SWAP 1 18 CALL 28 (frame_2) 21 LOOP 8 (scroll_3) 24 POP 25 JUMP 86 (scroll_end_4) frame_2 28 PUSH 4 frame_repeat_5 31 FRAME1 88 0A 00 00 88 0A 00 00 89 CA 70 00 FA 2A 88 00 8B EA 88 00 8A 0A 88 00 89 CA 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82 LOOP 31 (frame_repeat_5) 85 RETURN scroll_end_4 86 PUSH 0 89 FRAME_LOAD OFFSET_X 91 POP 92 JUMP 2 (program_start_1) 95 STALL

Programs are built from a software model through a Java API (which is shared between the desktop application and the Android application). It generates a binary representation of the program as well as assembly, with named labels, for debugging. At the lowest level the model represents single instructions that can be executed in the display. There is also a higher level program builder that can combine scrolling text and frames in loops etc. for animation.

The Android application allows small text messages to be entered and sent to the display. This is sufficient for quick messages at social gatherings. More complex animations can be created in the desktop application.