Step 5: Design LED Circuit
The LED circuit consists of three microcontroller switched loops: one for red, one for green, one for blue. Each LED has four different leads: red, green, blue, and ground. Each of the color leads is connected to its respective loop via a current limiting resistor in parallel with the other leads of the same color type. The ground leads are all connected together.
1) Determine how many LED’s will be required. The high brightness RGB LED’s must be spaced approximately 0.5in-0.75in apart on center. Divide the total length of polycarbonate by a number in the range given (10.75 / 0.7 = 15.36). In this case use 16 LED’s.
2) Determine supply voltage, Vs. 5VDC is a good number because the microcontroller can run of 5VDC without requiring a voltage converter.
3) Determine required resistor values. Check the LED’s datasheet for the FORWARD VOLTAGE, Vf and the MAX FORWARD CURRENT, If. The resistor value is determined by the following equation: R = (Vs – Vf) / If
Red -> Vf=2.0V @ If=20mA => R=150Ohm
Green -> Vf=3.2V @ If=20mA => R=90Ohm
Blue -> Vf=3.2V@ If=20mA => R=90Ohm
Note: The resistance calculated is the resistance required to hold the LED at 20mA of forward current. Remember that exceeding the max rated current will significantly decrease the life of the LED. Also, remember that common resistors have a tolerance of 5%. To avoid accidentally exceeding the rated max current, select a common valued resistor value greater than 5% of the calculated minimum resistance. I chose a 100Ohm resistor in place of the 90Ohm resistor and a 180Ohm resistor in place of the 150Ohm resistor.
4) Determine resistor power rating. Resistors have a MAXIMUM ALLOWABLE POWER, Pmax rating. If you exceed this rating the resistor will incur permanent damage and inevitably fail. The maximum power dissipated each resistor is as follows: Pmax = R x If^2
100Ohm @ 20mA => P=40mW
180Ohm @ 20mA => P=72mW
These are both under 1/4W so 1/4W resistors will be adequate.
5) Determine total power dissipated in each loop and total current in the circuit. The sum of the total power will determine the current rating needed for the power supply. Furthermore, the microcontroller can only source 20mA of current per pin; so, a Darlington Driver IC is used to allow the microcontroller outputs to control high current loads. This IC has a max current rating of 500mA per channel. Pmax = #LED’s x [( Vf x If) + (R x If^2)]
P(red) = 16 x [(2V)(20mA) + (180Ohm)(20mA)^2] = 1.792W <------- Pmax
P(green) = 16 x [(3.2V)(20mA) + (100Ohm)(20mA)^2] = 1.664W
P(blue) = 16 x [(3.2V)(20mA) + (100Ohm)(20mA)^2] = 1.664W
Max Current = Pmax/Vs = 1.792W / 5V = 358.4mA
Total Current = [P(red) + P(green) + P(blue)] / 5V = 1.024A
The Max Current in any loop is less than the max rating of the Darlington Driver so it can be used. The Total Current is very close to 1A. Sparkfun’s 5VDC 1A Wall Adapter Power Supply is rated for well over 1A so it will be suitable.