Drive 12 Leds using a 4:16 decoder? More IO pins basically

Hi all,

I'm trying to control 12 leds, an LCD(7 pins), 5 buttons, 3 switches, and a potentiometer. Will the follow work?

An Arduino Pro (20 io if you use analog as digital for everything but the potentiometer).

Can I use a 4:16 decoder to output power to the leds? All leds might be on at the same time, so can I cycle fast enough to make them all appear on? Would it be better to use a shift register somehow?

The 4:16 would allow me to get all this in 20 pins.

I will draw up whatever you guys help suggest, just not sure what the best way to do this is.

A little guidance is much appreciated! Thanks

4:16 would use 5 pins - 4 to control which LED was selected, and 5th to show the selected LED as hi/lo.
Shift register would be better - only need pins then.
Also possible to use just 2 pins, if you don’t mind a little flicker as it loads up.
No multiplexing needed, just shift new data out when you need it updated.

Or this one from Sparkfun: Analog/Digital MUX Breakout - http://www.sparkfun.com/products/9056 -

Can I use a 4:16 decoder to output power to the leds?

Bad idea. Use a port expander like the MCP23S17 or the MCP23016.

All leds might be on at the same time

Most decoders aren't latched, so you can only have one output selected at a time. Use a shift register with enough power to drive LEDs (like the TPIC6B595) or an IO expender.


Rob