35mA led with 25mA pic output?


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    I have no 5v 10mA led left and the only led i have is 2v 35mA and I have to use that with a pic which can output maximum 25mA per pin. What will happen??
    Hi, can you say what you THINK might happen,


    ____

  2. #2
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by duncan303 View Post
    Hi, can you say what you THINK might happen,


    ____
    Led will glow dimmer...?

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


    Did you find this post helpful? Yes | No

    Default

    Place a 220 ohms resistor in series to your led. If you want it brighter, then you should use a transistor. Your beeper can be connected directly to the pic output.

    Al.
    Last edited by aratti; - 24th October 2008 at 11:10.

  4. #4
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    You'll compromise the integrity of the pin trying to draw too much current from it with your 35mA LED. Possibly damage the PIC.

    Put a transistor in the circuit.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hi Xnihilo,

    If you want to keep the full LED brightness you must use some sort of buffer (a small NPN or PNP transistor or a low power N or P channel FET or MOSFET will be your best choices) combined with a 82 Ohm resistor for your 2V 35 mA LED.
    If you don’t mind loosing some brightness a limiting resistor (in your case 120 Ohm will give you 25 mA or 150 Ohm will give you 20 mA).
    All you have to do is trying and decide.

    Regards,

    Nick

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    Two paralled-trough-180 Ohms-resistors pins will do it ...

    simple way.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by Nicmus View Post
    Hi Xnihilo,

    If you want to keep the full LED brightness you must use some sort of buffer (a small NPN or PNP transistor or a low power N or P channel FET or MOSFET will be your best choices) combined with a 82 Ohm resistor for your 2V 35 mA LED.
    If you don’t mind loosing some brightness a limiting resistor (in your case 120 Ohm will give you 25 mA or 150 Ohm will give you 20 mA).
    All you have to do is trying and decide.

    Regards,

    Nick
    I understand i should use the 5v power supply with a 82 ohms limiter and switch led with a transistor in order to have full brightness but i do not wish to add a transistor. I should then either choose an inline current limiter and chose the adequate value for let's say 20mA and have a dimmer led or get a 10mA led.
    Okay, thanks all for your answers.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    I understand i should use the 5v power supply with a 82 ohms limiter and switch led with a transistor in order to have full brightness but i do not wish to add a transistor. I should then either choose an inline current limiter and chose the adequate value for let's say 20mA and have a dimmer led or get a 10mA led.
    Okay, thanks all for your answers.
    Find the datasheet for your particular LED...
    Look up 'Forward Voltage'...assume it's 1.5v for example.
    Now look up 'Current'...assume in this case it's 35mA, 'cause that's what you said it was
    And you're driving the LED from a PIC pin at 5V

    The LED will 'drop' 1.5v across it 'cause it's a diode and that's just the way they are...
    So, that leaves you with 3.5v to work with.
    The LED wants 35mA (.035A)

    Ohms Law - I=V/R, V=IR, R=V/I
    R (ohms you need) = V (volts, 3.5V) / I (35mA)
    R = 100 ohms...
    But that'll allow up to 35mA per PIC pin, over the limit...but you're driving the LED from 2 pins (unless I misunderstood).
    So, R = 200 ohm across each PIC pin will give you 17.5mA from each pin, paralleled to the LED.

    But I gotta tell you, it'll work, but it's not 'the way to do it'. The right way to do it is to add an external transistor or MOSFET to turn the LED on or off.
    Or you could just increase the resistor value and use one pin... Like you said, the LED will be dimmer.
    Last edited by skimask; - 24th October 2008 at 18:37. Reason: Changed 50 ohm to 200 ohm....Thank Nicmus if you don't blow a pin on a PIC :D Good catch...

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Ski,

    Don’t you mean two resistors of 200 Ohm each when driving the LED with two I/Os?

    Nick

  10. #10
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    It may be that the 35mA rating for the LED you describe is a maximum, do-not-exceed rating. If you can find the data sheet for the LED, see if it also gives a typical operating current.

    People sometimes forget that most LEDs will produce full brightness long before maximum rated current is reached.

    A couple of replies have suggested a 220 ohm resistor; that or even a 180 ohm resistor would be a good starting point. Depending on the Vf of the LED, that will give you something between 14 and 19 mA. You may be surprised to find that the LED is quite bright.

    The piezzo buzzer i use is 3-12v continuous tone, 9mA. 9mA for what voltage??
    Piezo tone/buzzer devices are basically voltage-driven; the greater the voltage, the louder the sound. The 9 mA rating is probably for the 12 VDC maximum; at 5 volts, it will likely draw only 4 or 5 mA.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  11. #11
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    R (ohms you need) = V (volts, 3.5V) / I (35mA)
    R = 100 ohms...

    ->Yes, I already know that. The led is a 2V, 35 mA so with 5V it will need a current limiter of 5-2 / 0.035 Ohms.

    But that'll allow up to 35mA per PIC pin, over the limit...but you're driving the LED from 2 pins (unless I misunderstood).

    ->No, only from one pin (thus max 25 mA, according to Microchip DS).

    So, R = 200 ohm across each PIC pin will give you 17.5mA from each pin, paralleled to the LED.

    But I gotta tell you, it'll work, but it's not 'the way to do it'. The right way to do it is to add an external transistor or MOSFET to turn the LED on or off.

    ->Yes, this too I inderstand, that's the way I switch my IR leds (TSAL6100 that can eat up to 1A if used with pulsed current) from 9V source.
    In this case I should not use a led that needs so much current as I drive it with an IC pin.
    I used to order 5v Chicago red that need 10mA (from) MOUSER but as the shipping costs are too high, I order leds form FUTURLEC but these need 35mA and to keep my PCB simple I wish not to add an extra transistor. I guess I don't have the choice but to order the right led maybe from FARNELL if they have them... or use a transistor.

    By the way, I read some info about BJT and MOSFET and still don't know what I should use in my design. MOSFETS are a little more expensive. I need to use a limiter transistor from IC pin to transistor base if I use BJT and choose the right value according to the Load switched by the transistor. I don't need to use such resistor with a mosfet (I think).
    As I need to output a 40KHz PWM I could use both BJT and MOSFET even though MOSFET can swich faster but I found some IRL... mosfet wich are level-logic and can switch up to 16A and cost only .60usd versus .22usd for a BC182L for example. I just wonder if I could use such MOSFET to switch a motor or a nichrome wire instead of a bulky DIL transistor that needs a BJT, a resistor a diode,...


    Or you could just increase the resistor value and use one pin... Like you said, the LED will be dimmer.

    -> Right, as I don't need full brightness, I guess I will rather do that.
    Skimask, thank you for your information.

  12. #12
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by J. Mark Wolf View Post
    You'll compromise the integrity of the pin trying to draw too much current from it with your 35mA LED. Possibly damage the PIC.

    Put a transistor in the circuit.
    I see, the led will try to draw the 35mA it needs. The Chicago red 5v 10mA i used before were better
    Thanks

  13. #13
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Place a 220 ohms resistor in series to your led. If you want it brighter, then you should use a transistor. Your beeper can be connected directly to the pic output.

    Al.
    Okay, thank you but tell me, how did you calculate this 220 ohms value?

Similar Threads

  1. comp music with pic Sounds - Aka BeepMaster
    By flipper_md in forum Code Examples
    Replies: 18
    Last Post: - 20th September 2010, 06:04
  2. Calulating BJT base resistance for PIC led switching?
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th November 2008, 08:41
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  4. Capacitor on PIC output
    By Michael in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2008, 19:10
  5. PIC16F877A PAUSE command
    By Nicholas in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 12th December 2006, 01:40

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