where Vd is the voltage drop and Id is the current you want to use on your LED, usually the forward current. Those values depends on the specs of each LED and varies depending on the color of the LED.
So… you just want to light up an LED. What resistor should you use?
We can can make some rough assumptions to simplify the calculation:
- Common LEDs runs at 20m.
- The voltage drop is typically around 3V.
- Arduino runs at 5V
R = (5-3)/0.02 = 100 (Ohm)
We can say that 100 Ohms is the absolute minimum resistance we need to make sure that we do not damage the LED. To be safe, it's a good idea to use something a little higher, just in case your LED has slightly different ratings that what I've used here.
I always use 220 Ohm resistors because they are a safe choice for all kind of LEDs and are easy to find.
If you know the ratings of your LED (you can find it on the LED's datasheet) and you want to do this calculation yourself or use an online calculator like this or this.
ReferencesAll about LEDS
LED resistance calculator
Arduino Blink example
Turn on LED with 5V
LED Current Limiting Resistors