Go Down

Topic: Multiplexer (Mux) Shield (Read 6 times) previous topic - next topic


My intended project is a midi controller, hddj sytle with a couple of hdds, possibly trying to add motors to them to make them behave like a real turntable, a load of rotary encoders, faders, buttons etc.  


One concept I hope to try is controlling a bunch of LCD modules.  It always bugged me that the arduino could only handle 1 or 2 LCD modules or i2c would have to be used, requiring more chips and a major speed bump.  Maybe the Mux Shield will offer a good solution here too...

The way I have done that is to use new soft serial to make a lot more serial ports, then use serial displays. Then you can have as many LCDs are there are pins.



looks like something I was working on :)
32 a/d inputs and linkable to have i believe a max of 256 inputs :)

problem I'm running into is Pots always have a value and it is hard to switch between sessions without messing your preset values up. so I came up with a better solution using rotary encoders and I2c



I'm going to use encoders for that reason :)  analog Pots are ok for certain things if they are hard coded and values remembered/saved or limitations accepted/worked around :)  

With the pots You could read the value from your device into the arduino and then ignore any values read from the pot until you've matched its position to the value in your device.  Use a switch/software to set/toggle the pot into 'match' mode or switch into 'match' mode and make it start sending midi data automatically once its matched the value.

Mark Mayhem

For anyone who is interested in purchasing one of these shields, here is the website where you may do so:


I tend to forget to check my messages on the forum, so if you have questions, please use the form on my site or the email found on the site.



Is it possible to use two of this shields at the same time, if I need even more analog inputs?


I have received this shield, it is nicely designed in that the pins which are used do not interfere with the pins commonly used for LCD and serial. it seems perfectly well made with nice solder masking.

Delivery was very prompt!

I particularly like that the reset button and power LED have been brought up as well.

One problem I had is that the solder pins of some of the headers (MUX0, 0-3 and accompanying VCC) touch the USB housing on a duemilanove. i fixed it by filing the pins a bit so they are not pointy. it is still really close but they are not touching any more.

I am going to use it with 4 of the encoder sets from SURE electronics (which are debounced and made more easy to read with pics) for 16 inputs + buttons for a MIDI controller/sequencer.

Thanks for a great product!

Mark Mayhem

Glad it has worked well for you DeFex!  

Concerning the headers and USB housing:  I have put a small piece of clear tape over the top of my USB jack.  It's usually not a problem unless the shield gets pushed down all the way.  Maybe in the next revision of the board, I'll find a true solution.

Be sure to let us know how your project turns out!


Hi there mates 8-)

I hope some of you can help me. Im trying to make an arduino drum set and since this is the only reason i bought one i have no experience with it.

Basically i just need around 16 analog inputs so i can connect piezos on them. I found the SparkFun 16-Channel Analog/Digital Mulitplexer CD74HC4067.
Yours seems better but its overkill for my needs:P.

So would this one do the job perfectly or do i need your shield?

Thanks and sorry if its off topic. Cheers


Mar 07, 2010, 11:43 pm Last Edit: Mar 07, 2010, 11:50 pm by DeFex Reason: 1

My main loop was already had a counter to only read 1 analog read per cycle, so it was easy to make a function using the example code. and it works exactly the same as before,

The other ports will be for buttons, and possibly encoders, if the loop is fast enough to read encoder pulses.

Code: [Select]

void stepMUX(int i){
   digitalWrite(CONTROL0, (i&15)>>3);
   digitalWrite(CONTROL1, (i&7)>>2);  
   digitalWrite(CONTROL2, (i&3)>>1);  
   digitalWrite(CONTROL3, (i&1));    

void loop() {

 // ARC analog read counter. only one analog read per loop
 ARC ++;
 if (ARC > 15) {
   ARC = 0;
 }  //number of analog controllers
    //cases are out of order because thats the order of the pots on the board.

 case 3:
   tread = analogRead(0);
   tread = map(tread, 0 ,1023, 0, 32);
   attack = exptable[tread];
 case 2:
   tread = analogRead (0);
   tread = map(tread, 0 ,1023, 1, 32);
   decay = exptable[tread];    
   case 1:
   sustain = analogRead(0);
   sustain = map(sustain, 0, 1023, 0, 1023);
  case 0:
   tread = analogRead(0);
   tread = map(tread, 0, 1023, 1, 40);
   release = exptable[tread];
    case 4:
   tread = analogRead(0);
   syncsubval = map(tread, 0, 1023, 0, 4);    
    case 5:

//rest of main loop


Thanks again, i really like it.


Mar 08, 2010, 12:01 am Last Edit: Mar 08, 2010, 12:06 am by DeFex Reason: 1
Rimidalv you could probably do that just as well as you would with the analog ins, the switching of the MUX takes very little time compared to the time it takes to do an analogread. the only thing that concerns me would be that (even without the MUx) reading analog inputs one by one, it might be possible that a hit could happen entirely between reads.

you would need an op amp and carefully selected resistor/capacitor filter on each the peizos (well you probably need an opamp anyways)

you could use the other inputs for some controls or for your drums, like sensitivity, CCvalues and what MIDI note they play on(if its MIDI) if its generating its own sound you could control the pitch and decay of each drum.


Mine Just arrived!

Cheers Mark, It saved me a load of hassle.

How Can I use it to switch individual Digital Pins On or Off?

Thanks in Advance!!


Just a note, because the information can be a bit hard to find. when using analog pins as digital input on the mega, they are pin 53,54,and 55 for MUX 0,1,and 2

Mark Mayhem

Jul 23, 2010, 07:53 pm Last Edit: Jul 24, 2010, 04:16 pm by markgtr813 Reason: 1
I thought I should update this thread with some news about the Mux Shield!

First off, I redesigned the header layout and added ground pads - small improvements.  Here is a new photo of what it looks like (courtesy of SparkFun):

The shield is now also available for sale at SparkFun:

As always, you can still get them direct from me too: http://mayhewlabs.com/arduino-mux-shield

SparkFun made a video of how they are using the Mux Shield for a musical staircase:


Thanks, and let me know what project you are using the Mux Shield for!


Jul 23, 2010, 08:20 pm Last Edit: Jul 23, 2010, 08:22 pm by retrolefty Reason: 1
MM, looks like a nice design. The only suggestion I would make is around your pin choice for controlling the board:

"Requires digital pins 2,3,4,5 and analog pins 0,1,2 - 48 inputs/outputs for the price of 7 pins"

Pins 2 and 3 are the optional two user interrupt pins on the standard 168/328 Arduino boards and would prevent the use of user interrupts while you board is functioning? Interrupt functions can be so very useful for some projects its unfortunate to not have access to them when using your shield when your shield does not actual utilize interrupts?

PS: The SparkFun link seems to be broke?


Go Up