This is part two of my first Arduino-related project, exploring the use of an accelerometer.
In the first part of this project I had to revise the Rainbowduio firmware. I was surprised to discover the firmware provided did not support the ability to address individual pixels, so I set forth to first revise the firmware to support that before doing anything else.
The new function I added to the Rainbowduino is called SetPixelXY (which I used to draw the pattern in the image above), it allows you to set any pixel to any color from an Arduino controlling the Rainbowduino via the I2C interface. I was surprised to discover this functionality was not included in the current version of the firmware. Great thing about open source: I was able to look over the code, look over other examples, and change the Rainbowduino's functionality.The Rainbowduino is a very interesting platform to work with for controlling LED displays. You can string a number of them together and address them individually via the I2C bus.
Once I could address individual pixels on the Rainbowduio, I set forth to write a simple program (I did not want to get too complicated in my first adventure with the Arduino) that indicates on an LED display the direction of the tilt. I found a nice breakout board for Freescale’s MMA7260QT ±6g Triple-Axis Accelerometer available from Pololu, and I combined that with a bright and versatile 8x8 RGB LED matrix (which works nicely with the Rainbowduino), thus the name, Color Tilt. Here's a video showing how it works:
Zip file you can download includes my source code for "Color_Tilt_v2" and "Rainbowduino_CMD_v2" along with a wiring diagram that shows how to load the Rainbowduino via it's serial connection (it does not have USB) by piggybacking off the Arduino (which saves you some dough as you don't need to purchase a USB-Serial interface board), a tip I got from uRaNGaTaNG. The code is very simple, but it's a fun place to start to experiment with an accelerometer and an 8x8 RGB LED matrix. This matrix, under control of the Rainbowduino, has lots of potential, and they can be combined to make large grids with each a separate device on the I2C bus.
Steps for loading a sketch into the Rainbowduino using the Arduino as a USB-Serial adapter:
Feel free to contact me with comments or questions or suggestions of what to do next.