Hi, I'm relatively new here. I'm trying to design/ build a midi controller. My main problem here appears when I realised the number of analogue inputs I need surpasses the number of analogue inputs a regular Arduino board has. Currently, my project is based on at least 12 rotary encoders, 5 linear faders and 16 buttons, which I guess makes out at least 33 analogue inputs. Is there a possibility to build such a controller? Thanks Nick
Is there a possibility to build such a controller?
Yes sure. You increase the number of analogue inputs by putting a multiplexer chip on the front of each input. This funnels a selectable 8 inputs into one analogue input. The input selected is controlled by three select lines, and these can be common to all the multiplexer chips.
A popular one is the 4051, this project shows the use of two of them to give 16 inputs but as I said using more chips gives you more inputs. With a single layer multiplex like this you can get 48 inputs. If this is not enough you can go for a double multiplex layer where the 8 pins of the multiplex are connected to a multiplex chip each this gives you 48 * 8 = 384 analogue inputs
Buttons are digital inputs. That drops the analog requirement to 17. There are digital rotary encoders so now you only need 5 analog inputs and 28 digital inputs. A Mega "has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs," which should do the trick. Or you could use a Nano or Uno and multiplex the digital pins, which I think you'll find easier to do than multiplexing 33 analog signals.
Thank you guys, this have been great answers !!!!! :)
12 rotary encoders, 5 linear faders and 16 buttons, which I guess makes out at least 33 analogue inputs.
I only see 5 analog inputs, all the rest are digital. Rotary encoders need 2 digital inputs: 24 total. Be careful to use PCINT pins if needed, not all Mega pins support that. 16 buttons, these can be any digital inputs, and likely just polled. So 40 digital inputs, 5 analog inputs.
Another quick question, can I use a regular Multiplexer in a Teensy 2.0?? I'm asking this because I don't know which are the S0 S1 S2 S3 pins in the Teensy .. . . . unless this are the B0 B1 B2 B3 pins ( on the GND side)
I'm asking this because I don't know which are the S0 S1 S2 S3 pins in the Teensy
They are any pins you want them to be.
So it means that S0, S1, S2 & S3 can go in the B0, B1, B2 & B3 of the Teensey?
Yes if that is how you want to code them, they can go to any digital output pins, they don't even have to be in that order.