large numbers of digital switches/buttons (and some analogs)

Hi !

I've started recently a project with arduino : to build a USB controller for Ableton Live.

I've already made some tests with a UNO and 3 buttons and made a working structure from Arduino to Max4Live (and then Finally in Ableton) and it works perfectly, I can control and trigger clips and effects (with my 3 buttons).

Now start the part where I'm really newbie (i'm ok with programming, but electronics and wiring is new to me), and my Arduino Starter Kit Manual doesn't cover it :wink: :

I want to add around 60 Digital buttons (so to speak 60 Digitals inputs) and around 20/25 Analog Inputs to my project,

So my question is, which way would be the best/more reliable/ or simpler to do that ?
Should I add another (or even several others) arduino Boards and put them in series as slaves of the main one ?

My goal is to have to deal with only one USB at the end and only one Arduino sketch that would control the whole object.

I like to learn by experimenting by myself, but I would like to be sure, before buying any new device, that this a good idea in this case,

so any advices appreciated :slight_smile:

Should I add another (or even several others) arduino Boards and put them in series as slaves of the main one ?

No, no, no.

so any advices appreciated

Use port expanders like the MCPCP23S17 or the MCPCP23017 for the digital pins.

The use analogue multiplexers for the analogue stuff, an example to this is shown here:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html

Another, rather crazy :-), idea to having many digital inputs is to use an old ps2 keyboard controller, with just a couple of digital pin (1 have to be an external interrupt) you can read almost 100 inputs!

Arduino Playground - PS2Keyboard for connection,library & example.

Cheers, Ale.

you can read almost 100 inputs

But the number of keys you can read when keys are being held down is limited.

YEP! That's true...

Cheers, Ale.

Great !

Thanks for all these informations !

so i need these chips :

and seems to be simple to implement with arduino Boards :
http://playground.arduino.cc/Code/Mcp23s17

which is great for me !

about analog multiplexers, i've looked at your example and a bit around, and found some like the 4051 IC with 8 analog more pins, but the most interesting one would be this expander shield :
http://blueberryde.com/shop/24-channel-analog-expander-shield/#!prettyPhoto

seems interesting, what do you think ?

what do you think ?

Well it is I2C which means it is a bit slow for scanning all the analogue channels you want. I would still use the 4051, you can put one on each analogue input to give you 48 analogue input channels. If you are worried about the three digital pins to drive the addresses then you can take them from one of the digital port expanders.

ok !

so let's go for the IC chip 4051,
seems to be hard to find, is this one ? :

http://www.reichelt.de/ICs-74HC40-SMD/SMD-HC-4051/3/index.html?ACTION=3&GROUPID=2934&ARTICLE=18687&OFFSET=16&SID=13VLfwfH8AAAIAAEp8UXEc8b7983f9b4f2203e2cddc16da0786f4&LANGUAGE=EN

or this one ? (closer to my place) i'm sorry for newbie question but there is lot's of references :

http://www.amazon.fr/4000-DIP16-CD4051BE-TEXAS-INSTRUMENTS/dp/B01185X3YA/ref=sr_1_15?ie=UTF8&qid=1449010995&sr=8-15&keywords=analog+multiplexer

seems to be hard to find,

No they are quite common.

The first is a surface mount one so you might have problems soldering it.

The second one is stupidly expensive and the postage doubles it. These chips should cost no more than €0.70

(closer to my place)

So where is that then?

Hi,

I'm living close to Paris (France), and usually the chip/electronic online shop I check is the french site conrad.fr but it doesn't seem to sell anything referenced as 4051.

maybe in fact the first shop, Reichelt.de, is the solution here, i didn't searched enough yesterday and they seem to have others models of 4051 chips, with "long legs" this time :

https://www.reichelt.de/index.html?&ACTION=446&LA=3

and those one should do the job if i'm not wrong ? :

https://www.reichelt.de/74HC-4051/3/index.html?&ACTION=3&LA=446&ARTICLE=3229&artnr=74HC+4051&SEARCH=4051

and

https://www.reichelt.de/74HCT-4051/3/index.html?&ACTION=3&LA=446&ARTICLE=3393&artnr=74HCT+4051&SEARCH=4051

however they seem really similar, is there a difference between those models ? (I assume they must be different, but their specs are the same)

is there a difference between those models

Yes there is but not one that will trouble you if you are just using it at 5V.

That last link is more like the price.
Have you tried Farnell or RS?

Hi !

just tried farnell and yes there is some too :

http://fr.farnell.com/texas-instruments/cd4051be/ci-logique-serie-4000/dp/1106109

this time they are branded (texas instruments) I don't know if it makes a difference in term of reliability, but they seems to be the right models.

Texas are a very good maker of semiconductors.

Ok great !

so i'm on my way to buy some of those, thanks for all your advices !

I am late to this party...

A question to those helping out....
Why would a multiplexor be preferred over using an external ADC and then reading that ?

dave-in-nj:
I am late to this party...

A question to those helping out....
Why would a multiplexor be preferred over using an external ADC and then reading that ?

Because he said:-

I want to add around 60 Digital buttons (so to speak 60 Digitals inputs) and around 20/25 Analog Inputs to my project,

We are addressing the second part of this.

Grumpy_Mike:
Because he said:-We are addressing the second part of this.

I get the need to bring in a couple dozen analog inputs. but why bring 20 or more inputs to one ADC and force the Arduino to do all the work ?

but why bring 20 or more inputs to one ADC and force the Arduino to do all the work ?

We are not. We are hanging an 8 input to 1 output selector on each ( well sufficient so that's three ) analogue input.

Grumpy_Mike:
We are not. We are hanging an 8 input to 1 output selector on each ( well sufficient so that's three ) analogue input.

The Arduino chip is the .328, that has one ADC with a multiplexer to get the 6 ADC pin when using the DIP version or 8 ADC when using the surface mount version.
it appears to me that you have to read once, discard the noise, read again after it settles, then move to the next channel.
also, if you set 4051 chip 1 to the analog pins, you would want to toggle the 4051, go off and read the digital pins to allow the analog circuit to settle. then read once, discard, read a second time and use the data.
then toggle for the second 4051, go off and read the digital pins.....

most ADC chips have only one ADC and an onboard MUX
even an LTC2497 with 16 channel, single ended, it is one core ADC and on-board MUX.

I think the proposed 4051 is fine and am not offering that there is a better way. I am asking because I have 32 temperature sensors, that I will be hanging off some chip to read.... trying to get an idea why the pros chose one way over another.

f you set 4051 chip 1 to the analog pins, you would want to toggle the 4051, go off and read the digital pins to allow the analog circuit to settle. then read once, discard, read a second time and use the data.

Absolutely no need for double reading if the input impedance is 10K or lower. Also a double read is not the only way, you can switch the analogue multiplexer separately ahead of the read function to allow voltages to settle if the input impedance is too high.

Not sure what you are getting at but just feeding one 4051 into one analogue input minimizes the number of multiplexers the signal has to go through. Just using one analogue input and cascading 4051's into that results in one more multiplexer in the signal path.

trying to get an idea why the pros chose one way over another.

What is the other way?