# resistor for led

I am just starting up with arduino . The arduino suggests using a 220 ohm resistor with the led and that basically leads to 23mA based on ohms law 5V/220 = .023. But I have trouble understanding the datasheet and coming up with a conclusion that 23mA is the safest current to use. http://arduino.cc/documents/datasheets/LEDR-L-7113ID-12V%28Ver1287713938.7%29.pdf

Where does in the datasheet tells that maximum current is 23mA ?. Basically all i wanted to figure out myself what resistor i would require for a given led by reading the specs.

thanks

hudu: ... 23mA based on ohms law 5V/220 = .023.

There won't be 5V on the resistor, the LED will want some volts, too.

I agree. My question is how do I find out by looking at the specs how much voltage drop it will produce and how much maximum current it can handle so that I can calculate the exact resistance

You do not have complete equation: (5V - Vf)/220 = R Vf is the forward voltage of the LED, typically 2.5 to 3.5V. So (5V - 2.5)/.02 = 125 ohm LED data sheet will show max continuous current, if it doesn't than 20mA is usually a good number. '328P datasheet Table in Section 29 discusses the current limits of the ports.More than 20mA is not guaranteed.

Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: ATmega48A/PA/88A/PA/168A/PA/328/P: 1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA. 2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA. If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.

Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: ATmega48A/PA/88A/PA/168A/PA/328/P: 1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100mA. 2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100mA. 3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100mA. If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.

The LED linked to is not typical - it has an internal resistor so it can driven from 12V

Right on page 1: "12V internal resistor"

That resistor is likely (12V - 2.5V)/.02 = 475 ohm

So with 5v: (5V - 2.5V)/475 = 5.2mA - so you don't need a resistor at all, and it will be dimmer than if powered from 12V.

Page 2:

IF, Forward Curren,t High Efficiency Red, min 8.5 max 11.5 mA, VF=12V

So (12V - 2.5V)/11.5mA = 826 ohm Do the math for 5V - gonna be dim!

So based on your calculation, " So (12V - 2.5V)/11.5mA = 826 ohm Do the math for 5V - gonna be dim! " led will act like a 826 ohm resistor. So without the resistor I will have 5V/826ohm = 6mA . So it should be OK without an resistor? and if you add additional 220 5v/(826+220) = 4 mA.

Am I missing something ?

led will act like a 826 ohm resistor.

No.

o without the resistor I will have 5V/826ohm = 6mA

No.

So it should be OK without an resistor?

No.

No.

Am I missing something ?

Yes.

Need to look at it like this. In the top example, an NPN transistor is needed to keep 12V away from the Arduino pin.

@jbarchuk, There is no way to get 20mA thru the referenced LED. It has an internal resistor that limits current to 11.5mA max with 12V.

CrossRoads: @jbarchuk, There is no way to get 20mA thru the referenced LED. It has an internal resistor that limits current to 11.5mA max with 12V.

Sorry, I missed that detail. :blush:

EDIT: My post was drivel anyway so I deleted it.

jbarchuk: Sorry, I missed that detail.

The other thing you missed is that you keep saying mAh

The 23 mAh is typical for common LEDs.

LED mAh varies somewhat, generally by -color-.

pick a resistor that kicks the LED with 500 mAh

mAh - stands for milliamp hours - it is a way to describe the capacity of a battery, it has nothing to do with LEDs. If you refer to the current through an LED is is measured in mA. Also the mA DOES NOT vary with colour, it is the forward volt drop that varies with colour.

Grumpy_Mike: The other thing you missed is that you keep saying mAh.

mAh - stands for milliamp hours

Of course. I'm much more involved with mAh batteries and A (not mA) devices, so when I typed mA the 'h' got hit by habit.

Also the mA DOES NOT vary with colour, it is the forward volt drop that varies with colour.

I'll look again for that chart. It gave specs for voltage drop and mA according to color. Not cast in stone because every manufacturer is different, these were more relative averages, but still a good reference. (My bookmarks got wiped out accidentally while scrubbing a malware.)

Wow found it! http://www.oksolar.com/led/led_color_chart.htm I misremembered it slightly - the '50 mA' values were for the infrared and 'ultra' red LEDs. Everything else is referenced by -mcd- @20 mA. The cool part is that it shows how Vf -can- vary by almost 2x from 2.0 to 3.8 and that was the point of the descriptions about calculating R.