noob_for_life:
If I want to calculate the lowest resistor to get the brightest LED, is there a way for me to know the voltage output from the chip? EvilMadScience uses three AAs to power his configuration.
The answer lies in two datasheets and the application
of simple math (ohms law).
From your LED datasheet expect to find a
nominal current of 20mA and a voltage drop
of (say) 1.5V for red, green, or orange LEDs.
There are higher efficiency LEDs, particularly in
Red, so also check the rated lumens output.
Caution; LEDs with frosted or diffused lens
will have much lower numbers for light output,
the clear lens ones are brighter but have very
limited beam angle (i.e. a hot spot).
From the uC (AVR) datasheet (fig 149 and fig 150)
the output voltage is about 500mV at 20mA
We know the supply is 4.5V with fresh batteries,
so the voltage across the resistor is
4.5 - 0.5 - 1.5 = 2.5V
For a 20mA current the resistance required is
2.5/.02 = 125 ohms (120 is the nearest standard value).
This assumes the AVR is outputting DC to light the
LED. Most likely it is, but reading the code or asking
the author is necessary to be sure.
In some circuits the LEDs are pulsed and depending
upon the ratio of on to off time the LEDs will be
dimmer. To restore full brightness the DC current
is upped to compensate. The LED data sheet will
give the max pulse current allowed.
For brighter LEDs drive more current, this simple
idea has two problems. The AVR is only rated to
20mA per IO pin, pushing it further is abusive.
Also, the LED has a max DC current rating and
pushing it further is an abuse.
Most of the time you can get away with it, but
its not good engineering practice and it may
come back to haunt you down the road with dead
circuits.