help needed with LED 7 segment driver circuit

Discussion in 'General Electronics Chat' started by skk, Mar 15, 2011.

  1. skk

    Thread Starter Member

    Mar 15, 2011
    31
    0
    I need some tips selecting the right transistor to drive my 7 segment LED displays ( 3 of them )
    http://www.lumex.com/specs/LDS-AA14RI.pdf

    I am trying to adapt an existing circuit that I made by trial and error, and I am happy with, but I want a different micro controller and I want all surface mount ( except the LED ).

    Right now my circuit drives the common anode with the emitter of a 2N3565 transistor with the base to a 100ohm resistor connected to the atmel 2313 IO pin. Collector tied to VCC. This is driving a smaller but older LED ( Kingbright SA08-21 ).

    I want to do the same thing with an ATMEGA 8515
    http://www.atmel.com/dyn/resources/prod_documents/2512S.pdf

    I want to use a surface mount transistor, but I am having trouble figuring out what one to use and what value of resistor to use.

    I also notice many circuits out there have resistors on the 7 segments as well. My circuit does not. Are these just current limiting? I may have discarded them because the display was not bright enough, is this OK, how can I make an educated decision.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You're going to have problems with your scheme, if you're planning on powering the entire circuit with 5v.

    You've been using the 2N3565 NPN transistor as an emitter follower, which worked for the older 7 segment display; each segment only has 1 LED, so your Vf was somewhere around 2v-3v. With the new displays, the Vf will be 4v-5v. If you try to use an emitter follower configuration to source the current, it'll drop perhaps 0.8v to 1v across the be junction when all segments are lit. That won't leave any "headroom" for the current limiting resistors you'll need to use.

    You don't say how much current you want to supply to the segments, but if all segments are on @ 20mA, you'd need 140mA current sourced. Using an MMBT2907A PNP SMD transistor as a saturated switch would be suitable for that current. You'd need 14mA base current, so roughly 5v-.8v/14mA = 4.2v/.014 = 300 Ohms for the base resistor.

    You really should use current limiting resistors for the individual segments, or you risk burning up your I/O pins and/or the segments. At the very least, you will shorten their lives significantly.

    If the Vf of the LEDs is 4v @ 20mA and your supply is 5v, then you'd need <=20mA current flow across the 1v a resistor would drop. R=E/I, so Rlimit >= 1/20mA = 50 Ohms. 51 Ohms is the closest standard value of resistance greater to or equal 50 Ohms.
     
  3. skk

    Thread Starter Member

    Mar 15, 2011
    31
    0
    thanks for the advice! So when I wire the PNP I swap the emitter and collector and drive it on with an active high instead of active low at the base, or how should I hook this up best. I am going to have to re-write all the microcode anyway, so what do you suggest?
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Saturated switch implies common emitter; the emitter for the PNP will go to +5v, the uC's supply.
    When the uC's output pin is high, the PNP transistor will not source current via the collector.
    When the uC's output pin is low, the the PNP transistor will source current via the collector.

    If you want to take more load off the uC at the expense of another few components, you could add a base return resistor of about 1k from the base to 5v, and an NPN transistor used as a saturated switch to sink current from the base via the 300 Ohm resistor, and a 1k resistor from the uC's I/O pin to the NPN's base.

    I don't know how much current you're planning on sinking from the displays. Keep in mind your uC's source/sink limit per pin, and also total package dissipation. Your worst case will be when three 8's are displayed. You will need to look up the per-pin and package current sink/source limits, and you should stay well within that.
     
  5. skk

    Thread Starter Member

    Mar 15, 2011
    31
    0
    Thanks again. About the 51K resistors on the segments. Remember I will only be driving each one about 1/3rd of the time, because I am multiplexing the 3 digits. I also need to turn them off each time, so the individual segments are on even more infrequently. Should that affect my choice of resistance, or do I still use 51K ohm.

    Does this change my choice of base resistor for the driving transistors?

    I really appreciate your help here!
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Please re-read what I wrote - I calculated 51 Ohms, not 51k Ohms.

    I calculated the 51 Ohm resistors to pass just under 20mA per segment. This is conservative. You might be able to increase the segment current somewhat, but not without doing some testing for Vf vs current. See how bright the displays are with the 51 Ohm resistors. You WOULD need to add individual transistors to the I/O pins (and base resistors) to sink the current from the segments, as right now you're pretty close to the limit.

    You couldn't decrease them very much, as you're already at 14mA; going above 20mA would not be advisable.

    If you increased the LED current by decreasing the 51 Ohm resistors, you would need to change the base transistor's value - however, at
     
  7. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Hey Sarge',

    Please note that if skk is multiplexing the display at a 33% duty cycle and if he wants the effective brightness of 20-ma "average" current per segment that he would need to drive each segment with about 60-ma "peak" current.
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    He won't be able to get 60mA with the suggested setup, and 60mA is likely too high for reliable operation over time. I think the max peak current is 120mA, but at what duty cycle I don't remember offhand.

    As I've already mentioned, if our OP wants more current, they will need to add driver transistors & base resistors to sink the current, and a more robust arrangement for sourcing current.
     
  9. skk

    Thread Starter Member

    Mar 15, 2011
    31
    0
    This is very helpful but I am still somewhat fuzzy, and I am not talking about accidentally writing 51K instead of 51ohms. From the data sheet, "peak forward current" is 150ma for 10usec max. Seems to me that would be per segment, right? Can I not just ballpark the current limiting resistors and adjust the microcode until the displays are bright enough? Help me understand what I am missing here.

    Previously I adjusted the time on per display depending on the number of segments on. I did this for uniform brightness of segments. Is this not protecting my LEDs from burning out assuming I get the microcode right? If I do it this way is there still a good reason to keep the per segment resistors? Also is this PNP transistor not going to work for me? What is wrong with it, please help me see my ignorance. What would work better?

    Thanks again!
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes.
    Why would you "ballpark" them and risk frying your I/O pins and/or displays?
    If you'd like to do that, be my guest.

    I calculated everything out for you already, and suggested values that I felt would help accomplish your goal without stressing your components, even if untested, and without you providing all of the details. For example, I'm not certain what your Vcc/Vdd is, and I don't know what color your 7-segment displays are.

    Now, if you try to increase the current while decreasing the ON time of each segment, you're going to run right into exceeding the I/O pin capabilities, and the PNP transistor will start coming out of saturation; meaning the Vce won't be minimal anymore - so the transistor will start dissipating power as heat.

    You weren't using current limiting resistors at all with the old setup?

    You should always use some form of current limiting with LEDs. Their Vf varies with current, and also with temperature.
    If you keep the per-segment current <= 20mA, the PNP transistor will work fine.

    If you want more current per segment, then the PNP will need more base current. Don't go below 220 Ohms on the base resistor, as you'll probably exceed the I/O pin maximum ratings.
     
  11. skk

    Thread Starter Member

    Mar 15, 2011
    31
    0
    Thanks again for you good advice and doing the math for me. I had no current limiting resistors on the segments previously. I have tens of these boards in use in use for 2 years now, and so far none of them have blown, but I want a good design not just one that works by luck. I will breadboard this thing up first and get the brightness to an acceptable level before proceeding with the board. If I need a per segment transistor to sync the current, can you recommend a transistor?
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    2N3904, 2N4401, or 2N2222 are NPN transistors that would all work. They're available in SMD; change the 2N prefix to MMDT. A 430 Ohm resistor from the I/O pin to the base would give ~10mA base current, allowing up to 100mA collector current and keep Vsat low.
     
Loading...