Arduino, Rainbowduino, 8x8 rgb matrix ?

Knowledgeable people, help with uncomprehending :frowning: (websites read, understood nothing)
There are:

  1. Arduino board to AtMega168
  2. Rainbowduino (http://www.seeedstudio.com/depot/rainbowduino-led-driver-platform-plug-and-shine-p-371.html)
  3. square 8 * 8 LED Matrix - super bright RGB (http://www.seeedstudio.com/depot/60mm-square-88-led-matrix-super-bright-rgb-p-113.html)

And now the questions:

  1. The board Rainbowduino microswitch for what ?
  2. When programming Rainbowduino whether to pull out of the Arduino AtMega168 ?
  3. When programming for the UART interface connection boards Arduino <> Rainbowduino in this order: tx<>txd, rx<>rxd, reset<>dtr, 5v<>vcc, gnd<>gnd. Right ?
  4. When programming for I2C interface as these two boards to connect ?
  5. When connecting multiple boards Rainbowduino (for more opportunities), they both need each other to connect ? And for synchronous concurrent operation, which of these boards will be the master and slave (in fact on each of them is a microcontroller) ? Or for a realization of their work need an external circuit with my microcontroller ?

Hi,
many of the info you need are in the Rainbowduino manual:
http://www.seeedstudio.com/depot/images/product/Rainbowduino_Manualv1.1.pdf

Answers to your questions:

1- The micro button is used to RESET the board.

2- If I understand your question, you're asking "How to pull the 168 out of the board": it's soldered, you can't replace the 168.

3- If you are using the UsbUart, just connect it so that the Uart and Rainbodwuino serial pins are lined from the top.
Anyway, the Uart_TXD goes into Rainbow_RXD, and Uart_RXD goes into Rainbow_TXD.
Check the manual for more information.

4- For I2C, you need 4 cables (or just 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

5- Check this: Arduino Playground - I2C
To put it simple, multiple boards are chained using the I2C bus,
a unique address can be assigned to each board to receive commands,
and you use Arduino as the I2C master.
Then you can do whatever you want, but this is the simplest working configuration for multiple boards.

Read the forum posts about I2C
you'll find many useful information.

And try to understand as much as possible from the Rainbowduino manual, it's a good start:
http://www.seeedstudio.com/depot/images/product/Rainbowduino_Manualv1.1.pdf

Hope this helps,
good luck,
kk

I apologize for the obvious question.
But here you can give a simple code. As with Rainbowduino on 8x8 rgb matrix to light only one LED (for example the extreme lower left) alternately - red, green and blue colors ?

This is not supported in the out-of-the-box firmware. You will need to write your own function to display anything other than what's the built-in functions:

  1. Displaying all of 1 color on all 64 LEDs
  2. Displaying a character (0-9, A-Z, a-z) in any one color
  3. Displaying a preloaded image (like the test pattern)

You may want to try this code on the Rainbowduino:

void DispshowCustom(void)
{

unsigned char color,row,dots;
int i;

RainbowCMD[1]=0;

byte wholerowdata;
byte dotpair;

//render
for(color=0;color<3;color++)
{
for (row=0;row<8;row++)
{
if (color == 0)
wholerowdata = RainbowCMD[13+row]; //green rows in 13-20
if (color == 1)
wholerowdata = RainbowCMD[5+row]; //red rows in 5-12
if (color == 2)
wholerowdata = RainbowCMD[21+row]; //blue rows in 21-28
for (dots=0;dots<4;dots++)
{
dotpair = 0x00;
//higher order 4-bits
if ((wholerowdata<<(dots*2))&0x80)
dotpair|=0xF0;

//lower order 4-bits
if ((wholerowdata<<(dots*2+1))&0x80)
dotpair|=0x0F;

dots_color[((Buffprt+1)&1)][row][dots]=dotpair;
}
}
}

Buffprt++;
Buffprt&=1;

}[/quote]

Each byte in the array is made of 8 bits. Each bit tells you which LED in that row to turn on.

I've increased the size of RainbowCMD array to 29 bytes. So you'll need to modify receiveEvent in the Rainbowduino code and SentCMD in the Seeedmaster code accordingly.

I'm in the middle of a write-up so I wish I could give you more, but I hope this helps.

Thanks

FastCat asks,

But here you can give a simple code. As with Rainbowduino on 8x8 rgb matrix to light only one LED (for example the extreme lower left) alternately - red, green and blue colors ?

I wanted to do the same thing, you'd think that setting pixel at x,y to color r,g,b, would be included in the basic firmware, but it's not. After looking over the code and some examples of what other people have been doing with firmware modifications, I ended up modifying Rainbow_CMD_V2_0.pde (supplied by Seeedstudio) and added a new command: SetPixelXY, which sets a particular pixel to a particular color. The code for the new command, which I added to Rainbow_CMD_V2_0.pde, looks like:

//==================================
// setPixelXY extends command set
// function: sets a specific pixel to a specific color
// x,y coordinates packed into the fifth byte of CMD stream
void setPixelXY(void) {
unsigned char x; unsigned char y;
unsigned char r; unsigned char g; unsigned char b;
r=(RainbowCMD[2]&0x0F);
g=((RainbowCMD[3]>>4)&0x0F);
b=(RainbowCMD[3]&0x0F);
x=((RainbowCMD[4]>>4)&0x0F);
y=(RainbowCMD[4]&0x0F);
RainbowCMD[1]=0;
x &= 7;
y &= 7;
if ((x & 1) == 0) {
dots_color[Buffprt][0][y][x >> 1] = r |
(dots_color[Buffprt][0][y][x >> 1] & 0xF0);
dots_color[Buffprt][1][y][x >> 1] = g |
(dots_color[Buffprt][1][y][x >> 1] & 0xF0);
dots_color[Buffprt][2][y][x >> 1] = b |
(dots_color[Buffprt][2][y][x >> 1] & 0xF0);
} else {
dots_color[Buffprt][0][y][x >> 1] = (r << 4) |
(dots_color[Buffprt][0][y][x >> 1] & 0x0F);
dots_color[Buffprt][1][y][x >> 1] = (g << 4) |
(dots_color[Buffprt][1][y][x >> 1] & 0x0F);
dots_color[Buffprt][2][y][x >> 1] = (b << 4) |
(dots_color[Buffprt][2][y][x >> 1] & 0x0F);
}
}

For this to work you need to also change to the event handler (add this to the switch statement handling incoming commands):

// Extend the Rainbowduino firmware to support new command
case setPixels:
setPixelXY();
break;

And you also need to a new define in Rainbow.h for the new command:

#define setPixels 0x04 // extend command set to support SetPixelXY

So now the firmware responds to a the new SetPixelXY command. To be able to send this command from an Arduino to the Rainbowduino via I2C, I modified SeeedMaster.pde (provided by Seeedstudio) to include an interface which sends the new command to the Rainbowduino:

//================================
// Name: SetPixelXY
// function: Send conmand to Rainbowduino to
// set a pixel to a particular color
// parameter: Address: Rainbowduino I2C address
// red, green, blue: the color RGB
// x,y: the coordinates of the pixel
// Extension to Rainbowduino command set by David Tames
// inspired by some code from MeggyJr_Plasma.pde 0.3
// Google Code Archive - Long-term storage for Google Code Project Hosting.
// Released under terms of GNU General Public License
//
void SetPixelXY(int Adr, unsigned char X, unsigned char Y, unsigned char R, unsigned char G, unsigned char B) {
unsigned char p;
// change coordinates so that 0,0 is in lower left and 7,7 is in upper right.
unsigned char TranslateX[8]={6,7,4,5,2,3,0,1};
// unsigned char TranslateY[8]={7,6,5,4,3,2,1,0}; // use if you want 0,0 in upper left
p = R; R = G; G = p; p = 0; // why do we need this kludge?
X = TranslateX[X]; // have coordinates go 0,1,2,3 etc. instead of 1,0,3,2, etc.
// Y = TranslateX[Y]; // use if you want 0,0 in top left instead of bottom left
RainbowCMD[0]='R';
RainbowCMD[1]=0x04; // extension to command set, requires revised firmware!
RainbowCMD[2]=R;
RainbowCMD[3]=((G<<4)|(B));
RainbowCMD[4]=((X<<4)|(Y)); // Pack X into high nybble, Y into low nybble
SentCMD(Adr);
}

Here's an example that draws a blue field and then a red "X" (I placed this at the top of SeeedMaster.pde :

void setup() {
Wire.begin(); // join i2c bus (address optional for master)
// start off with dim blue background
// color range 0-15 for each of R, G, B
ShowColor(4, 0, 0, 1);
}
void loop() {
unsigned char x;
unsigned char y;
int test;
// Draw a red x on blue background in order to demo use of SetPixelXY
for(x=0;x<8;x++) {
SetPixelXY(4, x, x, 1, 0, 0);
delay(50);
}
y = 7;
for(x=0;x<8;x++) {
SetPixelXY(4, x, y--, 1, 0, 0);
delay(50);
}
delay(1000);
for(x=0;x<8;x++) {
SetPixelXY(4, x, x, 0, 0, 1);
delay(50);
}
y = 7;
for(x=0;x<8;x++) {
SetPixelXY(4, x, y--, 0, 0, 1);
delay(50);
}
}

Now this is my first attempt programming in Arduino-land and my first encounter with the Rainbowduino, so it's a little messy and I have what I'm sure is a silly question for those more experienced with the Rainbowduino: Why did I have I need the kludge that switches around the color values for proper color display? I got it to work, but there's something funky going on with the nybbles representing red, green, and blue. Further elaboration on the ins and outs of the Rainbowduino is something I'd be interested in seeing from someone who's worked with the Rainbowduino much more than I have.

Maybe this will help...

This code
p = R; R = G; G = p; p = 0; // why do we need this kludge?
Swaps the R value with the G value. It looks like you added this because in the rainbowduino code you have this:

dots_color[Buffprt][0][y][x >> 1] = (r << 4) |
(dots_color[Buffprt][0][y][x >> 1] & 0x0F);
dots_color[Buffprt][1][y][x >> 1] = (g << 4) |
(dots_color[Buffprt][1][y][x >> 1] & 0x0F);
dots_color[Buffprt][2][y][x >> 1] = (b << 4) |
(dots_color[Buffprt][2][y][x >> 1] & 0x0F);

However, this doesn't represent the proper color/array-element as it should be in Buffprt. In the Buffprt array, the color value/array-elements are:
[0]: Green
[1]: Red
[2]: Blue

You have
[0]: Red
[1]: Green
[2]: Blue

Hence your need to swap the R and G values before you assign values in RainbowCMD.

By the way, my writeup is done, (here: joetcochran - JoyLite)
and my code is posted (here: http://www.softwaremill.org/joylitecode.zip)

Joe C, thanks for the bug fix.

Here's the project I did for which I needed to address single pixels on the Rainbowduino (includes source code):

http://kino-eye.com/dmi/color-tilt/

What I am quite confused :-?
On Raibowduino have such a file RaibowduinoCMD_Bata.rar
With two directories: Rainbow_CMD_V2_0 and SeeedMaster.
Why these directories (and files that are in them) are needed ?

In the sample code provided by Seeedstudio, Seedmaster is the sketch that runs on the "master' Arduino controlling the Rainbowduino, and Rainbow_CMD is the sketch you load into the Rainbowduino (a.k.a. firmware) that processes commands sent to it via the I2C bus.

CinemaKinoEye

I have a 4 boards Rainbowduino. As you wrote above. In one of them flashed - Seedmaster. And in the other three board flashed - Rainbow_CMD. Unite all these 4 boards together, including meals. As a result, the board, which is laced Seedmaster - does not show anything. A board stitched Rainbow_CMD display colorful changing numbers (ie, as originally conceived).
But why the first board does not show anything ?

Sorry the schematics?