I am starting to learn electronics together with an arduino. The first project is just to make an red LED light up on a 5V power source. in that circuit they use a 220 ohm resistor.

My question is what formula do we use to calculate the resistor?

I do know that the recommended amperage for an LED is between the 20-25mA and when I calculate the Amperage (5V/220ohm) I get 23mA.

I then googled and saw an other way to calculate the Resistor and now I am not sure on how to calculate this value.

The other formula is taking the Vf value of the LED into account. datasheet here: https://www.arduino.cc/documents/datasheets/LED(red).pdf I see a min of 1.9Vf and max 2.4Vf

If I then calculate R, I would get this formula: (5V - 1.9V) / 23mA = 3.1V / 23mA = 135 Ohm

Can I safely use a resistor of 135 Ohm for my LED on a 5V power source? Because now my A over the circuit is 37mA (5/135) and the max A in the datasheet is 30mA.

  • \$\begingroup\$ Yes you can. Just stop worrying and try it. \$\endgroup\$
    – user76844
    Commented Oct 29, 2016 at 12:30

2 Answers 2


Short answer, yes 135R may be Ok @23 mA +- 30% or more

  • or in same batch +/-1% mA of whatever it is.

Long Answer

But NEVER exceed Absolute max of 30mA (except for experimental purposes, as explained below) 220R is ok for 5V with Ohm's Law for current limiting R. But don't forget internal R's of driver and source also have some R and also some uses have 2% to 10% 5V tolerance ...

  • for RED Vf = ~ 1.8V + If*ESR
    • where ESR for 65mW rated 5mm LEDs is 15 Ohms nom @20mA or 10-20 Ohm typical range,
    • thus Vf variations result from internal ESR and ESR slightly drops with rising If
    • while Vf drops slightly ~ -1mV/'C with rising Tj ,
    • Thus @20mA , Vth= 1.8 is just a low current threshold (eg.10%), while Vf is the rated forward voltage at rated current for RED AlInGaAs , (not old GaAs RED)

For 5mm , 20mA is for high ambient T and 30mA is absolute max where Junction temp can rapidly create moisture vapour pressure internally. (exceed 100'C)

Also you subtract the Vf from Vcc to compute the voltage drop and current limiting R , (not 5V/220R), rather (Vcc(max)-Vf)/20mA, eg Red, (5.25-1.9V(min))/25mA= 135 ohm

If you drive it past the Absolute Maximum, it may or may not last very long but will be super bright. Rated "If current" is advised for production.

Considering you can get 5mm 10 Candella @20mA 30 deg, this is blinding bright for long distance indicators, so 25mA may be overkill for short range indicators, but otherwise "ultrabright".

Temp rise of the junction is ~0.9'C/mW and for example 35mA*3.1V~110mW for a 65mW rated 5mm part or a junction temp rise of ~100'C which may evaporate any moisture absorbed in open bag storage and pop molecules of vapour pressure and shear the 1 micro gold whisker wirebond on the anode.

Clear Epoxy LEDs have a low moisture seal rating unlike black epoxy. This risk is only from storage absorption and abrupt rise above boiling or below freezing point, such as soldering and freezing humid weather. This is why good Mfg datasheets specify 3sec soldering time and keep sealed until soldered.

Your calculations and all online calculators are close enough, but technically can be improved.

All diodes follow an ESR Power rating product that is fairly constant. My Rule of thumb is ESR =x/Pd for a package rating, Pd and x=1 typ, and as low as 0.5 in better epiwafer designs.

One reason is all drivers have internal bulk resistance too which adds to the external R a bit.

  • 25-300 Ohms for 74ALCxxx at 3.3V to CD4xxx @15V typ, Others and myself may know this from many years of experience.

The ESR or internal driver resistance of all CMOS is related to the voltage technology and RdsOn values used to prevent excessive shootthru currents at Vss during the transition when both drivers are ON.

My Rule of thumb for Arduino ports using 5 V logic is like newer ~74HCxxx ~50 Ohm family not same as ARM 3.3V logic ~74ALCxxx family ~25 Ohm,

  • found by computing (Vce-Voh)/Ioh~ESR (high side)
  • this depends on supply tolerance and Vss used which results in for 5V 33-66R typ range , but I use 45-50 Ohm nominal for CMOS@5V with Arduino type 74HCxxx
  • the lower the Vcc max spec, in a CMOS, allows industry to choose lower RdsOn drivers for faster Tr.

For personal use it may not be critical, but in high volume production worst case tolerances from all sources must be considered.

Therefore recommended design values of 20mA have many reasons and online calculators often do not consider all the variables.


Forward voltage of the LED specified in the question is typically 2.2 volts at 20 mA so, from a 5V supply the resistor will drop typically 2.8 volts and, with 20 mA flowing it should have a resistance of 140 ohms.

If the forward volt drop of the LED were at the lowest value specified i.e. 1.9 volts then a 140 ohm resistor would permit a current of 22 mA and that would be fine (less than the maximum continuous forward current of 30 mA).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.