Hello, I am working on a project that will culminate in a 16x10 RGB display. As a proof of concept, I have built a small 4x4 display to test my multiplexing technique, and I am running into some problems that I hope you guys can help me out with:
The display consists of four rows of four columns each of common-anode RGB LEDs (anodes = columns), with the rows driven by a TLC5940. The columns are driven HIGH in sequence by a 74HC595 shift register. Here's my algorithm for pushing data to the display:
- Clear TLC and blank it
- Send data for rows in column n to TLC
- Call Tlc.update(), pushing the actual data to the chip but keeping it blanked
- Set column n driven HIGH with the 595
- Un-blank the TLC, turning on the LEDs.
I am getting flickering lights, as well as some "bleed" from one column into the next; that is, I can see green elements in the blue column, and red in the green, etc. My theory is that the TLC is not changing the row data as fast as is necessary, and is therefore "bleeding" into the next column. When I slow down the switching (when COLOR_SWITCH_TIME is increased) to the point where I can easily follow the transitions, all the colors are vibrant and clear and there is no bleed, so I feel my theory is supported. Of course, when it is increased to the point where POV makes the entire matrix appear illuminated, the problem returns.
Here is my relevant code so far:
/*
4X4 RGB LED matrix using a single TLC5940 to control the 4 rows and one 74HC595 shift register to control the columns
Incorporates Adam Leone's TLC5940 library: http://code.google.com/p/tlc5940arduino/
*/
#define COLOR_SWITCH_TIME 5
void loop()
{
for (int i = 0; i < 4; i++)
{
//transition();
for(int j = 0; j < 4; j++)
{
//row data array for "R-G-B-White" display sequence
int rSeq[] = {4095,0,0,4095};
int gSeq[] = {0,4095,0,4095};
int bSeq[] = {0,0,4095,4095};
SetRow(j,rSeq[i],gSeq[i],bSeq[i]);
}
digitalWrite(10,HIGH);//Blank the TLC
SetColumn(i);
Tlc.update();
digitalWrite(10,LOW);//un-blank it
delay(COLOR_SWITCH_TIME);
}
}
//Sends row data to the TLC but DOES NOT update
void SetRow(int row, int r, int g, int b)
{
int startChannel = row*3;
Tlc.set(startChannel,r);
Tlc.set(startChannel+1,g);
Tlc.set(startChannel+2,b);
}
void SetColumn(int column)
{
digitalWrite(latchPin,LOW);//release the columns
shiftOut(dataPin,clockPin,LSBFIRST,columns[column]);//shift out the data
digitalWrite(latchPin,HIGH);//latch it in
}
I thought I could remedy the problem by adding the blanking operations (theoretically keeping the TLC off until all the data was "in," but apparently not. Attached is a relative schematic of my setup.
I am receptive to any ideas you guys have about fixing this.
Many thanks!