In all LED examples that I find, they have the forward voltage set to a specific number (i.e. 2.1v) and calculate the resistor needed based on that number. But when I look up datasheets, the forward voltage comes in ranges (2.0v - 2.5v). This makes sense to me since not all LEDs are created equal. But it's making it hard for me to figure out what resistor to use.
So I decided to design a circuit. I have a 3v voltage source (2 AA batteries) that connects to a resistor that connects to an LED that connects back to the voltage source. The LED's max sustainable current is 20mA.
I decided to use Ohm's Law on the low and high end of the forward voltage range to calculate resistances.
$$(3.0v - 2.0v)/20mA = 50\Omega$$ $$(3.0v - 2.5v)/20mA = 25\Omega$$
The problem comes when I pick a resistor. Let's say I pick the 50 Ohm resistor but the LED that I get actually has a forward voltage of 2.5v. The actual amount of current that would go through the LED would be 10mA. That's not using the LED to it's full potential.
If I use the 25 Ohm resistor and the LED has a forward voltage of 2.0v, then the amount of current going through the LED would be 40mA. My LED would explode.
Using the "set value" of 2.1v to calculate resistance gives us 45 Ohms.
$$(3.0v - 2.1v)/20mA = 45\Omega$$
If my LED had a forward voltage of 2.0v, the current would be 22mA. That's over the rating for the LED. If the LED had a forward voltage of 2.5v, the current would be 11mA which isn't using the LED to it's full potential.
Note: I'm not too concerned about getting the full potential out of an LED. (If I understand correctly, 10mA should work fine to light up an LED.) I just want to know how real engineers handle this problem. Is having a 10mA current acceptable? Can you actually get away with 22mA even though the specs say 20mA? What do you do when you need your LEDs to operate at peak brightness?