SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By strimbob
#147492
hello

this is my first post here!
i have begin doing ardunio stuff for a year or so, but only just found spark fun!

I am beginning to work on making myself a midi controller using an ardunio mega.
With my design at the moment i am looking at about 70 rgb leds , with 20 Rotary Encoder and 44 push button and 5 Motorized slide pot and 3 Circular LED Bargraphs ( I am going to use the break out board for the circular led)

and now i am thinking about the best multiplexing option for all of that,

so my question is can i simply buy
17 0f the
Analog/Digital MUX Breakout
http://www.sparkfun.com/products/9056
and define different the pins in the code?

and is this the best option for multiplexing 284+ pins?
is there a cheaper/better mux?

thanks a lot
Ben
By n1ist
#147539
I'd approach this differently.

For the LEDs, you can use a driver like the TLC59116; they are I2C, so yoo only need 2 pins to drive them. The only issue is that you will need quite a few (70 * 3 / 16 = 14 of them) or if the form factor works, use a string of smart pixels.

For the buttons, wire them in a matrix like a keyboard; an 8x6 matrix will take 14 pins.

The motorized pots will require 5 ADC channels (or an analog mux, an ADC channel, and 3 select bits), plus two pins each to drive H-bridges for the motors. You could use a digital demux like the 74LS138 if you are OK with having only one move at a time.

The circular bargraph breakouts use a shift register for the ring and can be daisy-chained so 4 or 5 pins will work there. The buttons will take 3 more pins, and the button LEDs can be wired to the remaining outputs on the TLC59116 (you may need to jumper R17-R19 on the bargraph boards as the 59116 has constant current outputs)

That just leaves the rotary encoders; you can always use shift registers there to read them if you don't have enough I/O left

/mike
By Philba
#147559
Pretty good advice

The TLC59116 will need common anode RGB LEDs. I second the idea of RGB strands. There are several that support individual addressable LEDs and work off of a small number of pins - 4 typically. A strand would be much easier to manage for RGB LEDs. This is assuming you want to be able to have a large number of colors.

A bunch of rotary encoders take some skillful code when using shift regs (parallel in/serial out). You'll have to effectively build a polling mechanism which can work but your total shift-in cycle will define the maximum speed you can sample. You'll need 40 bits of shift reg which is 5 8 bit SRs. If the encoders are for manual dials, then it's probably ok. You are most definitely going to need to learn interrupts & timers.
By strimbob
#147583
thank you both for the adivce!
very useful to me, and i was wondering if would it be possible to use the tlc5940 breakout board http://www.sparkfun.com/products/10616 instead for the tlc59166, i am keen to use breakout boards, if possible.
i am right in thinking that i would only in to use 2 pin for all 14 boards?
but it would be better to use 4 pins so the control is a little easier?
i can matrix the buttons no problem

as for the motorised pot i would like to have move at the same time, but like i could go for 4 motorised pots instead of 5, so would 2 for these work Ardumoto - Motor Driver Shield http://www.sparkfun.com/products/9815

i have not looked in to interrupts & timers before but will buff up. -)

the reason why I want to use the bread out boards so much is that, my last big project ended in disaster when i was trying to multiplex about 200 input/output, the problem was with the circuit boards i made, but still cant figure why it do not work.

thanks a lot
Ben