Shop OBEX P1 Docs P2 Docs Learn Events
LED Current Draw and Resistor Selection — Parallax Forums

LED Current Draw and Resistor Selection

Martin_HMartin_H Posts: 4,051
edited 2011-11-23 05:28 in Propeller 1
If I've read the propeller data sheet correctly, it can supply up to 40 mA. For my LED project I have the LED's Charlieplexed so I can control them with various pin combinations. I want to light more than one LED at a time, but I definitely want to be within the prop's specs.

I have calculated that a 220 ohm resistor will result in an 8 mA current from a single pin. So I should be able to concurrently light 4 LED's and stay well under 40. I could light 5, but that would be pushing it.

Does this sound correct? Thanks in advance.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-17 18:38
    I can't dispute your math: 4 x 8mA = 32mA. :)

    -Phil
  • Martin_HMartin_H Posts: 4,051
    edited 2011-11-17 18:45
    OK perhaps I should be more specific. Does this look like the correct way to calculate current across a red Led?

    3. 3 - 1.6 (LED voltage drop) = 220 * 8 mA

    And did I read the propeller data sheet correctly?
  • RaymanRayman Posts: 15,001
    edited 2011-11-17 18:48
    Just a thought... A lot of times I've seen a difference between DC limit and pulsed limit. Usually, if the duty cycle is low, the current can be much higher...
    Personally, I think I'd try using no resistor and just pulsing the LEDs directly from a Prop pin...

    Actually, I take this back because then the current would not be completely defined.
    I think I like it better when the external circuit defines the current...
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-11-17 19:06
    220R is what I have used and seems to work well (except for the ultra bright leds).
  • Martin_HMartin_H Posts: 4,051
    edited 2011-11-17 19:16
    OK thanks. I figure a sanity check is better than a burned out prop.
  • ZootZoot Posts: 2,227
    edited 2011-11-17 19:27
    This is a handy page for calculating resistor values for various LED combinations, voltages and voltage drops (Vf). It also lets you "round" to the nearest common value resistors.

    http://ledcalc.com
  • TubularTubular Posts: 4,726
    edited 2011-11-17 19:50
    At the risk of getting a reputation for being the "internal fet resistance policeman", don't neglect the 27 ohm internal resistance of the propeller's pin driving fets, both hi side and lo side (54 ohms total).

    The effect of these are to put less current into your led, so you'll end up with more like (3.3 - 1.6 volts led drop) / (220 + 27 + 27) ~ 6.2mA rather than 8mA.

    You can easily verify this for yourself my measuring the voltage across your 220 ohm resistor(s) for the cases where 1, 4 etc LEDs are lit
  • frank freedmanfrank freedman Posts: 1,983
    edited 2011-11-17 20:17
    I can't dispute your math: 4 x 8mA = 32mA. :)

    -Phil

    Would make sure all leds draw is lte the 8ma you have calc'd with.
    Frank
  • tonyp12tonyp12 Posts: 1,951
    edited 2011-11-17 20:21
    " I have the LED's Charlieplexed", "I want to light more than one LED at a time"

    It's the side effect of charlieplexing that you can only have one LED set ON at any one time.
    You just have to do it really fast to make them all look on.
    http://youtu.be/8apRaZQbv5w

    As anything else you would have random/limted control what is on or off

    You could not go over the 40mA, unless you use the highduty version
    http://www.electro-tech-online.com/microcontrollers/119157-charlieplex-n.html#post979377 (don't forget 2k resistor to base)
  • frank freedmanfrank freedman Posts: 1,983
    edited 2011-11-17 20:45
    Tubular wrote: »
    At the risk of getting a reputation for being the "internal fet resistance policeman", don't neglect the 27 ohm internal resistance of the propeller's pin driving fets, both hi side and lo side (54 ohms total).

    The effect of these are to put less current into your led, so you'll end up with more like (3.3 - 1.6 volts led drop) / (220 + 27 + 27) ~ 6.2mA rather than 8mA.

    You can easily verify this for yourself my measuring the voltage across your 220 ohm resistor(s) for the cases where 1, 4 etc LEDs are lit

    Actually the resistance would be 27 ohms to Vss or Vdd. If I am wrong on this I am sure Beau will correct me, but typically the output pins will be totem pole fashion with one 27 ohm to VDD and another 27ohm to Vss. You may turn off both FETs to acheive tri-state function, one or the other on for high or low, but likely never both (unless this is done for some special reason i.e. 1.65 on the output pin). so the current will actually be
    (Vss - Vled)/(Rseries+Rint)
    where Rint is the 27 ohms to Vdd or Vss depending on how the led is connected and which internal FET is driving the pin.

    Frank
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-11-17 21:10
    A red LED will exhibit around 1.6V drop at low currents but this can rise to around 1.8V or more with higher currents. The Prop's drive voltage will also be reduced at higher currents so in combination the current limit resistor is much smaller than you think. Since you are 'plexing the duty cycle will be very low per led as will the brightness so you can pulse a single LED with 40ma with short pulses and less than 50% duty cycle (for example). Personally I wouldn't expect a simple direct drive scheme to create a bright display although you could use ultra-bright LEDs to compensate. So the current limit resistor ends up in the tens of ohms rather than hundreds but there will be variations due to many factors so you are limited with charlieplexing as this always requires source/sink whereas multiplexing can use open-collector transistors for much greater current drive.
  • TubularTubular Posts: 4,726
    edited 2011-11-17 21:31
    Here's my test results for this circuit
    (output hi) P16 ----/\/\/\
    |>|
    P17 (output lo)

    (1) Single led "charliplex" using a red led and 220 ohm series resistor
    Supply 3.27v
    P16 = 3.118v with respect to Vss
    drop across 220 ohm resistor 1.274v => 5.8mA flowing
    drop across red LED = 1.698v
    P17 = 0.145v => 25 ohm lo side fet resistance

    (2) Using a 1 ohm series resistance to measure current easily
    Supply = 3.31v
    P16 = 2.533 v
    drop across 1 ohm resistor 24.2mv => 24.2mA flowing
    drop across red LED = 1.804v
    P17 = 0.703v => 29 ohm lo side fet resistance

    What this means, even with IR leds (which have a lower voltage drop), at 3v3 supply you're never going to hit 40mA driving leds in charliplex fashion. The internal fet resistance just won't allow it. This is a 'feature'
  • Martin_HMartin_H Posts: 4,051
    edited 2011-11-18 05:44
    tonyp12 wrote: »
    " I have the LED's Charlieplexed", "I want to light more than one LED at a time"

    It's the side effect of charlieplexing that you can only have one LED set ON at any one time.
    You just have to do it really fast to make them all look on.
    http://youtu.be/8apRaZQbv5w

    As anything else you would have random/limted control what is on or off

    You could not go over the 40mA, unless you use the highduty version
    http://www.electro-tech-online.com/microcontrollers/119157-charlieplex-n.html#post979377 (don't forget 2k resistor to base)

    To be specific the alternate columns are charlieplexed to half the column pins required. I have a pin per row so I can light up more than one row LED at a time. My plan is to light them up in groups of four so I can sweep through all LED's faster.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-11-18 05:55
    Tubular wrote: »
    Here's my test results for this circuit
    (output hi) P16 ----/\/\/\
    |>|
    P17 (output lo)

    (1) Single led "charliplex" using a red led and 220 ohm series resistor
    Supply 3.27v
    P16 = 3.118v with respect to Vss
    drop across 220 ohm resistor 1.274v => 5.8mA flowing
    drop across red LED = 1.698v
    P17 = 0.145v => 25 ohm lo side fet resistance

    (2) Using a 1 ohm series resistance to measure current easily
    Supply = 3.31v
    P16 = 2.533 v
    drop across 1 ohm resistor 24.2mv => 24.2mA flowing
    drop across red LED = 1.804v
    P17 = 0.703v => 29 ohm lo side fet resistance

    What this means, even with IR leds (which have a lower voltage drop), at 3v3 supply you're never going to hit 40mA driving leds in charliplex fashion. The internal fet resistance just won't allow it. This is a 'feature'

    These are interesting results and 5.8 mA result means I have plenty of headroom and no worries about current draw for what I am planning.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-11-20 16:33
    Good news.

    I finished up the wiring and used 220 ohm resistors on each row. I wrote a program to sweep through the LED matrix illuminating one LED at a time. It works well, so now I need to get cracking writing a real program. I'll throw up a video soon.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-11-23 05:28
    Martin_H wrote: »
    I'll throw up a video soon.

    Posting a video is a good idea. Please don't throw up.
    This is what appears in the eye when you become an English teacher. :smile:

    When available, I use a resistor substitution box and start with a higher resistance value.
    You can lower the values incrementally until the LED is at perfect illumination.
Sign In or Register to comment.