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)

    You get the idea.

    Look Melanie Dice example, or do it simple, plug your LED directly to the PIC and have a PWM running out of your PIC, use a MOSFET to drive the common GND or VDD of your LED (whatever floats your boat).

    You now have a variable intensity, using a minimum of parts... BUT, the more the battery get flatten, the less intensity you'll also have (assuming you don't use anything to monitor it... and if so... you end up with more extra hardware than a simple LDO regulator)
    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
    You get the idea.

    Look Melanie Dice example, or do it simple, plug your LED directly to the PIC and have a PWM running out of your PIC, use a MOSFET to drive the common GND or VDD of your LED (whatever floats your boat).

    You now have a variable intensity, using a minimum of parts... BUT, the more the battery get flatten, the less intensity you'll also have (assuming you don't use anything to monitor it... and if so... you end up with more extra hardware than a simple LDO regulator)
    This is exactly the setup I'm proposing....use a transistor to control the 'effective' voltage the LEDSs 'see'. But for monitoring, I'll use a spare ADC pin on the PIc to monitor the unregulated supply voltage....and then adjust the PWM to the LEDs accordingly.

    The problem with using an LDO regulator, is they're very inefficient.

  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)

    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.

  4. #4
    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 11:23.

  5. #5
    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.

  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)

    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.

  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
    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 11:24.

  8. #8
    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.

  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