Step 18: RGBmtx Host Software
The host software, RGBmtx, is a Processing sketch. It is a heavily hacked up version of mtxControl (thanks, Tobi!), and excellent visual animation editor for RGB matrices. Processing is a simplified version of Java, much as Arduino is a simplfied version of C++.
I have included pre-compiled executables for Windows, OSX, and Linux, which you can directly run without installing Processing on your computer. You can find them in RGBmtxAppsV1.1.zip. They still require Java, so if you don't have Java installed on your computer, download it from java.com. If you don't want to play with the source code within the Processing IDE, skip to Using RGBmtx below.
WARNING FOR THOSE USING ARDUINO 1.x
The serial buffer has been decreased to 64 bytes, which is too small for RGBmtx to properly communicate with my ColorduinoSlave sketch. RGBmtx will just freeze up your Colorduino, and not work correctly.
To fix it, you must exit the Arduino 1.x IDE and edit modify hardware\arduino\cores\arduino\HardwareSerial.cpp.
Look for the line
#define SERIAL_BUFFER_SIZE 64
and change it to
#define SERIAL_BUFFER_SIZE 128
Then restart Arduino 1.x and re-upload the ColorduinoSlave.pde sketch to your Colorduino.
If you have trouble with communication between RGBmtx and the Colorduino, try disconnecting the connection between DTR and Reset.
Working with the Source Code in the Processing IDE
The full source code to RGBmtx is contained in RGBmtxsrcV1.1.zip.
RGBmtx relies on a Java Colorpicker. Before you can run the sketch, you must copy colorpicker.jar /libraries/colorpicker/library/colorpicker.jar. Restart the Processing IDE if it's already running, so it can find the newly installed library.
Copy the contents of the RGBmtx folder to /RGBmtx, and load RGBmtx.pde into Processing.
You should be able to launch it by clicking the Run button in the Processing IDE.
If your Colorduino is connected to your host PC via a serial port, RGBmtx will automatically find it. The scanning for the device occurs only on startup, so make sure to connect it to your computer before launching RGBmtx. If the Colorduino is not connected, then Device:Slave will be grayed out, and you will only be able to run it in Record mode.
To create animations for your matrix, simply use the built in editor in Record mode. When editing frames while the Colorduino is connected, the matrix will instantly update in realtime. Click on the color patches to select the current drawing color. To select a color which is not in the default palette, hold down the CTRL key while clicking a color patch to pull up an RGB color picker (Note: for some reason that I can't figure out, pulling up a color picker sometimes freezes up RGBmtx. Therefore, make sure you save your work first). The little buttons on the right, bottom, and bottom right corner allow you to fill a whole row, column, or the entire matrix with the currently selected color. You can use the matrix as a mood light by filling it with a single color.
To save a set of frames to your PC, click Save to: File. RGBmtx can save in two different formats: BMP and MTX. If you specify a filename without an extension, it will save to Windows BMP format, and the filename will automatically be appended with .bmp. If you specify a filename ending in .mtx, the data will be saved in a text file format instead. You can also create or edit animations with any BMP-compatible graphics editor (.bmp), or, if you prefer a text editor (.mtx).
To load a previously created frame set, click Load from: File. If you specify a filename without an extension, it will automatically append .bmp. If you want to load a .mtx file, you must explicitly type the whole filename. I have included some sample framesets in framesets.zip, which you can download below.
You can cycle through RGBmtx's various modes by repeatedly clicking the Mode button. The modes are:
Record - create or load a frame set
Play - play the currently loaded frames. I have attached some sample frame sets below.
Plasma - run plasma mode
Snow - display a snowflake-like effect
Meteor - similar to Snow mode, but with trails
Music - music synchronization mode. Optional. You must add the music synchronization circuit described in the next step.
In the Play, Snow, and Meteor modes, you can control the playback speed with the up and down arrow keys on your keyboard.
framesets.zip contains the following sample framesets:
spaceinvaders.bmp - Space Invaders
tetris.bmp - Tetris simulation
music.bmp - suitable for synchronizing with music
If you make any framesets that you think are really cool, please send them to me, and I'll make them available for everyone to download. For that matter, please send me any good upgrades you make to RGBmtx or my Colorduino library.