I am reading analog values through my CD74HC4067 multiplexer, using an Arduino Uno with the following setup. I use 8 channels on my multiplexer to read values from high impedance analog FSR pressure sensors.
The Arduino code is provided below:
//Mux control pins
int s0 = 2;
int s1 = 3;
int s2 = 4;
//Mux in “SIG” pin
int SIG_pin = A0;
void setup(){
pinMode(s0, OUTPUT);
pinMode(s1, OUTPUT);
pinMode(s2, OUTPUT);
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
pinMode(SIG_pin, INPUT_PULLUP);
Serial.begin(9600);
}
void loop(){
for(int i = 0; i < 8; i ++){
Serial.print("Value at channel ");
Serial.print(i); Serial.print("is : ");
Serial.println(re
adMux(i));
delay(500);
}
}
int readMux(int channel){
int controlPin[] = {s0, s1, s2};
int muxChannel[8][4]={ {0,0,0,0},
{1,0,0,0},
{0,1,0,0},
{1,1,0,0},
{0,0,1,0},
{1,0,1,0},
{0,1,1,0},
{1,1,1,0} };
//loop through the 4 sig
for(int i = 0; i < 3; i ++){
digitalWrite(controlPin[i], muxChannel[channel][i]);
}
//read the value at the SIG pin
int val = analogRead(SIG_pin); //return the value
return val;
}
The problem I am having is that I am reading floating values in my serial monitor, which don't significantly change when pressing any of the sensors. I have tried them directly on the Arduino with bypassing the multiplexer, where they values are printed correctly (see circuit diagram below). There is probably something I am misconnecting in my multiplexer circuit or the corresponding code. Please help me out. Thanks in advance.

