Mux Shield

Replacement:DEV-11723. This shield has been replaced by the Mux Shield II. This page is for reference only.

If you need a lot of inputs and/or outputs, this is your solution! The Mux (Multiplexer) Shield adds the capacity for up to 48 inputs or outputs on the Arduino and Arduino Mega. Using three Texas Instruments CD74HC4067 Analog Multiplexers, the Mux Shield makes it possible to have 48 analog/digital inputs or digital outputs in many configurations.

The Mux Shield comes with stackable headers installed and ready to plug into your Arduino!

Note: Apparently the stackable headers don't quite "stack up" enough to isolate the USB port from the bottom of this shield if you're using it with an Uno or similar board. We suggest putting some tape on top of the USB port or adding another set of stackable headers to protect against a short.

**Features:
**

  • 48 analog inputs/digital inputs
  • Vcc and Ground header strips (each input/output pin has a dedicated Vcc and Ground)
  • Reset button
  • PIN 13 LED and Power LED
  • Stackable headers (plug directly into Arduino and add more shields on top)
  • Arduino Mega compatible
  • Requires digital pins 2,3,4,5 and analog pins 0,1,2 – 48 inputs/outputs for the price of 7 pins!

**Documents:
**

Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • MarkMayhew / about 14 years ago / 3

    Here is a schematic for the shield:
    http://mayhewlabs.com/media/Mux_Shield_Schematic.pdf

    • esklar81 / about 14 years ago / 1

      Mark,
      THANX for providing the schematic!
      As you can see from my posts above, I'm interested in providing more current through the "5V" and "GND" connectors (to such loads as servos) than the Arduino's regulator can provide. I'd appreciate your help with the following:
      1) What are the ampacities of the 5V and GND traces and connectors on the Mux Shield?
      2) Can I sever the connections between the rows of 5V and GND connectors and (the connections between the Arduino and the Vcc and Gnd terminals of the mux chips)? (My thinking is: I could run the mux chips (& the reset button & on-board LEDs) from the Arduino's regulator, but use some other power source for the rows of voltage and ground connectors that run alongside the mux terminals. I would need to feed the rows of connectors from that external power source, tying the grounds of the two supplies together to ensure a common reference.)
      3) If I can provide a separate power supply to those rows of connectors, can I do that at a higher voltage than 5V? (I'm not looking to get anywhere near line voltage, but I can foresee uses for things in the range of 6V to 24V.)
      4) If I can't reasonably sever the connections to those rows of connectors, can I feed +5V and Gnd (from a higher current source than the Arduino's on-board regulator) to the Arduino through the Mux Shield?
      TIA,
      Eric

      • MarkMayhew / about 14 years ago / 3

        Eric -
        The easy answer is that the Mux Shield probably isn't what you need. The way it is routed and the ICs themselves are not meant for high current draw or independent voltage lines. There are some servo shield designs out there, like one from Adafruit. There are also multiplexer ICs that are meant to run high intensity LEDs or servos that you might think about.
        Let me know if you still can't find what you're looking for and I'll come up with a new shield for you.

        • Midknight5000 / about 13 years ago / 1

          Hi, I recently bought your blue rotary encoder led ring and I'm having trouble programming it to light up the leds without an input. Do you have any code that can do that?

  • Eric Falsken / about 13 years ago / 2

    There are a lot of people asking questions about this board. Just thought I'd answer a few of them. The build quality here is superb. The wiring does allow you to write individual pins high/low or read analog/digital values from any pin. It uses the analog pins to write/read (1 pin for each muxer chip) and the digital pins to determine which chip you wish to write/read to/from. You cannot operate on 2 different pins on 2 different muxers at the same time. But you can operate on only one pin on one muxer at a time. Unfortunately, the muxer chips have no "latch". So once you change the operating pins, the value goes back low (for outputs). This shield is great example of expanding your gpio ports, but to be truly useful, we'd probably need a register or something on the other side of the muxers. That said, you could easily connect 6 shift registers with the available pins.

  • TheKnack / about 14 years ago / 2

    That's pretty sweet!

  • Member #413371 / about 12 years ago / 1

    Hi, is it possible to use multiple Mux shields in parallel, to allow you to access 192 inputs and outputs?

    Thanks! --Buz

  • JBeougher / about 12 years ago / 1

    How would I get this rotary encoder https://www.sparkfun.com/products/9117?

    to work with this shield? I am trying to have 4 rotary encoder working with a few buttons.

    Thank you,

  • Member #401391 / about 12 years ago / 1

    Similar to esklar below, hoping to direct this to MarkMayhew but anyone who is willing to help me out I'd appreciate the advice. As Mark stated, the mux shield itself isn't suitable to drive servos, but if I run it through Adafruit's PWM driver on its own power supply, it should work and allow me to use multiple switches muxed to the Arduino, correct?

  • Brian Parkinson / about 12 years ago / 1

    I'm playing with this board, using Mark Mayhew's examples.

    When running as inputs, it's all good. But when I try to run the digital output example I get no voltage change on the output pins.

    Has anyone experienced this? I'm using the latest 103 version of the IDE and tested with a Duemalouve as well as BlackWidow. No joy.

    So far stumped - any hints/advice appreciated.

    Thx,

    brian...

  • Member #124910 / about 12 years ago / 1

    I'm at a loss as to how you use this for both analog input and digital output at the same time. Do I use the individual 4067's separately in a sense? Can I have inputs and outputs on one individual 4067 at the same time? Code snippets would be helpful.

    Thanks,FTM

  • Toasty / about 12 years ago / 1

    I know this can be used as analog or digital but can you use it as both? I am working on a project right now where I need more digital and analog input/outputs. If so that would make it easier compared to my other options right now.

  • Member #340818 / about 12 years ago / 1

    Hi! I have a project in which I need very many pins. Would this shield work with Arduino Leonardo? If yes, could it be stacked to it, or would I have to wire it another way? Thank you.

    • JBeougher / about 12 years ago / 1

      I have the Duemilanove and copied the script in to run the MUX digital input. This works fine but the Leonardo does not. I'm not seeing any input from a single push button. I'm not sure why.

    • The Leonardo has the same basic footprint as the Uno, so the Mux shield should be compatible with the Leonardo.

  • Member #216427 / about 13 years ago / 1

    Is there a way to successfully send analogWrite PWM brightness pulses to 48 LEDs? When I try analogWrite instead of digitalWrite in the example digital out code, I (not surprisingly) get binary results, with the LEDs being fully on when the value is 128 or above and off when the value is 127 or below.

    What is a good way to control the brightnesses of multiplexed LEDs?

    Thanks!

    • MikeGrusin / about 13 years ago / 1

      If you're interested in learning -how- it's done, it may be possible using this mux, but it might not be easy (google for PWM libraries; the ones I've seen are set up for shift registers, but there may be something for this layout).

      If you're just looking for practical ways to drive 48 RGB LEDs, I'd suggest looking at hardware that's more specifically designed to do that. There's a lot out there; here at SFE we have some driver chips, such as the 16-channel TLC5940, and the 64-channel (in a matrix of 8x8) MAX7219. (Keep in mind that you'll need three channels for every RGB LED). We also carry addressable LEDs in several form factors, which is an almost off-the-shelf way to do this. Good luck with your project!

  • Member #209792 / about 13 years ago * / 1

    Hi there! Can I use a Mux Shield to extend the 6 digital capacitive sensors? See http://arduino.cc/playground/Code/CapacitiveSensor

    Below is the code I would need to modify:

    DDRB &= pin; // input PORTB |= pin; // pullup on for(i = 0; i < 16; i++) if( (PINB & pin) ) break; ...

  • JacoboConde / about 13 years ago * / 1

    Can I use 2 Mux Shield in the same Arduino UNO?

    I am starting a sensor network using 16 temperature sensors, 16 red LEDs and 16 blue LEDs.

    I need one LED stay always ON (RED LED if the temperature is HIGH, until the state of the sensor change and turn ON the other LED(BLUE LED if the themperature is LOW).

    I want to know if this Mux Shield can do somethig like this code writed in Arduino. (Not exactly as above but some kind like this):

    void loop() {

    int Value1 = digitalRead(Xport); //this is just for 1 sensor,

    {

    Serial.println(Value1); 
                                //this turns ON the red LED,if the  
                               //the temperature is HIGH
      if (Value1 == 1)         //and keep it HIGH until the sensor
                               //value change to 0 and turn off 
                               //this led and turn on the BLUE LED.
      digitalWrite(ledPinx, HIGH);
      else 
      digitalWrite(ledPinx, LOW);
    
      if (Value1 == 0) 
      digitalWrite(ledPinx, HIGH);
      else 
      digitalWrite(ledPinx, LOW);
    
      delay(300000);  // 5 minutes
    

    }

  • yadoo86 / about 13 years ago / 1

    I found also a video project for this shield: http://www.whatisarduino.org/bin/Hardware/Mux+Shield

  • Member #243204 / about 13 years ago / 1

    Does this shield have any compatibility issues with Firmata? In other words, am I still able to read all 48 inputs into an external platform (i.e. Max/MSP, PureData, Isadora, etc.)?

    Thanks in advance!

  • Eric Falsken / about 13 years ago / 1

    I just posted code to use this shield with the Netduino. http://forums.netduino.com/index.php?/topic/2975-mayhew-labs-muxshield-and-ti-74hc4067/

  • colorfinger / about 13 years ago / 1

    Does the Mux Shield fit the Arduino Uno?

  • misael_cadiz / about 13 years ago / 1

    I would love to buy this shield!! Any idea about when will be available again?

    • MarkMayhew / about 13 years ago / 2

      Mayhew Labs will be shipping more Mux Shields to Sparkfun early next week (Aug 22). Check back late next week or early the following week (Aug 29).

    • We aren't quite sure. They are backordered from the manufacturer. Sorry, wish I had more to tell you!

  • Member #241291 / about 13 years ago / 1

    Hi, Im very new to this type of code. How am i able to set a single pin on the mux shield to HIGH or LOW? Thanks

  • Elda / about 14 years ago / 1

    Hi guys,
    i'm really new to embedded electronics so I appologize for my newbish questions. I'm planning to use 3 mux shields with a teensy board and I have some questions to that board.
    1. As i'm planning to use multiple boards on one teensy and each board will have its dedicated tasks ( 2 for digital in - 1 for analog in), do i have to make major changings to the example codes above?
    2. My biggest concern is the latency. Does anybody have some expirience on how fast these boards/the code really is?
    TIA
    Elda

    • MarkMayhew / about 14 years ago * / 1

      Elda -
      1. To use multiple Mux Shields, you can use the same Control lines to all three shields, but will need to use separate input lines for them (so 4 control lines, 9 input lines total). Since you are using two for digital input, you can run the outputs of these Mux Shields to digital in's on your microcontroller, while the analog Mux Shield will need to run to analog in's. The example code will need to have the input arrays and for loops (where the inputs are gathered) tripled. No major changes - just copy-paste, and rename!
      2. The latency is extremely small, and by this I mean that if I have a switch connected to an input, I am not able to tap the switch fast enough that the Arduino will not catch it. Of course, the latency depends on how much you have going on in your main() loop, but usually the limiting speed factor are things like serial communications. There are options like interrupts and timers that can reduce the latency to almost zero, regardless of what your main() is doing.
      Hope this helps!
      Mark

  • luisksu / about 14 years ago / 1

    It makes sense, and I will take this way and look what happen. Thank you for your advice.

  • luisksu / about 14 years ago / 1

    I am working with the Arduino Duemilanove ATMEGA 328, and I need to multiplex 96 temperature sensors. I am using 16 Arduino units and 6 temperature sensors are connected to each one. In this way I am covering the 96 sensors (16 x 6). So I want to connect the 16 Arduino to the multiplexer and have one unique output.
    My consult is if the Mux Shield (sku: DEV-09832) work fine with the Arduino Duemilanove ATMEGA 328 into the details describe above. Thanks

    • SweetJustice / about 14 years ago / 1

      Could you please provide a link to the temperature sensors you're using? I have loose requirements, but haven't found a cheap sensor yet.

    • MarkMayhew / about 14 years ago / 1

      luisksu -
      I would use two Mux Shields and two Arduinos. You can plug 48 temp sensors into each Mux Shield and pipe the data from one Arduino to the other via serial. Then you will have data for all 96 sensors available on one Arduino. Let me know if this doesn't make sense!

  • czarvargo / about 14 years ago / 1

    I am pleased as punch that this shield exists, and doubly pleased by the red cardboard box on my desk containing it. The pins are a bit too short so the first 4 or 5 of the inputs all contact the USB housing. It needs longer pins. To compare it to the ethernet shield, the length of the pins on the mux shield are about as long unmated, as the exposed section of a fully mated ethernet shield. This is true on my Duemilnova and my Uno. As suggested I am going to pick up a Arduino Stackable Header Kit.

  • IanM / about 14 years ago / 1

    Built-in latching would be super-nice. I'd happily give up one more digital I/O pin if I could "set and forget" the 0/1 state of any of those 48 outputs.

  • Member #182336 / about 14 years ago / 1

    It is a very good idea of developing this shield. Is it by chance that we could have access to the code of the MP3-Handrail described in the video?
    Thank you in advance,
    Cheers

    • MarkMayhew / about 14 years ago / 1

      Member182336 -
      Chris Rojas posted the source code for Arduino and Processing on his site:
      http://www.projectallusion.com/1/post/2010/7/musical-handrail-using-the-mux-shield.html

  • graynomad / about 14 years ago / 1

    This looks like a nice board, but I don't get how you can have 48 outputs without any latches?
    Surely you can only have 16 stable OPs at any one time and if you do anything with the other 32 you lose thier state.


    Rob

    • IanM / about 14 years ago / 2

      This is achieved without latching by changing the INPUT/OUTPUT state of the pin controlling each of the three MUX chips. The example code illustrates this pretty nicely.

      • Member #25595 / about 13 years ago / 1

        I don't get it either. If you select one of the mux chips, and select one of the pins on that mux by changing the control pins, then write a '1' to that pin, then you change the control pins on that mux to a select different pin, what happens to the state of the previous pin? It the '1' latched or not?
        -Mark

        • From what I understand so far - you loose those; no latch. Goes back to 0. IMHO terrible design but there isn't anything like this out there so this is still a great product

  • MarkMayhew / about 14 years ago / 1

    dgarcia42: I have another shield that is currently using digital pins 2, 3, and 4 - how difficult would it be to make this shield use pins 5,6,7 and 8 instead of 2,3,4 and 5?
    It shouldn't be too hard. It might be possible that you can use pins 2-5 for both shields in an ingenuous way since the Mux Shield only uses these pins for control lines during an analog read (if your not in the middle of an analog read, it makes no difference how the lines are used or what data is on them). But, if you want to remove the conflict in hardware, here is how:
    Cut the stackable header leads on the Mux Shield pins 2-5 so they don't connect to the Arduino. Run jumpers from pins 5-8 on the Mux Shield to pins 2-5 on the Mux Shield. Change the example code to the following:

    define CONTROL0 8

    define CONTROL1 7

    define CONTROL2 6

    define CONTROL3 5

    This way you are isolating the Mux Shield from the Arduino and still getting the Mux Shield the data it needs.

  • dgarcia42 / about 14 years ago / 1

    I have another shield that is currently using digital pins 2, 3, and 4 - how difficult would it be to make this shield use pins 5,6,7 and 8 instead of 2,3,4 and 5?

  • Mubo / about 14 years ago / 1

    can you split them up and use this for analog & digital at the same time?

    • MarkMayhew / about 14 years ago / 2

      Mubo - you can use this as both analog and digital input at the same time. I would start with the analog input example code. If you hook up a switch, you'll simply get a 0 value when off and 1023 when pressed. You can use the map() function to make this into 0 and 1.
      int val = analogRead(0);
      val = map(val, 0, 1023, 0, 1);

  • esklar81 / about 14 years ago / 1

    Am I correct in inferring that, although there are 48 I/O ports, there are only 16 I/O port selections, so that you have to select ports as triads? For example, you can select ports 1, 17 and 33 simultaneously, but not any one of them without selecting the other two and none of them in combination with other ports. (I do realize that just because I've selected a port doesn't mean I have to read from or write to it.)
    Also, how much current and what voltages can it handle? There are numerous "Vcc" ports, but I haven't found where it's specified to what they're connected. If it's the regulated 5 V from the Arduino, that'll limit the available current/port substantially. OTOH, if it's the Arduino's Vin, then it's not likely to be a very stable source. Furthermore, it appears it would be useful, for at least some applications (controlling servos, for example), to be able to provide power to the "Vcc" rails around, rather than through, the Arduino.
    I'm thinking about the suitability of the Mux Shield to drive large numbers of servos. However, I have yet to do the math to determine how many servo control pulses I can fit in the time between pulses to a single servo.
    TIA for you thoughts,
    Eric

    • N8B / about 14 years ago / 1

      You can indeed select ports 1, 17, and 33 simultaneously. You can also select only a single channel on only one mux, you don't need to select a channel on all three to operate the mux.
      Vcc can handle 2V to 6V because the the IC is the HC not the HCT version. Looks like Icc should exceed 50mA. I can't tell, but it looks like the muxes are getting power from the Arduino regulator.
      You won't be able to plug the servo directly into the mux channels unless the servos are very, very, very small (I've never seen servos as small as you would need them).

      • esklar81 / about 14 years ago / 1

        N8B,
        How does one select only one of the 48 ports? I took a look at the example code and found:
        //Since all 3 multiplexers have the same control pins, the one multiplexer data line we want to
        //talk to should be set to output and the other two multiplexer lines should be be 'bypassed' by
        //setting the pins to input
        That doesn't appear to support the notion of selecting only one port, just the notion of selecting three ports, but writing to only one of them.
        Also, what do you perceive as limitting the size of the servos? AFAIK, the control signal current required by a servo is on the order of 1 mA and essentially independent of the servo's size. The drive power comes from the +V and Gnd wires, so it's not connected to the Arduino's DO. However, the drive power must come from somewhere, which is why I originally asked about the source of "Vcc" supplied to the rows of terminals adjacent to the mux I/O terminals and whether it could be fed other than through the Arduino. (I don't particularly care, in this discussion, about the power going to the muxes themselves.)
        As the schematic doesn't appear to be readily available, what's the best way to determine the power routing on that board prior to obtaining one?
        TIA,
        Eric

        • Although we do not have the schematic (the manufacturer hasn't supplied one), but we have the datasheet posted for the IC's which will give you all the information you should need.

  • tehjrow / about 14 years ago / 1

    Will this fit on top of an ethernet shield? Most don't since the cat5 jack is so large.

    • sburlappp / about 14 years ago / 1

      tehjrow: Will this fit on top of an ethernet shield? Most don't since the cat5 jack is so large.
      Just get the Arduino Stackable Header Kit and use them as spacers between one shield and the next.

      • That's actually a great idea, thanks for pointing that out!

        • RocketScience / about 13 years ago / 1

          It actually didn't fit the ATMega 2560 well either (even though it alleges to). Even with e-tape over the USB connector it would never sit level.
          A set of extended ("stackable") headers solved that issue too.
          If you're wanting to put it on a Mega - get the headers! (the board really should ship with 'em, imho, but [shrug])

        • jeffmcc / about 14 years ago / 1

          you can get the double wide shield from liquidware...

Customer Reviews

No reviews yet.