16*56 Dot matrix soruce and sinking current issues

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,
Im trying to build 16*56 dot matrix using 14 8*8 single color module.I'm using seven shift register for the columns and two shift register to scan the rows and two ULN2803 after the row shift registers to sink the current.

I've only tried one dot matrix 8*8 the brightness is good i think it's working fine on the 35 mA source current of the 74hc595.but i dont know if the DARLINGTON transistor is capable of sinking 56 led row since i only tested on 8 dot row.

I was thinking to put more ULN2803 in parallel to withstand the extra current that's the first approach

or change the design with high current source driver at rows and seven ULN2803 at columns to sink the current. but still dont know any good available current source . i checked some designs with BC557 npn transistor as current source but i think it can't source around 2A (35mA*56) for each row.

Any help will be great appreciated

Regards,
Amr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You might want to take a look at the discussions on this thread: https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=118682

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Chris for your favorable reply. this thread got very rich information and very useful hints.

I think I'd go for the TD62783A IC as a current source but i hope i can find it in any local stores.

I'll update u with my findings.

Regards,
Amr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately i couldn't find the TD62783A IC but i got NPN transistors BC140 which got 1.5 peak current and PNP transistors TIP142 as alternatives but i dont know which would be more suitable to drive the rows.

Do i still need to put the ULN2803 at the columns since i only want to run each led on 20mA?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are going to need drivers of some sort on the columns. While the 74HC595 can sink up to 35mA on any one pin, there's another limit of 70mA total for all pins. This would limit the total current to no more than about 8 mA per LED.
Then things get worse.
Your array of LEDs is 16 rows of 56 columns. Since only one row is on at any given instant, each row is on for 1/16th of the total time. This means the average current is now down to something like 8/16 or around 0.5mA. At that current level, most LEDs won't be very bright.
Normally, what I do is use P type mosfet transistors for the row drivers, and ULN2803 column drivers.
I put a resistor in series with each column, and size it to set the peak current to something that gives me an average current in the 10-20mA range.

A couple of design things you need to keep in mind. first, LEDs have two absolute maximum currents, average, and peak.
http://www.us.kingbright.com/images/catalog/SPEC/WP7113ID.pdf is the datasheet of a 'typical' LED. In there, the average current is given as no more than 30mA. That's well below the 20mA current you wanted, but with a 1/16th duty cycle, the peak current would have to be 20*16, or 320mA. That's well above the peak current that LED can withstand.

The other item to watch is your row drivers. The current through them ma be as much as the peak LED current times the number of columns. This can easily work out to several amps!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did put the ULN2803 driver at each columns and NPN transistors to source the row current i still couldn't test it on the 56 columns only 8 columns are tested so i think i 'll replace them with P type MOSFET to withstand all the row peak current

Now i get glitch when i Turn Off the LEDS after turning them ON they're barely ON This only happen when i connect ULN2803 to sink the current.

Also note that the common pin of the ULN2803 is connected to 5 volt.

thanks in advance,
Amr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you post a schematic of your circuit? It's hard to troubleshoot the problem without it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sure.i just figured out it's not the whole LEDs i assume it's kind of software glitch i couldn't see when i did test Dot matrix on small current before using ULN2803.

Please check the attached picture i'm displaying Number 2 pattern i just noticed that there's the pattern plus it's shadow shifted up one row and barely lights up.

I'll try modify the code and try using Output enable in the 74HC595 chip.

here's the code sample i used to display the pattern

Also I couldn't be thankful enough for your great support Chris

#include 
// SPI functions
#include  
#include 




void spi_begin(void) {
  // set /SS = low to select SPI slave device.
  PORTB &= 0b11101111;
}

void spi_end(void) {
 
  // set new data by /SS = high then Low,
 
  
  PORTB |= 0b00010000;   
  PORTB |= 0b00000000;
 
}

void spi_send(char cData) {
  SPDR = cData;
 while(!(SPSR.7)) {
    ;  // wait for SPIF flag to be set
  }
  
}
// Declare your global variables here 
flash unsigned char symbols[10][8]=
	{       
	        
		{0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C},
		{0x1E,0x18,0x18,0x18,0x18,0x18,0x18,0x7E},
		{0x3C,0x66,0x66,0x30,0x18,0xC,0x7E,0x76},
		{0x7E,0x66,0x30,0x18,0x30,0x66,0x66,0x3C},
		{0x30,0x38,0x34,0x34,0x36,0x7E,0x30,0x78},
		{0x7E,0x66,0x6,0x3E,0x60,0x66,0x66,0x3C},
		{0x3C,0x66,0x6,0x3E,0x66,0x66,0x66,0x3C},
		{0x7E,0x66,0x66,0x30,0x30,0x18,0x18,0x18},
		{0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C},
		{0x3C,0x66,0x66,0x66,0x7C,0x60,0x66,0x3C}
		
		
	};



char ticker=0x01;
char row=0;

// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{


  // SPI transfer 
  spi_begin();
  //sending column data
  spi_send(symbols[2][row]); 
  //sending Row data; only one row is active at a time
  spi_send(~ticker); 
  spi_end();
  //selecting the next row  
  ticker=ticker<<1;
  
  row++;
  if(row==8){row=0;ticker=0x01;}
                                                         ;
} 

void main(void)
{
// Declare your local variables here

// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
PORTA=0x00;
DDRA=0xff;

// Port B initialization
// Func7=Out Func6=In Func5=Out Func4=Out Func3=In Func2=In Func1=In Func0=In 
// State7=0 State6=T State5=0 State4=0 State3=T State2=T State1=T State0=T 
PORTB=0x00;
DDRB=0xB2;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
PORTC=0x00;
DDRC=0x00;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
PORTD=0x00;
DDRD=0x00;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 921.600 kHz
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x02;
TCNT0=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 0.977 kHz
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: On
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x05;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x1c;
OCR1AL=0x20;
OCR1BH=0x00;
OCR1BL=0x00;

// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x11;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

// SPI initialization
// SPI Type: Master
// SPI Clock Rate: 1843.200 kHz
// SPI Clock Phase: Cycle Half
// SPI Clock Polarity: Low
// SPI Data Order: MSB First
SPCR=0x50;
SPSR=0x00;

// Global enable interrupts
#asm("sei")

while (1)
      {
      // Place your code here
      // setting port B; output = MOSI, SCK, /SS, PB1(/OE)
  PORTB = 0;
  
  
      };
}

[/code]

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your circuit looks fine, as does your code. I don't see anything obviously wrong with either one.
The only reason I can think of for the shadow effect would be if your transistors are taking a very long time to turn off.
If you have access to a two channel oscilloscope, try looking at the waveform at the collectors of two adjacent rows, and checking for overlap in the on time.

One possible software fix for the issue. In your interrupt code you are updating the display data to turn one row off and the next row on at the same time.
Instead, try turning everything off first, then update with the new data and turn the next row on. Something like this:

// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{

  // turn display off
  spi_begin();
  spi_send( 0x00 );   // turn all columns off
  spi_send( 0xFF );   // also turn all rows off
  spi_end();
  // now send data for next row.
  // SPI transfer
  spi_begin();
  //sending column data
  spi_send(symbols[2][row]);
  //sending Row data; only one row is active at a time
  spi_send(~ticker);
  spi_end();
  //selecting the next row 
  ticker=ticker<<1;
 
  row++;
  if(row==8){row=0;ticker=0x01;}
                                                         ;
}
 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That did fix the problem.

thanks alot Chris :)