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
    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)

    Thanks for that...well I tried it (basically supplying a PIC off 3.3v) ...it all works, but alas, the LEDS aren't quite bright enough.

    A bit of experimentation suggests a supply voltage of about 3.6V would be best ...but I need the regulator to be a SOT23-3 package& they don't seem to exist in 3.6V voltages.

    My immediate thoughts re a kludge is to use a 4V regulator but use PWM to feed the LED 'common cathodes ' with 0V only 90% of the time ....which is effectively a voltage of 3.6V across the LEDs?? (yeah I know, it's not really it's still 4V across the LEDs ...albeit for only 90% of the time ....but I'm thinking that at least the LEDs, will have 10% 'downtime' to cool off from the extra current through 'em)

    Do-able?

  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)

    Doh....the reason 3.6V to 4V works better with the LEDs (which was puzzling me, since the LEDS are meant to have a rated forward drop of 3.2V)), is because I have an NPN transistor switching the common ground to all the LEDs...this drops 0.7V across itself, therefore the LED only sees the 'supply voltage' less 0.7V the drop acrossr the NPN tranny) ...therefore at a supply of 3.3V the LED was only seeing 2.6V ...no wonder they were dim - man, I'm having a bad day!

  3. #3
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

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

    Driving LEDs without a resistor:
    LEDs are current to light devices not voltage to light. The forward voltage is for reference only.
    I just looked through 10 data sheets for parts we are using. Often the forward voltage is only stated as typ. Several LEDs were rated as 3.2V typ, 4.0 max and they did not rate Vmin. As a hobby you do what works. If you purchase millions you will find parts that need 3.7 volts and parts that need 2.8 volts.
    LEDS are like a Zener diode. IF 3.0 volts = 10mA them 3.2 volts =20mA. Worse yet the V-forward drops with temperature. As the parts gets hot it will pull more current (in constant voltage move). Runaway condition.

  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)

    Still mulling my options here.

    Here's the conundrum....I want to be able to run upto 12 leds off either AA - or more likely AAA - batteries. It's be cool if I could use rechargeables.

    Therein lies a problem....3 x 1.2V is 3.6V ....an LDO would be no good here (they normally have a drop out voltage of about 0.8V.....meaning with 3 batteries the max I could expect to get regulated is about 2.7V (& that's with fresh batteries!)

    I could up the battery quota to 4 batteries, but I'm really pushed for space...so I'd like to stick with 3 x 1.2V batteries (or 2 x 1.5V batteries)

    Ok, blue LEDS ....yep, they normally have a forward voltage quoted around the 3.4V mark....having measured the batch I have, the current through 'em at that particular voltage is about 20mA. I actually want to 'under volt' them....the blue LEDs I tested only pull about 10-12mA at around 3.1V....but they're still plenty bright.


    So here's what I was thinking....

    use a 'LF' PIC variant, supplied by battery but the PIC gets it's supply via low quiescent current 2.5V regulator.

    Drop the unregulated battery supply via a two resistor divider, so that the max that can be seen at the PIC ADC pin from the resistor the junction feeds is 2.5V.

    So for example.....3 x normal AA batteries (fresh @1.6V initially), would mean 4.8V unregulated.....so eg use two resistors R1 2.3K, R2 =2.5K.

    Ok, now with fresh batteries, there'll be 2.5V at the junction....feed this into a PIC, ADC it, now use a LUT....

    If the PIC's ADC reading is 255, then the duty cycle (to the leds) should be 168 (66%)...therefore the effective voltage the LEDS 'receive' is 3.1V (4.8V x 67%)

    Ok, now the batteries drop after usage, let's say they now amount to 3.8V in total ...this would read as an ADC value at the pic pin of 201, the duty cycle to the LEDs is 211 83%,so what I'm proposing is a simple lookup

    if ADC value = 255 the duty_cycle = 168
    if ADC-value = 201 then duty cycle = 211

    & all values in between.

    Or is there an LED driver IC (or an inductorless buck converter ....as inductors don't work well in guitars) to save me the bother? (to recap, I don't want to lose the 'spare/excess' voltage as wasteful heat (ie via a linear regulator)....but rather use PWM to 'manage/massage' the effective voltage that the LEDs ' receive'

    (yes I know leds are current devices, but there's a good correlation between voltage applied across them & current they draw...also, again, I'm going to be underpowering them)
    Last edited by HankMcSpank; - 19th May 2011 at 21:37.

  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)

    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.

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

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

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