Calulating BJT base resistance for PIC led switching?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    xnihilo's Avatar
    xnihilo Guest

    Default Calulating BJT base resistance for PIC led switching?

    Hi,

    Hoping this is not too off topic.
    I need my PIC to switch an ultrabright led.

    Using a BC182L general purpose NPN transistor from futurlec
    (http://www.futurlec.com/Transistors/BC182L.shtml)
    and an ultrabright led from futurlec
    (http://www.futurlec.com/LED/LED5YULB.shtml)

    I need to use a BASE resistor for my BJT.

    I'm using the ultrabright led at 2.4V 20mA with a 9V power supply, so I will be using a 330 ohms limiter resistor (9V-2.4V/0.02A)
    Then I've checked the web to find clues to calculate RB for the BJT but there are parameters I don't understand.

    according to
    http://www.kpsec.freeuk.com/trancirc.htm
    I should calculate the RB value with a pretty simple formula but when I have to find the Ic for the load, I'm stuck. How can I determine the right load resistance? Does it mean the total resistance of the current limiter for the led AND the resistance of the led? If so how can I calculate the resistance?
    I did not find the value of the led resistance in the specs of the led.
    Maybe using:
    U=R*I -> R = 2.4V/0.02A = 120 ohms?
    Then I should add the 330 ohms of the led current limiting resistor to have the Ic value using: 9V/.450Kohms = 20 mA?
    If so, then the RB should be (if HFE min is 100 and PIC supply is 5V):
    (5V*100)/(5*0.02A) = 5KOhms

    Am I right?
    Thanks for any hints...


    PS: I should add some voltage drop value somewhere for the transistor?


    In the same idea, I also have to switch an LM555 times but I don't know what value I should consider as the LM555 (the 'load') current and resistance...
    Last edited by xnihilo; - 10th November 2008 at 12:16.

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Connect your NPN transistor with the emitter to ground then you can calculate the resistor in this way:

    R = (Vin - 0.7)/Ib

    Where:
    Vin = pic output (5 v)
    0.7 = base/emitter diode threshold
    Ib = desired base current ( 2mA is what you need for saturating 20 mA load)

    Nearest value = 2,2 K

    LM555 can be connected directly to 9 V PS and the output (pin 3) can drain your 20 mA load without any problem. So you can connect your led + 330 ohms directly to the IC.

    Al.
    Last edited by aratti; - 10th November 2008 at 16:37.
    All progress began with an idea

  3. #3
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Connect your NPN transistor with the emitter to ground then you can calculate the resistor in this way:

    R = (Vin - 0.7)/Ib

    Where:
    Vin = pic output (5 v)
    0.7 = base/emitter diode threshold
    Ib = desired base current ( 2mA is what you need for saturating 20 mA load)

    Nearest value = 2,2 K

    LM555 can be connected directly to 9 V PS and the output (pin 3) can drain your 20 mA load without any problem. So you can connect your led + 330 ohms directly to the IC.

    Al.
    Thank you but I beleive there has been a misunderstanding of my post:
    The LM555 is not driving any led, I'm using a BJT for switching a led (with its current limiter because I use 9V) and another BJT for switching an LM555.
    One pin of the pic is activating the first BJT to switch on the led and another pin is activating the second BJT to trigger the LM555 that will then switch a relay.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Why not using the LM555 @9V directly?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Why not using the LM555 @9V directly?
    Well, because I use it to activate a 5V relay that lets current flow straight from the 9V battery through a nichrome wire to heat it... I don't know exactly what amount of current passes through the relay but is is certainly more than the 200mA that the LM555 can source.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Have a look at the right datasheet
    http://www.classiccmp.org/rtellason/...ata/bc182l.pdf

    Here at 20mA, the minimum you may have should be 80.

    -> Why 20mA? Because it is the desired current for the load ?
    Yes

    To make sure you saturate it properly, some will divide the Hfe parameter by 2, some by 5, and some others by 10.

    -> Why? Is this empirical?
    good question

    Let's use 5, so we have Hfe=16

    -> Hm, yes, but why divide it by 5?
    I believe dividing by 5 is usually safe enough, while dividing by 10 is much safe... well we drive LEDs, not big current, no big deal.

    The base current is the Collector current/Hfe = 20/16 = 1.65 mA

    -> This is the current needed at the BASE to saturate and switch the BJT then?
    Yes

    the base resistor will be
    (5-Vbe)/1.65mA = (5-0.7)/1.65mA = 2.606 K...

    anything in this range or lower will work.

    -> The formulas I found on the web are more complicated and I don't find the same values... ???
    What was your result? I use a simple method, proven to work along the years. For switching, there's no real big deal, on/off, that's it. It's an whole different story in, let's say, amplifiers, smal signal etc etc.

    Have I said I'm a bad teacher
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    You need to know the Hfe parameter of your BJT(gain).

    -> BC182L has a HFE(min) of 100.

    Here at 20mA, the minimum you may have should be 80.

    -> Why 20mA? Because it is the desired current for the load (led used with 9V supply and a 330 ohms current limiter resistor to have 2.4V 20mA)?

    To make sure you saturate it properly, some will divide the Hfe parameter by 2, some by 5, and some others by 10.

    -> Why? Is this empirical?

    Let's use 5, so we have Hfe=16

    -> Hm, yes, but why divide it by 5?

    The base current is the Collector current/Hfe = 20/16 = 1.65 mA

    -> This is the current needed at the BASE to saturate and switch the BJT then?

    Assuming your PIC may give 5V at it's output,

    -> Right

    the base resistor will be
    (5-Vbe)/1.65mA = (5-0.7)/1.65mA = 2.606 K...

    anything in this range or lower will work.

    -> The formulas I found on the web are more complicated and I don't find the same values... ???

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Ok, i'm a poor teacher, but i think the following may help.
    <hr>
    You need to know the Hfe parameter of your BJT(gain). Here at 20mA, the minimum you may have should be 80.

    To make sure you saturate it properly, some will divide the Hfe parameter by 2, some by 5, and some others by 10.

    Let's use 5, so we have Hfe=16
    <hr>
    The base current is the Collector current/Hfe = 20/16 = 1.65 mA

    Assuming your PIC may give 5V at it's output, the base resistor will be
    (5-Vbe)/1.65mA = (5-0.7)/1.65mA = 2.606 K...

    anything in this range or lower will work.

    HTH
    Last edited by mister_e; - 10th November 2008 at 16:45.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  4. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30
  5. can't even flash an LED
    By bruno333 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2005, 13:27

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts