how to find the right resistors for led's

First, you need to know the resistance needed. For this, you need Ohm's Law.

(Vs-Vf)/If=R

where:

Vs = Source Voltage (either 3.3v, 5v, or 12v)
Vf = Forward Voltage (almost always stated on the package)
If = Forward Current (usually 20-30mA, stated as 0.02 to 0.03 in the formula)
R = Resistance in Ohms

For example, a 2.1v, 20mA LED using a 5v power source would figure like this:

(5-2.1)/0.02=R
2.9/0.02=R
R=145 Ohms

Use this number as a rough guide and purchase the resistor(s) that is the next highest value of R (in this case, I believe it'd be 170 ohms).

You also need to know what Watt rated resistor you need.

P=If*(Vs-Vf) <--- Power Law
P = Power in Watts
If = Forward Current from the previous formula
Vs-Vf = what you used in the previous formula also

Continuing with the example:

P=0.02*2.9
P=0.058 watts

If P <= 0.25, then use 1/4 Watt rated
If P > 0.25 but <= 0.5 use 1/2 Watt rated
If P > 0.5 then use 1 Watt rated

Using these numbers will help you purchase the resistor(s) you will need for a project working with LEDs.

Submitted by Snick