arduino and multiplexer

Hi,

I’ve just got a Arduino duemilanove and I’m trying to play with 4 multi coloured LEDs. For some reason pins 0 and 1, the rx and tx ones? don’t like the LEDs they just flash and pin 13 is quite uncooperative with fading them. So I’m limited to three LEDs (9 pins, 2 - 12). So I’m guessing I need to get a multiplexer. My local store where I got the duemilnove from has these ones:

4051, 4052, 4053, 74HC157, 74LS138, 74LS139, 74LS151, 74LS153, 74LS155, 74LS157

jaycar.com.au

the search form isn’t $_post[‘get’] so if those names are confusing you can go to the site and search for ‘multiplex’ and those results come up.

i am wondering which one, if none, to buy since i was reading this article: makingthingsmove.org/blog/?p=248

which says the 4051 can’t deal with brightness? just on-off…

thanks

You don’t need an external multiplexer to handle multiple LEDs.

You can do the multiplexing yourself. Given 9 IO pins to work with, you can run at least 6 RGB LEDs.

I’m assuming a common anode setup here; you can invert the logic and connection description if you have common cathode LEDs.

The secret is to connect all the R cathodes together, and all the G cathodes together, and all the B cathodes together. Since the LEDs have different forward voltages, you will connect your current limiting resistors to these cathodes and then to an IO pin.

Then connect one IO line to the (common) anode pin of each LED.

So to turn on any combination of the colors in a single LED, you set the anode line HIGH and the corresponding cathode lines LOW.

Repeat for each LED, turning each anode HIGH in sequence.