Go Down

Topic: Controlling 9 RGB LED's with arduino (Read 1 time) previous topic - next topic

theuglymonkey

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.

MikMo

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.

GoForSmoke

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



I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

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...

KirAsh4


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.

Simpson_Jr

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

http://www.arduino.cc/playground/Main/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.


Grumpy_Mike

Quote
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/

theuglymonkey

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.

Go Up