A dozen buttons and LED's

I’ve done several smaller Arduino projects, but have one that I need to work on that’s larger than I normally do and am having trouble working out the scale and any considerations I need to make because of it.

Here’s what I need to do:

I have 12 arcade buttons and each one has an RGB LED in it. I need to be able to read all the buttons, and change the color of each of the LED’s. I’ll be reading the button states and setting the LED colors through some separate custom software.

Right now I just don’t know where to start, I’ve found info on single LED’s and programmable strips/matrices, but not a bunch of individual ones. Is there different considerations for this? Things I should keep in mind? If my LED’s are wired up fairly far from each other do I need to change resistance or anything? Any help with this would be awesome.

RGB LEDs need 3 control lines for each one. Can’t really multiplex them due to the common anode or cathode.
12 means 36 unique lines. Easy way is to daisy chain 5 shift registers and run an output to each individual leg. Keep the the on/off state in 5 bytes in an array. Wnen you need a color change, update the array and send it out using SPI.transfer:

digitalWrite (ssPin, LOW); // D10 connects to RCLK
for (x=0; x<5; x=x+1){
SPI.transfer (ledArray[x]); D13 to SCK, D11 to Ser In, OE/ to Gnd, SrClr to +5
}
digitalWrite (ssPin, HIGH); // any outputs that change will change on this rising edge

If you have common anode parts, then TPIC6C595 or TPIC6B595 would be good for sinking current. You will need a current limit resistor per LED.
Long wire runs means you may be able to use marginally lower current limit resistors, like an ohm. Negligible.

I offer a board with up to 12 shift registers that is setup just for stuff like this. Contains 328P bootloaded as an Uno and uses SPI to transfer data to the parts (shown here with 6)
http://www.crossroadsfencing.com/BobuinoRev17/

Plug on an FTDI Basic to download your code, remove when done, connect up your resistors and wires out to the LEDs and off you go.

I might consider multiple tlc5940's for the leds, you can skip the resistor... Plus, this what you can fade between the red, green and blue leds of the RGB led instead of being just full off of full on..

For the buttons, shift registers sound fine.

I think as far as the leds being far away from each other, the main problem will be voltage drop... Use heavy guage wires.

20mA per LED - there won’t be much voltage drop. “heavy guage” might be 26, I bet 30 would be fine tho.
Many options for PWM if needed, such as simpler 255-level WS28xx series of parts.
WS2803 with 18 channels (vs 16 on TLC5940) for example.

WS2803-preliminary-En.pdf (437 KB)

nice, and its available in DIP :D

Thanks for the answers. Am i right in assuming that I need 12 inputs for my buttons, and 36 outputs for my LED's? Any reason I couldn't use a Mega?

The limit will be total chip current. Page 356 of the Mega's MCU datasheet. Probably be not enough for 36 LEDs. Leo..

Even the MEGA cannot do PWM (with the analogWrite() function) on 36 pins. Additionally, a specialised LED driver is preferable to individual resistors on the LED pins.

Mega doesn't do pwm on that many pins... And 36 x 20ma = 720 ma....

If you had them all on, ofc

I think your only supposed to draw 200ma from the chip so you'd only be able to have around ten leds on on at a time using the mega...

Right after the question I realized I wasn't taking power draw into consideration... oops.

Anyone happen to know where I can buy WS2803's?

Better yet... this is basically what I'm trying to do, only with the LED's being moved off the board: http://www.seeedstudio.com/depot/rgb-led-shield-v14-kit-p-430.html

Aliexpress gas got them in sop and dip..

http://m.aliexpress.com/item/840202436.html

aintmichael: Better yet... this is basically what I'm trying to do, only with the LED's being moved off the board: http://www.seeedstudio.com/depot/rgb-led-shield-v14-kit-p-430.html

That's what I was recommending at first, but the ws2803s are a lot simpler....

Ofc, tlc's are easier to get... In 3 days from mouser vs 20 days from China...

[/quote]