Multiple Multiplexer for midi controller

I'm building a midi controller with 64 potentiometers on a arduino mega, but it is the first time and never worked with multiplexer (here i have 4x 74Hc4067) but i 'm not shure how to connect them .

Do I have to connect the pins S0 S1 S2 S3 of the different multiplexers on a single cable (respectively per pin) ?

Yes. The S0..S3 can be tied, like all 4 S0s to one output pin, all 4 S1s to another &c.

These 4 address line select 1 of 16 on all four.

The four outputs can be routed to four analog inputs separately. One for each bank.

To get the value of one potentiometer, set the 4 address output pins appropriate and then analogRead() the pin that bank of 16 is on.

You would probably read all four analog inputs, then move on to a new settings on the four address pins if you are trying to get all 64 values into your program for subsequent processing.

The potentiometers are just wired with theirs ands at V+ and Ground, and the wiper to an input on one of the multiplexers.

What value are your potentiometers?

How rapidly are you hoping to be able to read them all?


They have a resistance of 10 K. Ohm.

however as I have an arduino mega with 52 digital pins, isn't it easier if I connect directly the 4*4 addressing pins on the arduino ?

Most example code found here connects all four address pins to four Arduino pins,
but if you find it easier to use 16 Arduino address pins, go for it.


There is only one real a/d convertor on the chip. It multiplexes the pins that can do analog, so we can exploit that for part of the addressing. Two bits worth, that is one of the four chips.

You need code to take a number 0..15 and set 4 address pins to select 1 of 16 mix channels on every external chip.

Then read across 4 A/D inputs.

The code you write is a single thread, just one thing stepping along, so there is no advantage to using 4 pins for each external chip!

The analogy isn't strict, but think of it like the advantage a loop has over writing almost the same line of code multiple times.

and I cannot think of an advantage to being able to set your four chips to four different addresses, unless you were to say

"sometimes I want to be able to look at 4 different A/Ds only, so I want to, say, pick A3, B7, C13 and D14 and read only them over and over"

But I don't think you mean to need to do that, one, and two, so what if you had to change the single address and do a read four times over?

That is the beauty of multiplexing.

I srsly wonder if you could find an example of someone not combining I/O lines in parallel to address external chips.

But do this if you remain unconvinced:

Write the code for one multiplexer reading one of sixteen pots. It can be done variously between naive and expert, makes no difference in the end. Dunno where your coding/borrowing skills are, but this obvsly needs to be done. We can help of course.

Then say, OK, that's good, now I want to do the other 3 chips. :wink:



This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.