Drive an LED direct from a PIC IO pin (ie no current limiting resistor)


Closed Thread
Results 1 to 24 of 24

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    I would suggest to use a Mosfet with a decent small Rds, this way you could/should loose less voltage across than a regular BJT.

    Add a small value resistor between the MOSFET source and GND, put a cap on it, feed it to the ADC and voila you monitor the current.

    Tons of way to do it.
    Steve

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

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    Quote Originally Posted by mister_e View Post
    I would suggest to use a Mosfet with a decent small Rds, this way you could/should loose less voltage across than a regular BJT.

    Add a small value resistor between the MOSFET source and GND, put a cap on it, feed it to the ADC and voila you monitor the current.

    Tons of way to do it.
    All good stuff there....have you any example of suitable mosfets you've used in the past? (just to give me a general vibe of the spec - I'm ideally looking for something in a SOT23 package)

    Edit: Hmm: I'm thinking here that I'm only going to be switching 3.3V across the leds - do mosfets work ok that low (all the ones I'm seeing on digikey are typically 20V VDS or more ...ok so that's a max figure, but never having used modfets, are they ok with switching 3.3V well)
    Last edited by HankMcSpank; - 20th May 2011 at 10:23.

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


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    Yish, me and remembering Mosfet Part # are two different animal

    I would say go on Digikey website, type Mosfet SOT23, then shop by max current and Rds.

    How much current you'll need?
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    And don't forget to check the datasheet... Vgs...
    Steve

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

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    Quote Originally Posted by mister_e View Post
    Yish, me and remembering Mosfet Part # are two different animal

    I would say go on Digikey website, type Mosfet SOT23, then shop by max current and Rds.

    How much current you'll need?
    Not much....8 possibly 12 leds....ay about 15mA each max ....say 180mA, I'll have a sniff on Digikey.....


    Edit: Hmm: I'm thinking here that I'm only going to be switching 3.3V across the leds - do mosfets work ok that low? (all the ones I'm seeing on digikey are typically 20V VDS or more ...ok so that's a max figure, but never having worked with MOSFETS previously, are they ok with switching 3.3V well)
    Last edited by HankMcSpank; - 20th May 2011 at 10:24.

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


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    Double check those

    BSS138, 2n7002K, FDV305
    Steve

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

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    Quote Originally Posted by mister_e View Post
    Double check those

    BSS138, 2n7002K, FDV305
    Well in the end I ordered up a few BSS138s.....I have to hold my hands up & say I'm gernally bemused about what's going on here.

    Firstly, here's the simple circuit (the schem shows a tranny, but for the purposes here, it could be a tranny or a fet)...



    (there are actually two more 'legs' of leds not shown....they join to the same FET drain ...so in total 8 LEDs)


    So the story is, I'm wanting to use a 9V battery...but rather than waste the extra voltage across a high value resistor, I want to use PWM to 'average' the current the LED sees through it.

    I initially used a NPN digital tranny, but measured approximately 3V across the emitter collector. Now that struck me as a lot, so I posted further up on this thread ...the recommended BSS138 looked like a reasonable contender ...about 3.5 Ohms when on.

    So I put one in situ today expecting to see a couple of hundred millivolts drop across the source drain....nope not at all .....at 9V supply, with those resistors above, & with the PIC running at a duty cycle value of about 87 (where 255 is max), Im measuring 2.59V on the FET drain .....since the source is tied to ground, this means there's 2.59V being dropped across the fet....yet across the resistors I'm measuring 780mV ....which means there's about 20mA running through each LED 'leg'...so the FET has 4 x 20mA running through it = 80mA (ie four groups of two leds......each group has 20mA throug it) ....so how come I'm seeing a drop of 2.59V across the FET?

    This suggest the Jfet Drain Source resistance is about 32 Ohms?!! (which is nowhere near the 3.5 ohms I was expecting!)

    What am I missing here?
    Last edited by HankMcSpank; - 4th June 2011 at 00:50.

  8. #8
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    What that tells you is that the average Vf (forward voltage drop) of your LEDs is 2.815V [(9-2.59-0.78)/2] at 20mA current draw.
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

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


    Did you find this post helpful? Yes | No

    Default Re: Drive an LED direct from a PIC IO pin (ie no current limiting resistor)

    Quote Originally Posted by HankMcSpank View Post
    Edit: Hmm: I'm thinking here that I'm only going to be switching 3.3V across the leds - do mosfets work ok that low? (all the ones I'm seeing on digikey are typically 20V VDS or more ...ok so that's a max figure, but never having worked with MOSFETS previously, are they ok with switching 3.3V well)
    You want to look for Logic Gate one and/or with a low Vgs... at least under the battery voltage
    Steve

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

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