I have an Ardunio controlling two CD74HC4051 muxes. The com terminals of both are connected, so I'm basically using the first mux to select a input, and passing the input to the next which selects the output. (I believe this is called demuxing?)

I am using an OSEPP Mega (Ardunio off brand) to provide the power, with the ports 53,52,51,50,49,48 connected to S2,S1,S0 (of the first mux) and S2,S1,S0(of the second mux) respectively.

I am having problems with it not sending signals through, or sending them through when it isn't supposed to. I am wondering if I am making any simple mistakes?

Here is a photo of the setup: enter image description here

Here is my code:

void setup() {
  pinMode(53, OUTPUT);// 1S2
  pinMode(52, OUTPUT);// 1S1
  pinMode(51, OUTPUT);// 1S0
  pinMode(50, OUTPUT);// 2S2
  pinMode(49, OUTPUT);// 2S1
  pinMode(48, OUTPUT);// 2S0

void loop() {
  • \$\begingroup\$ Some things that can help improve our answers: Is the input analog or digital? How fast is it changing (what frequencies)? How are you producing the input? What instrument are you using to measure the output? \$\endgroup\$
    – The Photon
    Jan 31, 2012 at 16:56

2 Answers 2


From a quick glance at the picture it looks like you don't have anything attached to Vee (or enable) You must have Vcc, Vee and GND connected. Enable needs to be pulled to ground.

If your input signal is bipolar (swings positive and negative) you need to connect Vee to a negative supply that is greater than the maximum negative swing of your signal (e.g. if signal is +/- 4V then Vcc = +5V and Vee = -5V)
If it's not bipolar then just connect Vee to 0V (GND)

  • \$\begingroup\$ You were exactly right, everything is working as it should now. Thanks a lot, for this question and others you have answered for me before it! \$\endgroup\$ Feb 1, 2012 at 4:04

A key point: If you don't connect then input pins of the muxes to something, they will be "floating". This means the voltage could be high, low, or anywhere in between. In principle, the voltage could even float below ground or above Vcc. This also applies to the A0 - A7 in/out pins when they are not connected to some source (either a driven input or through the mux itself to an input).

First, in your diagram, I don't see any connection to the enable pins of your mux chips, and I don't see anything in the datasheet that guarantees they will be in the enabled state if the pin is left unconnected. If there's no pull-up or pull-down on the enable signal you can't be sure if the muxes will be in the enabled or disabled state. They can even randomly switch between the two states.

Try connecting the E-bar pins explicitly to ground.

You also want to have a pull-up or pull-down resistor on either the COM net or on the unused inputs. Otherwise when you select an input that is disconnected, you could get any value at the output. Through capacitive coupling you could actually see the (changing) value from the powered input even though you selected a different input.

Finally, you also need a pull-up or pull-down on the output. Without this, when you select a different output, the output you have hooked up to measure will be floating and can take any value. The output pull-up/downs should probably be fairly weak, for example 50-100 kOhms or higher. If the input pull-up/downs don't pull the same direction as the output ones, they should be much weaker, say 1-2 kOhms, to ensure they can override the output pull-up/downs.

  • \$\begingroup\$ I connected the E bar pins to the ground, now it haphazardly responds correctly, but not constantly. Explain a little on the pull up to enable? I assumed that writing low to it meant it was enabled. \$\endgroup\$ Jan 31, 2012 at 5:41
  • \$\begingroup\$ Pull up would make it consistently disabled. \$\endgroup\$
    – The Photon
    Jan 31, 2012 at 5:45
  • \$\begingroup\$ Don't I want it consistently enabled? \$\endgroup\$ Jan 31, 2012 at 5:52
  • \$\begingroup\$ Most likely; that's why I suggested connecting to ground instead of Vcc. \$\endgroup\$
    – The Photon
    Jan 31, 2012 at 5:55
  • \$\begingroup\$ Just re-worked the answer significantly. Sorry for the haphazard way I've edited this. \$\endgroup\$
    – The Photon
    Jan 31, 2012 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.