Noise (!?) with the Mux Shield II

Hi!

I am using a Mux Shield II ( Mux Shield II | Mayhew Labs ) with an Arduino Mega 2560 to get a signal from a pressure sensor using this scheme (but with the signal in the port 15 of the I/O 3 of my mux shield)

But when I press the sensor, instead of getting the value of just one I/O port, I am getting all these values:

Here the example code I am using (modified to show only the I/O3) values:

#include <MuxShield.h>

//This example shows how to use the Mux Shield for analog inputs

#include <MuxShield.h>

//Initialize the Mux Shield
MuxShield muxShield;

void setup()
{
    //Set I/O 1, I/O 2, and I/O 3 as analog inputs
    muxShield.setMode(1,ANALOG_IN);
    muxShield.setMode(2,ANALOG_IN);
    muxShield.setMode(3,ANALOG_IN);
    
    Serial.begin(9600);
}

//Arrays to store analog values after recieving them
int IO1AnalogVals[16];
int IO2AnalogVals[16];
int IO3AnalogVals[16];

void loop()
{
  for (int i=0; i<16; i++)
  {
    //Analog read on all 16 inputs on IO1, IO2, and IO3
   // IO1AnalogVals[i] = muxShield.analogReadMS(1,i);
    //IO2AnalogVals[i] = muxShield.analogReadMS(2,i);
    IO3AnalogVals[i] = muxShield.analogReadMS(3,i);
  }
  
  //Print IO3 values for inspection
  //Serial.print("IO3 analog values: ");
  for (int i=0; i<16; i++)
  {
    Serial.print(IO3AnalogVals[i]);
    Serial.print('\t');
  }
  Serial.println();
}

Also, this 'noise' occurs in the all other I/O1 and I/O2 ports.

Does someone had any problem like this?

Thank you!

The noise appears because all the other inputs are left "floating" - they pick up stray signals. If you want these inputs to be "silent" you need to tie them to GND, VCC or any other well-defined level.

High-impedance inputs like these needs nano-amps to register a voltage, so just waving your hand over the board will affect it.

// Per.

Thank you @zappro!!!

I discovered that just putting more sensors (since I will need to fulfill every input anyway) the noise goes down (least become just a few milivolts - about 100mV). Is there a way to remove more noise without using filters in each sensor?

Another question: my MUX Shield does not says anything in the datasheet about using an I/O as a power supply or GND (it just talks about digital values as outputs). Is there a way to carry analog VCC/GND in those?

Thank you!

The output-drivers (74HC595) can source/sink 25mA per pin as far as i read briefly. BUT, they have a maximum current per package as well, which i will leave to you to find out.
As long as your application does not violate this, i see no problem in doing that.

// Per.