PDA

View Full Version : LED Current Draw and Resistor Selection



Martin_H
11-18-2011, 02:32 AM
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.

Phil Pilgrim (PhiPi)
11-18-2011, 02:38 AM
I can't dispute your math: 4 x 8mA = 32mA. :)

-Phil

Martin_H
11-18-2011, 02:45 AM
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?

Rayman
11-18-2011, 02:48 AM
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_Acula
11-18-2011, 03:06 AM
220R is what I have used and seems to work well (except for the ultra bright leds).

Martin_H
11-18-2011, 03:16 AM
OK thanks. I figure a sanity check is better than a burned out prop.

Zoot
11-18-2011, 03:27 AM
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

Tubular
11-18-2011, 03:50 AM
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 freedman
11-18-2011, 04:17 AM
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

tonyp12
11-18-2011, 04:21 AM
" 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 freedman
11-18-2011, 04:45 AM
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 Jakacki
11-18-2011, 05:10 AM
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.

Tubular
11-18-2011, 05:31 AM
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_H
11-18-2011, 01:44 PM
" 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_H
11-18-2011, 01:55 PM
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_H
11-21-2011, 12:33 AM
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.

Humanoido
11-23-2011, 01:28 PM
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.