Electronic – arduino – Why don’t these multiplexers work

arduinomultiplexer

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() {
  Serial.begin(9600);
  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() {
  digitalWrite(53,LOW);//1s2
  digitalWrite(52,LOW);//1s1
  digitalWrite(51,LOW);//1s0
  digitalWrite(50,LOW);//2s2
  digitalWrite(49,LOW);//2s1
  digitalWrite(48,LOW);//2s0
}

Best Answer

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)