I have been working on a Sensor Matrix that uses an Arduino Uno, along with a multiplexer and a demultiplexer. the Mux/Demux is a TI CD74HC4067 16 Channel variant
In my code, I use PORTD to allow for easy switching of the pin configurations. in my code, I capture the serial output of the array shown below. What I've noticed in testing is that the value is the same in groups of 4. I believe it is a coding issue as when doing hand resistance measuring, the values change independently of each other.
127 39 38 38 0 61 61 0 101 70 102 70 49 49 50 49
31 31 31 32 38 0 39 38 43 44 44 44 47 50 51 51
36 36 37 36 71 73 73 73 70 72 72 72 52 52 53 53
29 29 29 29 47 47 48 48 48 49 48 49 47 49 49 49
34 35 34 34 68 69 70 70 58 58 59 59 60 62 62 62
38 38 38 38 52 53 52 53 54 54 55 54 47 48 48 49
38 38 38 39 47 47 47 47 58 60 61 60 46 47 47 47
35 35 35 36 73 75 74 75 72 74 74 74 50 50 50 50
32 31 32 31 45 45 46 45 53 54 54 54 97 97 97 97
43 43 42 43 60 60 60 60 73 75 76 74 51 51 51 52
34 35 35 34 49 50 50 50 54 56 56 56 48 49 49 49
Below is the code used to generate the sensor data above. I was wondering if anyone may have ideas on why the Arduino would capture information like this, Thank you.
int analog = A0;
int sensor = 0;
void setup() {
// put your setup code here, to run once:
DDRD = 255;
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(A0);
PORTD = 0;
int b[16][16];
for (int x = 0; x <= 15; x++) {
for (int y = 0; y <= 15; y++) {
sensor = analogRead(analog);
delay(50);
b[x][y] = sensor;
Serial.print(b[x][y]);
//Serial.print(' ');
//Serial.print(PORTD);
Serial.print(' ');
PORTD = PORTD+1;
}
Serial.println();
}
Serial.println();
delay(500);
}