How to run 25 RGB LEDs by an arduino Duemilanove

arduinoledrgb

I am constructing a 5×5 LED grid that has an RGB LED under a plastic cover, and a piezo sensor that changes the RGB LED to one of 8 colors when pressed.

So as far as I can tell I need 75 outputs for the RGB LEDs, plus 1 more to power everything that can be daisy chained between the 25 RGB LEDs. I will also need another 25 inputs for the piezo sensors and 1 ground that can be daisy chained together.
The Arduino has nowhere near enough I/O pins on it but I have heard of a thing called multiplexing. However, I am not sure if you can run RGB leds with multiplexing.

If this helps at all I am using a led strip that I can cut into 3 LED sections to put under each square.

I hope I was not to vague with my question, thanks for your help.

Best Answer

I can see two ways of achieving this.

1-Using a technique called Charlieplexing to control your leds. With 10 output pins you would be able to control 90 normal leds. The main disadvantage with this technique is that the leds are not always on. They flash really fast, causing a reduction in the brightness of the leds. It's also a bit complicated to code and I'm not 100% certain that you could make it work on RGB leds.

2-Using Shift registers. Like this one. With shift registers you can ouput data in a serial fashion and output it in parallel. Depending on the number of pins you are willing to use, you'll have to buy more or less Shift registers. The main idea is something like: output the new states of the leds, one by one (separating your signals by outputting HIGH to the SRCLK) and then "applying changes" by outputing HIGH to RCLK. If you think about it, you can basically cascade to an infinite number of outputs. You'll need a lot of shift registers though and the response time will probably be slow.