Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

led MATRIX CURRENT DRAW

Status
Not open for further replies.
So you're following exactly the steps I outlined in post #94 and using the high-side driver chip I recommended. Maybe you can read after all.

But you're seeing the problem I mentioned in post # 83 and previously. If an LED is only on part time, it won't be as bright as one on full time. Using a constant current driver won't change this.

Finally, just for the record, the 10 mS cycle time is NOT the duty cycle. This time controls the refresh rate. If the display appears to flicker, make this value smaller. You can make it as large as possible until the display flickers to allow time to take care of the rest of what you have to do.

The duty cycle is limited by how many rows or columns you need to illuminate as Mike said.

Oh, oh, there is just one more little detail (impersonating Inspector Columbo)...

I also pointed out to you that you matrix requires 5 volts per segment. Yes, the typical forward voltage is 4v, but it can be as high as 5v.

Oh, and just one other thing....

10 mS = 10 milliseconds.

10 MS = 10 mega seconds = 115.6 days.
 
Jon I don't think MrDebs lack of reading is the problem. First off it doesn't matter how he does this till he see's that you are running leds in a loop for the time to see it show up or in this case till you turn or move on.

If the leds 4 and he uses high side driver and thinks he don't need POV one led blinking at a time. This aint going to work he'll lower the resistor and blow his led's up in smoke.

I'm sure you had a look at his video it clearly shows that he is not trying to scan his leds.

And what both you and mike are talking about takes 1.4 amp to power this I want a battery on my head that big
 
He needs to do this like I posted in 120 if he want to put this on a bike and ride around with it.

4 AA battery's and even his led's he wants to use would run for days.
 
I enabled two LEDs next to each other and changed the delayms between them down to 10ms which they look like they are both on.
I want to measure the actual current per LED due to the fact that with one led (this is measured from the 8v battery to the High side driver Vcc (that brings up a point, The PIC is using the term Vcc but what term for the second battery? Vcc2??)shows a draw of 12.4ma BUT when I enable two leds flashing back and forth at a 10ms delay I get 12.3.
I need to measure just one I guess seeing how I can't just divide by # of LEDS.
The large digit clock used 20ma X 4 displays = 80ma thus he used 80 ma to supply the display which equates to 20ma each display.
 
You want 20 mA A dot and And did you look at post 120 that's 25mA a dot

And if you want a bright display even using high side driver you still have to scan the leds in one at a time

The large digit clock used 20ma X 4 displays = 80ma thus he used 80 ma to supply the display which equates to 20ma each display.

No that's 20mA to drive one led if he was driving the whole thing you couldn't see it.

Here the led's scrolling right
[video=youtube_share;j1XZ_OicKHM]http://youtu.be/j1XZ_OicKHM[/video]


And yep one at time dang it's hardly believable that there only one led on every 100 uS for 500 uS
 
Last edited:
Just as I suspected, Tried the 500usON and 100USoff. VERY DIM and only show 12.7ma draw. I need to revamp my resistors for higher current.
Its even worse w/ the Green LEDs.
Will get back to you with a video AFTER I get new resistors etc.
 
Just as I suspected, Tried the 500usON and 100USoff. VERY DIM and only show 12.7ma draw. I need to revamp my resistors for higher current.
Its even worse w/ the Green LEDs.
Will get back to you with a video AFTER I get new resistors etc.

Why do you have ANY off time? What's the point in that?

You are just not following. If you want an LED that's on for 1/4 the time to appear as bright as one that draws 25 mA continuously, you have to supply it 4 times more current. This can only be done to a point, as listed as the peak LED current on the data sheet.

But realize this peak current can only be used at a limited duty cycle. Stall the cycling and the LED burns out.
 
Jon you have to turn off the last led before the next led come on or you'll do two things one wast power
two have ghosting led's.

And I don't really get this gunk the arrow in post 125 uses 25 mA a led and the video was taking in full light

Now Mrdeb if you want i will draw you a sch showing how to wire up the same thing with a uln2xxx and what highside driver your going to use
 
Last edited:
Yes, turn off one before immediately turning on the next - there's no need for a "cooling off" period.
 
here is my present code

This code works GREAT. YES I need more POWER as the maxium current draw on the STOP sub is maxed at 35-40ma.
Tried using
porta.bits(x) = 1
delayms(10)
porta.bits(x) = 0 trying to get more ON time. I just need more power per LED but afraid of letting the smoke out. This setup is just for developing code. AFTER I get the code all done will experiment with more current. If I tun on one LED RED = 20.6 Green = 17.4
Also discovered if I have all 5 LEDs in one ROW they are all bright BUT if I have more than 2 LEDs in same COLUM they are DIM. Well yea there is only one resistor 1 cathode and 7 anodes.
All leds in parallel.


Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 10/16/2012                                                     *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 9/19/2012                                                      *
*  Version : 1.0                                                            *
*  Notes   :brads suggestion 9/19/2012                                                                *
*          : new code revised board 10/15/2012                                                              *
*****************************************************************************
}
Device = 18F4520
Clock = 8
Config MCLRE = Off


'*********************************************************************
'Includes
Include "InternalOscillator.bas"

Include "utils.bas"
Include "convert.bas"


'*********************************************************************
'Dimension Statements (variable and constants

//Dim row As PORTD    // row 0 to 6


Dim row_buffer(7) As Byte
Dim count As Word
Dim x As Byte
Dim y As Word
dim z as word
//
Const Red_Data(7) As Byte =   (%0010001, %00001010, %00000100 ,%00010001, %00001010,%00000100, %00010001)// 5 colums left to right
Const Cross_Data(7) As Byte = (%00011111, %00000011, %00000111 ,%00011111, %00111111, %01111111, %01111111)
Const R_ows(8) As Byte =      (%00000001, %00000010, %000000100 ,%00001000, %00010000, %00100000, %01000000,%00111110)// 7 rows top to bottom
Const Green_Data(8) As Byte =      (%00000000,%00010001, %00001010, %000000100 ,%00001010, %00010001, %00000000, %00011111)// 7 rows top to bottom
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// STOP ROUTINE
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sub test()
y=10
z =12  
y=3
z = 5   
For x = 0 To 14
                     PORTa = Green_Data(7)  // all on
     PORTD = R_ows(3)                       //row 4
     DelayMS(y)
                    
   
                     PORTa = Green_Data(3)  // middle segment
     PORTD = R_ows(7)
     DelayMS(z)
   
                      
   
    
   
     // DelayMS(y)
     //  PORTD.bits(x)=0 

      
next
x=0
end sub

sub STOP()

y=7
z = 5   
For x = 0 To 5
                     PORTa = Green_Data(1)
     PORTD = R_ows(1)
     DelayMS(y)
                     PORTa = Green_Data(2)
     PORTD = R_ows(2)
     DelayMS(y)
                     PORTa = Green_Data(3)
     PORTD = R_ows(3)
     DelayMS(y)
                     PORTa = Green_Data(2)
     PORTD = R_ows(4)
     DelayMS(y)
                     PORTa = Green_Data(1)
     PORTD = R_ows(5)
     delayms(y)
     next
   for x = 0 to 5  
   
     //CROSS
      PORTa = Green_Data(7)  // all on
     PORTD = R_ows(3)                       //row 4
     DelayMS(y)
     PORTa = Green_Data(3)  // middle segment
     PORTD = R_ows(7)
     DelayMS(y)
      
   
next
      
 end sub

Sub RIGHT()
y=5
z = 30    
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// first arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14
                  PORTC = Red_Data(0)
     PORTD = R_ows(0)
     DelayMS(y)
                  PORTC = Red_Data(1)
     PORTD = R_ows(1)
     DelayMS(y)
                  PORTC = Red_Data(2)
     PORTD = R_ows(2)
     DelayMS(y)
next
     delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     // second arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14
                  PORTC = Red_Data(0)
     PORTD = R_ows(1)
     DelayMS(y)
                  PORTC = Red_Data(1)
     PORTD = R_ows(2)
     DelayMS(y)
                  PORTC = Red_Data(2)
     PORTD = R_ows(3)
     DelayMS(y)
next
      delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// third arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14
                  PORTC = Red_Data(0)
    PORTD = R_ows(2)
     DelayMS(y)
                  PORTC = Red_Data(1)
    PORTD = R_ows(3)
    DelayMS(y)
                  PORTC = Red_Data(2)
    PORTD = R_ows(4)
     DelayMS(y)
next
      delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//fourth arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14     
                  PORTC = Red_Data(0)
    PORTD = R_ows(3)
     DelayMS(y)
                  PORTC = Red_Data(1)
    PORTD = R_ows(4)
     DelayMS(y)     
                 PORTC = Red_Data(2)
    PORTD = R_ows(5)
     DelayMS(y)
next
      delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// fifth arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14     
                 PORTC = Red_Data(0)
    PORTD = R_ows(4)
    DelayMS(y)
                  PORTC = Red_Data(1)
    PORTD = R_ows(5)
    DelayMS(y)     
                 PORTC = Red_Data(2)
    PORTD = R_ows(6)
    DelayMS(y)
Next
   delayms(z)                 
           
End Sub

//SUB ENDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sub LEFT()
y=5
z = 30      
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// first arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14
                  PORTC = Red_Data(0)
     PORTD = R_ows(6)
     DelayMS(y)
                  PORTC = Red_Data(1)
     PORTD = R_ows(5)
     DelayMS(y)
                  PORTC = Red_Data(2)
     PORTD = R_ows(4)
     DelayMS(y)
next
     delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     // second arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14
                  PORTC = Red_Data(0)
     PORTD = R_ows(5)
     DelayMS(y)
                  PORTC = Red_Data(1)
     PORTD = R_ows(4)
     DelayMS(y)
                  PORTC = Red_Data(2)
     PORTD = R_ows(3)
     DelayMS(y)
next
      delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// third arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14
                  PORTC = Red_Data(0)
    PORTD = R_ows(4)
     DelayMS(y)
                  PORTC = Red_Data(1)
    PORTD = R_ows(3)
    DelayMS(y)
                  PORTC = Red_Data(2)
    PORTD = R_ows(2)
     DelayMS(y)
next
      delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//fourth arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14     
                  PORTC = Red_Data(0)
    PORTD = R_ows(3)
     DelayMS(y)
                  PORTC = Red_Data(1)
    PORTD = R_ows(2)
     DelayMS(y)     
                 PORTC = Red_Data(2)
    PORTD = R_ows(1)
     DelayMS(y)
next
      delayms(z)
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// fifth arrow
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For x = 0 To 14     
                 PORTC = Red_Data(0)
    PORTD = R_ows(2)
    DelayMS(y)
                  PORTC = Red_Data(1)
    PORTD = R_ows(1)
    DelayMS(y)     
                 PORTC = Red_Data(2)
    PORTD = R_ows(0)
    DelayMS(y)
Next
   delayms(z)                 
           
End Sub
//SUB ENDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// set ports as outputs
TRISA = %00000000
TRISB = %00000000
TRISC = %00000000       
TRISD = %00000000
count = 0
SetAllDigital

//row = 0
PORTB = 0
PORTC = 0
PORTA = 0
PORTD=0
While true
For count =0 To 5    // run 21 times
// load()
{
RIGHT()                // sub call
DelayMS(50)
Next 
for count = 0 to 5
LEFT()
delayms(50)
next 
 }
//for count = 0 to 5
 
//STOP()
//delayms(50)
//next 
  
// for count = 0 to 5 
STOP()

next 
Wend
 
What do you think happens if you power more than one parallel LED from one resistor? You might scroll back because it's been explained here several times.

Maybe you need to go back even one step further. How is the current through an LED controlled? What happens when you have two LEDs in parallel?

This is a pretty simple concept...and kind of important.
 
I realize what is happening that's why I am attempting to control each led separately. Burt posted a code that I want to try out. I am able to blink LEDs to make them appear to be ON continuously so am working on trying to get the dang LEDs to cooperate. Having some success.
Tried using the 10ms delay (as seen in my posted code) BUT I have more than one LED on at a time. BUT most of the LEDs that have more than one on are in separate Coliums. So they technically have one anode but two cathodes, two resistors so they are not in parallel. It might be noted that my original schematic with the resistors on the Anodes not the cathodes(see the Tetris schematic) but it was suggested to put the resistors on the cathodes.This is where I am right now. Yes I need to apply more current to the LEDs but Burt has his cube with 20ma per LED.
Only time I have an issue with dIM LEDs is if I have more that one per colum. Trying to overcome by trying out Burts code and following suggestions.
 
It's perfectly ok it have more than one LED illuminated at the same time if and only if each is powered via its own resistor.[/i]. This is the entire idea behind multiplexed LED displays. Look at the Tetris article or the seven-segment article you posted.
 
It's perfectly ok it have more than one LED illuminated at the same time if and only if each is powered via its own resistor.[/i]. This is the entire idea behind multiplexed LED displays. Look at the Tetris article or the seven-segment article you posted.


Jon that's true if you can sink the power or source it but you have a better looking display if you drive all
pins the same. You start leaving leds on and you soon run out of power.

This has been proved over and over again.

If I was MrDeb I would start with just one leds set the resistor for the brightness I want and then hook
the leds all up like you did the first one and then scan them I bet he will be vary happy with the outcome.

MrDeb here you something to get you going
View attachment 68130
 
Last edited:
The picture Burt posted is exactly what I have connected right now. Am attempting to try different methods to get the colums with more than one LED enabled to get full brightness by multiplexing or scanning the rows as in should be so only one LED w/ one resistor is enabled at a time. At present only the one section of code dealing with row3/colum 2(under //cross is about the only section with issues.
 
The low side resistors should be 150 ohm if your using nine volts.
But you cant light all them in a row you would would be using probably more power then 6 AA could output.

See the thing you need to think about here is sure they say a AA can put out 2 Amps if you short it then that may happen but in real life using a load of resistors and leds your not going to get any way near 2 Amps more like 200 to 400 mA running load.
 
Found solution

If I scan the rows using the CONST array it allows only one LED on at a time. The current draw is 16ma(green). One green LED by itself draws 17.4 aprox.
Code:
Sub STOP()

y=15
z = 20   
For x = 0 To 5
                     PORTA = Green_Data(1)
     PORTD = R_ows(1)
     DelaymS(y)
                     PORTA = Green_Data(2)
     PORTD = R_ows(2)
     DelaymS(y)
                     PORTA = Green_Data(3)
     PORTD = R_ows(3)
     DelaymS(y)
                     PORTA = Green_Data(2)
     PORTD = R_ows(4)
     DelaymS(y)
                     PORTA = Green_Data(1)
     PORTD = R_ows(5)
     DelaymS(y)
     Next
   
      //cross bar
     //CROSS
     PORTA = Green_Data(7)  // all on
     PORTD = R_ows(3)     
     // long verticle                   
     DelaymS(75)           // This routine scans the rows from row 2 to 5  
     For s = 1 To 5            //Const R_ows(8) As Byte = (%00000001, %00000010, 
     PORTA = Green_Data(3)     //  %000000100 ,%00001000, %00010000, %00100000,        %01000000,%00111110)              
     PORTD = R_ows(s)          // works pretty well and the current draw is acceptal at 16ma ( a green LED = 17.4ma by itself
     delayms(z)
   Next
      
 End Sub
 
Got my present code tucked away. Installed the LEDs etc onto an unfinished Tap-28 board. Tested and it all works. Now to work on an interrupt and integrate a RX Manchester code together. Going with Burts suggestion of using a 10F20 for the TX section. Hopefully use Manchester code to detect three switches.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top