# Arduino, RGB LED, BlinkM MaxM controller

I'm a student from QUT doing interaction design this semester (you've probably heard from a few of us over the past few months). Anyway I just order the 25 diffused RGB Leds if that rings a bell for you.

Now onto my project, Im basically building a 450mm3 white perspex cube that changes colour based on sound. On the inside of the cube I intend to build a smaller 5 sided cube structure from circuit borad and attach 4 RGB leds to each side of the inner cube at the corners to maximise the dispersion. I am using Arduino to attach a microphone to read the audio, and i then intend to connect the RGB leds to the pwm. However from what i have found out from my lecturer Gavin Sade, the leds will draw too much power as there will be 20 all up.

His solution was to use the BlinkM MaxM controller chip and connect my own circuit of 20 RGB leds and power according with something like a 5Volt 2am p power supply. I have little money to spend on this project unfortunately and from the looks of it this would be the cheapest way to go as I have already got my Arduino, RGB leds and microphone ready to go.. just need to work out a circuit to control that many leds.

http://www.littlebirdelectronics.com/products/Triple-Output-LED-RGB-Diffused-25pcs.html that is the rgb leds that im using. Ill be using 20 of them in my cube, utilising each colour it that makes any difference. I need to work out the power supply also to maximise the brightness potential of these lights. Also need to know how to set up correct resistors for this setup.

If you are on a budget you can use discrete NPN transistors or ICs with open collector (or open drain outputs) that can be scraped from old transistor radios, television sets, old printers, and other outdated electronic devices.

Discrete NPN transistors

The maximum emitter current, Ie, must be observed

Small signal transistors, like BC 547B or 2N2222 can be used, but they can only drive one of the RGB LEDs as the emitter current, Ie, will be 60 mA in your circuit and their limit is typically 100 mA. I have shown a transistor driving two in the diagram below.

Power/driver transistors, like BD 135 (1.0 A), with their much higher maximum emitter current can drive many more RGB LEDs, 16 (1.0 A/0.06 A) for BD 135.

I far as I can tell the RGB LEDs you are using are common cathode (where the "arrow" is pointing), hence the diagram above. The operating current is 20 mA and the forward voltage drops at this current are 2.0 V, 3.2 V and 3.2 V for red, green and blue, respectively.

Other values: R4 is in the kiloohm range, e.g. 3.3 kohm. One resistor is used for each internal LED as this makes for more uniform light and also accounts for the difference in forward voltage drop for red and blue/green. Vcca is the supply voltage to the CPU and can be different from the 5 V for LEDs.

Computing the current limiting resistors

For green and blue (R2 and R3): as the current is 20 mA through the diode the same current flows through the resistor. If the voltage drop over the driver (transistor) is assumed to be 0 V then the voltage drop over the resistor is 5 V - 3.2 V = 1.8 V. We now know the current and voltage for the resistor and can use Ohm's low to find the value of the resistor:

$$U = R3 \cdot I \implies R3 = \frac{U}{I} = \frac{1.8\ V}{0.02\ A} = 90\ \Omega$$

For red (R1):

$$R1 = \frac{U}{I} = \frac{5.0\ V - 2.0\ V}{0.02\ A} = \frac{3.0\ V}{0.02\ A} = 150\ \Omega$$

Standard values of resistors (E24, 5%) close to these two values happens to exist (91 ohm and 150 ohm).

ICs with open collector (or open drain outputs)

The principle is the same as for the discrete transistor.

An example is the TTL 7405 (variations: 74LS05, 74HC05). The maximum current can be found in the datasheet, but most likely it can only drive one RGB LED per output. On the other hand it is more compact as there are six inverters in one IC. Some others in the TTL family (some with fewer outputs) are 7401, 74LS03, 7405, 7406, 7409, 74LS12, 74LS15, 7416, 7417, 74LS22, 74LS33, 74LS38, 74LS136, and 74LS266.

I think bus buffer/line drivers, like the 74LS244 (eight outputs) can also be used, but I have to look into it further.

References

1. A good background article is "Driving LEDs with Open Drain Port Expander Outputs".