I bought two Rainbowduinos from seeedstudio and wanted to play a bit. A Rainbowduino is basically a 8x8 led matrix driver with a I2C interface. This image shows two rainbowduinos, each with a 8x8 RGB Matrix, in action:

I used my Processing library and some custom Java code (using rxtx library) to display animations (amongst others is use the blinkenlights library) on the rainbowduino. This little video is the outcome after some hacking:
2xrainbowduinos + 1xarduino = fun from michu on Vimeo.
preview of my rainbowduino/arduino firmware and the java tool to create some fancy stuff…
I use an Arduino (Duemilanove) as serial / I2C gateway, here is the wiring scheme:

I published my firmware (Arduino firmware, Rainbowduino firmware and processing library) at google code.
GPL’ed source: http://code.google.com/p/neorainbowduino/
My firmware is more or less a rip-off of the “daft punk” firmware by Scott C / ThreeFN (Rainbowduino firmware) and the blinkM firmware (Arduino) firmware. I removed unused code as I keep my Arduino/Rainbowduinos stupid - I just want to send frames from my workstation to the Rainbowduinos. I had to add some sanitychecks to the Rainbowduino firmware to make it stable.
Here are some features of the firmware:
- Send buffer from your workstation to the Rainbowduino
- Stable, running more than 5h (at 115’200 baud)
- Fast, more than 50 fps with two Rainbowduinos possible. One frame needs ~100 bytes
- Multiple Rainbowduinos supported (I2C protocol)
- Heartbeat, the Arduino tells you each second if he is still alive and its error counter
- Processing library availble to mess with Rainbowduinos
How to use the Firmware
1) Install Arduino IDE
Get the latest Arduino IDE from here, and install it. You also need to install the MsTimer2 library.
2) Patch Arduino I2C library
Per default the Arduino I2C protocol uses 100kHz to communicate - we need 400kHz. The detailed how-to can be found at the Arduino Forum, here is a short step by step introduction:
The atmega-hardware can do 400 KHz, but you have to tweak the Wire-library in file hardware/libraries/Wire/utility/twi.h. Near the top of the file you see:
1 2 3 | #ifndef TWI_FREQ #define TWI_FREQ 100000L #endif |
If you change that to
1 2 3 | #ifndef TWI_FREQ #define TWI_FREQ 400000L #endif |
The I2C bus should now run at 400kHz. But you also have to the delete the files hardware/libraries/Wire/Wire.o
hardware/libraries/Wire/utility/twi.o because the library must be re-compiled before it uses the new speed.
(This is done automaticaly when you open the Arduino-IDE)
3) Wire up Arduino/Rainbowduino
Connect your Arduino serial ports with the serial port of the Rainbowduino:

(img source)
This allows us to flash the Rainbowduino with the Arduino IDE (I use Rainbowduinos with an Atmel 168 uP, NOT the 328!)
4) Update Rainbowduino Firmware
Upload the Rainbow_V2_71.pde firmware to the Rainbowduino (select ATmega 168 board). Remember to change the I2C adress for multiple devices, the I2C adress is specified in the Rainbow.h file:
1 | #define I2C_DEVICE_ADDRESS 0x06 |
5) Update Arduino Firmware
Upload the neoLed.pde firmware to the Arduino. I had to disconnect the Rainbowduinos
rx/tx lines - else the upload failed (do not forget to select ATmega 328 board). If you changed the I2C adresses of the Rainbowduino slaves do not forget to change the initial part:
1 2 3 4 | //clear both rainbowduinos - //hint init will fail if both rainbowduinos are not available! BlinkM_sendCmd(0x06, serInStr, 96); BlinkM_sendCmd(0x05, serInStr, 96); |
6) Connect I2C Bus
For I2C, you need 3 cables (SDA,SCL,GND):
- (+) and (GND) from Arduino to Rainbowduino I2C pins.
- Arduino analog input 4 = Rainbowduino I2C SDA
- Arduino analog input 5 =Rainbowduino I2C SCL
Additional Information: I2C cable length
Summary from http://www.i2cchip.com/i2c_connector.html#Bus%20Length
- Use screened and twisted cable for runs between boxes. DON’T twist SDA and SCL together. Look at our bus, and either pair them with gnd, or pair SDA+VDD and SCL+GND
- Don’t run the bus fast if you don’t need to
- Run the bus at higher currents
- Cable length maximal 8m
Useful links:
- http://www.rngtng.com/mtxcontrol/
- http://sites.google.com/site/joetcochran/thejoyliteproject
- http://www.arduino.cc/playground/Learning/I2C
- http://thingm.com/products/blinkm
- http://www.seeedstudio.com/forum/viewforum.php?f=11
- http://code.google.com/p/rainbowduino-firmware/

3 Comments
1 Icing wrote:
The title of
4) Update Arduino Firmware
and
5)Update Rainbowduino Firmware
should be exchanged.
2 michu wrote:
Thanks! It’s fixed now.
3 mel.o wrote:
OK look. I’m an artist, I have cool ideas to do for rainboduino but I don’t have the head for all these complications. I just want to tell each led what color to be, how bright, and for how long. Is that too much to ask? How much would I have to pay you to set it up for me?
2 Trackbacks