1. 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.
    Dismiss Notice

led MATRIX CURRENT DRAW

Discussion in 'Microcontrollers' started by MrDEB, Oct 4, 2012.

  1. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,118
    Likes:
    90
    Location:
    Seattle, WA
    ONLINE
    As Brad has already said at least once, the ULN2003/2803 is a LOW SIDE switch. It can only be used between the load and ground. These chips CANNOT be used to switch the positive side of anything.

    Your options are to find an array with Vf less than maybe 3 volts, to add a HIGH SIDE switch connected to > 5 volts or use a dedicated LED matrix driver. Even these will have limits on the maximum Vf.
     
  2. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    I realize my error

    I think I found my solution and minimize parts count instead of 7 NPN's, resistors etc.
    Here is the part I am contemplating http://www.mouser.com/ds/1/302/PBRN113E_SER-50005.pdf
    Its a SOT23 case with transistor and resistors all in one.
    going to use a transistor, resistor for testing purposes on one row of anodes.
    My simplistic layout I failed to include 390 ohm resistors on the output.
    This may be the solution I need?
    Now If I can chop down them trees so I can see the forest
     
    Last edited: Oct 6, 2012
  3. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Hi MrDEB,

    Could you explain what it is you're trying to accomplish, please? In your initial post you said you're designing a 5x7 matrix. Have you decided to use cathode rows and anode columns or are you using anode rows and cathode columns?

    [​IMG]
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22

    Anode ROW and Cathode colums
    Its a common cathode display presently using TBC40-11EGWA
    after I get my shipment of TBC40-12SURKCGKWA hopefully I can get some bright visiable LEDs
    my present configuration I failed to take into account that the Vf of the display per LED is 4v so I am outa gas using 5v plus the voltage drop of the ULN2803.
    The last configuration I posted isn't right as the LTSPICE simulation says NOT ENOUGH CURRENT. Voltage drop is to much still.
     
  6. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    I complated using mosfets instead of transistors?
     
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,798
    Likes:
    134
    Location:
    morristown,tn
    Have a look here These Leds are set to be scanned fast not to light a row
    Lets say you use 9 volts and a 390 ohm resistor to limit power the max you can use is 23 mA

    Now you light led1 it's 23 mA light led2 they use 12 each and so on.

    But there not all ideally the same so some will get a little more power but you can't make it light them all the same any way you go more divers you'll end up blowing the leds.

    You figure the resistor to give you 25 mA or so at the scan speed your planing to use. View attachment 67788
     
  8. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    I realize what your saying Burt.
    Looking at what Brad is using as a method to feed the Anodes using a transistor.
    Seems like this may be the best solution.
    Now either a PNP or NPN in an emitter follower configuration?
    Have partially assembled a PNP on breadboard until I had a meeting I almost forgot about.
    Going to do some testing later either tonight or tomorrow.
    anything is better than what I have right now.
     
  9. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,118
    Likes:
    90
    Location:
    Seattle, WA
    ONLINE
    MrDEB,

    You might look at Swordfish Module - 7 Segment Display at Digital-DIY. IT's kind of clear you're not understanding a few things. In this article, each digit corresponds to one column of your 5 x 7 display. In the article, only one digit is ever illuminated at the same time. It's only by multiplexing the display rapidly that more than one digit is illuminated.

    It's exactly the same with your displays. Only one column is ever on, and each of the port pins only drives one LED. At no time will any of the port pins connected to anodes drive more than one LED, and only one cathode is ever active at the same time.

    Your measurements with more than one LED illuminated are wrong. This is not the way the display should be used.

    The short description of what needs to happen:

    1. Set the anodes for column 1. Say %10000010.

    2. Activate cathode 1.

    3. Delay for some small number of mS (perhaps 10 as a rough guess)

    4. Deactivate cathode 1.

    5. Set the anodes for column 2. Say %010001000.

    6. Activate cathode 2,

    7. Delay 10 mS.

    8. Set the anodes for column 3. Say %00101000.

    9. Activate cathode 3.

    10. Delay 10 mS.

    11. Set the anodes for column 4. Say %00010000.

    12. Activate the cathode for column 4.

    13. Delay 10 mS.

    14. Deactivate the cathode for column 4.

    15. Go to #1.


    These 14 steps are repeated many times to display a static arrow. These steps are required to multiplex the display and do not include any animation. Do this first and figure out how to get a static arrow displayed before trying to do anything else.

    Note carefully here 1) each port pin connected to an anode drives only one LED, and 2) only one cathode is active at a time.

    Best to understand multiplexing before trying to get fancy.
     
  10. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    The TBC40-11EGWA display datasheet says the rows are anodes and the columns are cathodes, with the red and green anodes in each individual row connected together. With this type wiring, wouldn't you want to refresh and display one row at a time (zero to five green columns and zero to five red columns in a single row at one time)?
     
    Last edited: Oct 7, 2012
  11. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,118
    Likes:
    90
    Location:
    Seattle, WA
    ONLINE
    Mike, I think I'm right on this. Let's just consider the red OR the green for now. The display is 5 columns wide by 7 rows tall. The rows are the anodes (positive side) of the LEDs and the columns are the cathodes (negative side) of the LEDs. The anodes are tied together across all the rows and the cathodes are tied together down each column.

    J View attachment 67790

    The above picture is from the data sheet.

    The anodes are driven by a port pin via a resistor. A total of seven port pins and resistors are used. Each port pin can supply a maximum of 25 mA.

    Each of the 5 columns (considering just the red or the green) are connected to ground via a ULN2803 (or ULN2003) low side driver chip. Each of these gates can sink 300+ mA.

    If 1 - 7 bits of the port are HIGH, and EXACTLY ONE of the ULN2803 gates is active (I.e., conducting to ground), 1 - 7 LEDs will be illuminated, each port pin connected to an anode will be supplying < 25 mA and the ULN2803 gate will be happily sinking up to 175 mA depending on how many LEDs are on in a column.

    Using both colors just doubles the columns to 10. Still, only one column is active at a time.

    All of the above presumes Vf of the LEDs is less than 4 volts. Since MrDEB was able to get the LEDs to illuminate, this must be the case.

    If the drawing MrDEB did above showing the current measurements is to be believed and I'm interpreting it correctly, the hardware configuration should match what I've described. He's just using it incorrectly by turning on more than one cathode at a time. When this is done, more than one LED is supplied by a single resistor, leading to variable brightness and unexpected results.

    I hope this has clarified my thinking.
     
  12. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,118
    Likes:
    90
    Location:
    Seattle, WA
    ONLINE
    The important points to take away from the above are 1)how multiplexing work and 2)how the hardware works.

    Depending on the display used, some form of high side driver needed but getting anything to work requires understanding how multiplexing works.
     
  13. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    I understand what your saying Jon. I figured making one row of 5 anodes high would do the deed but turning on each LED by itself sounds like the way to go. LOTS more code but sounds feasible at best. Will give a a go.
     
  14. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,118
    Likes:
    90
    Location:
    Seattle, WA
    ONLINE
    Multiplexing displays does take a lot of steps in software and some processor power, no doubt about it. The advantage is you use 12 port pins for a 5x7!display instead of 35 to drive each LED directly.

    It should be clear that you can't drive 5 LEDs with one port pin because a port pin can supply a maximum of 25 mA. It should also be a given that you can't drive parallel LEDs though a single resistor. Review and understand the article on multiplexing a 7 segment display. It's exactly the same process.
     
    Last edited: Oct 7, 2012
    • Like Like x 1
  15. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,798
    Likes:
    134
    Location:
    morristown,tn
    You ban MrDEb from Digital-Diy and then come over here and mess with him

    bottom Line MrDeb you can't light five at a time but you can make it look like you did and if this is for the bike I posted you code that makes right,left and stop.

    [video=youtube_share;lybQS9APsBQ]http://youtu.be/lybQS9APsBQ[/video]
     
  16. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,798
    Likes:
    134
    Location:
    morristown,tn
    MrDeb the easy way to use the leds is like this

    Place the column on two ports say PortC and PortD you don't even need a ULN28 or anything for that matter but use two if you feel the need.

    Now feed the rows using a current limiting resistor a 120 ohm would be fine

    Now lets say you used PortB for the rows load PORTB with what led you want on and scan the columns

    and this will look great
    Code (text):

    >       PORTB 0000001 PORTC 00000001
      >       PORTB 0000010 PORTC 00000010
        >       PORTB 0000100 PORTC 00000100
          >       PORTB 0001000 PORTC 00001000
        >       PORTB 00010000 PORTC  00000100
      >       PORTB 00100000PORTC 00000010
    >       PORTB 01000000 PORTC 00000001
     
    Load PortC 00000000 and data moved to PortD and the colors will change fire them both and get 3 colors
     
    Last edited: Oct 7, 2012
  17. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    Am reconfiguring the code as well as the circuit board.
    Got to thinking about all this multiplexing and adding a transistor to power each anode row.
    Last night I powered, just for the heck of it, all 5 leds in one row and measured 20ma but turning off any leds in that row the current goes up(duh)
    I agree I can't have more than one LED per row on.
    Going to wire in one transistor with a resistor connected to each of the seven colums. The transistor supplies 5v to the ROW then flash the LEDs that are to be on sequentially as Jon stated.
    Be nice to eliminate the ULN2803's but the added protection and it is a recommended method to use on the LOW side of a matrix.
    will redraw schematic and wire up one row/colum and take measurements. THEN blink alternate two lEDs in same row and adjust delayms() until the leds appear to be on constantly 10ms as suggested will be a starting point.
    Will get back to this tomorrow as dragracing is on tv
     
  18. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,798
    Likes:
    134
    Location:
    morristown,tn
    MrDeb you didn't read anything I posted I told you you'll
    Blow a led with your idea

    And you don't need all the junk your talking about you just
    Need 25 mA for one led at a time the pic can do that
    Three ports and your good to go
     
  19. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,798
    Likes:
    134
    Location:
    morristown,tn
    Here is the easy way to do this and I hope you see the light here you don't need drivers if the leds are less then 25mA and you code one led on at a time and even if you mess up theres no way to get more power the resistors limit you.

    The resistors are 220 ohm not 150 I reused a drawing from Nigel's site
    View attachment 67802
     
    Last edited: Oct 7, 2012
  20. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,364
    Likes:
    22
    That's exactly what I am going to do but the problem is I need maximum voltage to light the LED segments which have a Vf of 4. By the time The LED is lit it will maybe be be out of juice taking into consideration battery life. If I start with 9v I have plenty of room to work. I have looked at LOTS of example circuits and most if not all have either a 74373, uln2803, npn or pnp transistor or combination of.
    Not saying your wrong but battery life is an issue I need to consider.
     
  21. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,798
    Likes:
    134
    Location:
    morristown,tn
    Where you get the idea that they will not work at 5 volts the data sheet said that the testing was done
    at that voltage and 4 AA batteries will out last 4 9 volt any day. 25 mA is the same discharge be it from a 9 volt or a 1.5 AA cel

    Now if your worried about the batteries why add more gunk to use it lol

    I was thinking about this this morning and just for fun I did a little figuring

    Now I don't no how your going to get 9 volts but I figure a 9 volt battery.
    Ok that has a .5 Amp hour rating. Will output 25mA four about 1 to 2 hours before it's DOA

    Now a AA battery 10 hours till DOA.

    One led flashing at a rate to make a nice sign you can see with out any added gunk maybe use 60mA

    Same thing with gunk more like 100 to 120 depending on the added gunk and stuff now who has
    covered

    MrDeb have you seen them 3 led lights very bright on 3 AAA they last fore days and there on all the time wounder why they don't have any unneeded gunk.
     
    Last edited: Oct 8, 2012

Share This Page