Resistor Value?

The tutorial for the 74HC595 (http://www.arduino.cc/en/Tutorial/ShiftOut) says that a 220 ohm resistor is needed to regulate the current supplied the LEDs. Is this true for all cases? Suppose I had an led with the following specifications:

RED: Typical: 2 V Max: 2.4V GREEN: Typical: 3.4 V Max: 3.8V BLUE: Typical: 3.4 V Max: 3.8V

DC Forward Current:20mA

Is this how you calculate the resistor value?

Green and Blue R = (VS - VL) / I R = (5 - 3.8) / .02 R >= 60 ohms

Red R = (5 - 2.4) / .02 R >= 130 ohms

This is done assuming 5vs is supplied to the chip.

Better use the typical forward voltage values. If you use the max. ones, you end up with smaller resistors. These then may be too small for LEDs that just exhibit the 'typical' forward voltage. Even better, get yourself a good multimeter with diode tester and measure the actual forward voltage yourself. Make sure the range of the multimeter is high enough to work with blue LEDs properly as well (3V may not be good enough for all of them).

Well im worried that the leds will not be bright enough so I want to run them near the top of their levels. If i chose 80 ohms for the blue and green and 150 ohms for the red will that still be cutting it to close? (idk if they make resistors in that value but i would choose the nearest one thats higher).

Well, the only conclusive method is to actually measure the current.

The problem with LEDs is that e.g. 10% less resistance will not mean 10% more current. It could be 50% more current and likely kill the LED and the shift registers. Also its resistance changes with temperature in a malignant way.

If you’re worried about max. brightness, use a potentiometer and a multimeter to determine the necessary resistance at I(max) for the LED you use. Then try to match that resistance with normal resistors (or combinations). If you can’t get a perfect match, choose the closest one, but starting from higher values (safe side).

5V-----------+
|


----

o-------+
|
\ / LED

|
|
O AMP meter
O
|
|
GND-----------+

This circuit will do a good job for normal LEDs, but don’t use it for luxeon stars or similar.