Controlling 9 RGB LED's with arduino

Hey so I recently built a Gibson SG electric guitar. I put about 9 RGB LED's in the neck and I want to control them individually with the Arduino. Each of them have their own set of wires. How should I approach this? I have a intermediate understanding of C++ so programming shouldn't be to bad I just haven't really programmed with Arduino that much. The picture shows the neck hooked up to a few battery's.

To control the colors of each of the 9 RGB LED's individually is the same as controlling 27 LED's.

Normally this is done using PWM, but Arduino does not have enough PWM pins to do that.
One solution would be to use a PWM driver IC like the TLC5940. (You would need two of thwm).

Here's a link to one place to get it: http://www.sparkfun.com/products/10136.

Find the Wiki on 'charlieplexing'. You could run the matrix with 6 pins and have 3 leds grow space.

Ok so I tried creating a diagram for my project only issue is I realized I am using RGB LED's and they have a common cathode...

theuglymonkey:
Ok so I tried creating a diagram for my project only issue is I realized I am using RGB LED's and they have a common cathode...

Nothing wrong with that ... There are both current source and sink drivers.

Arduino by itself has 6 hardware PWM-pins, but PWM can be done in software as well.

Arduino Playground - PWMallPins shows an example capable of PWM-ing all output pins of the arduino.

Needing at least 27 pins to control the shift-PWM library of Elco Jacobs, http://www.elcojacobs.com/shiftpwm/, also done in software may be interesting as well.

Apparently Elco succeeded to PWM up to 768 leds (256 RGB leds) by software using 96 standard 74*595 shiftregisters. Using so many... there are a few ifs/buts, maximum brightnesscontroll has to be set to 32 instead of 255 like analogWrite() for example, arduino hasn't got the speed to PWM all leds in a finer resolution.

Up to 32 RGB-leds (96 pins/12 shiftregisters) brightness resolution can be 0-255 though and an 74hc595 doesn't have to cost much more as $0.25-0.45.

Find the Wiki on 'charlieplexing'.

You can't charlieplex an RGB LED due to the common connection.

Your best bet is to get a hand full of shift registers and use the shiftPWM library to control the brightness.
http://www.elcojacobs.com/shiftpwm/

Yeah I decided that shift registers are the way to go. However I was able to charlieplex several RGB LED's. The schematic became very messy and not practical.