Issue reading values on Matrix Resistors (3x3)

Hello everyone,

I want to read the values of a resistors matrix (3x3) like this schematic:

The code I've used for reading the values of each resistor is:

int SensorA0 = 0;
int SensorA1 = 0;
int SensorA2 = 0;

void setup() {
  Serial.begin(115200);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
}

void loop() {
  for(int i = 8; i<=10; i++){
    digitalWrite(i, HIGH);
    SensorA0 = analogRead(A1);
    
    digitalWrite(i, HIGH);
    SensorA1 = analogRead(A2);
    
    digitalWrite(i, HIGH);
    SensorA2 = analogRead(A3);
    
    Serial.print(SensorA0); Serial.print(", ");
    Serial.print(SensorA1); Serial.print(", ");
    Serial.println(SensorA2);
    
    digitalWrite(i, LOW);
    delay(50);
  
  }
  Serial.println("");
  delay(2000);
}

The values that I've used for make a first simulation with Tinker (From AutoDesk) are:

[1000Ohms], [1000Ohms], [1000Ohms]
[1000Ohms], [1000Ohms], [1000Ohms]
[330Ohms ], [1000Ohms], [1000Ohms]

I've read the values on each 1KOhm resistor (Fixed values).

The output of this configuration is:

199, 277, 277
199, 277, 277
485, 274, 274

With this values, I want to show in the serial monitor the real values of the resistor matrix. Because of the output is not similar to the real values (Resistors connected to the Matrix), I don't know how to calculate it.

Each resistor share currents and voltages from neighbour resistors and the value change.

Thank you in advance and wait for your reply. Any suggestion is appreciated.

Regards.

What the intention of this project? Why a matrix? If this is for reading buttons, then you forgot the buttons in the schematics and you misplaced the diodes.

In the code you don't need three consecutive digitalWrite(i, HIGH) calls, one is enough to set the output high.

This one is a simulation of a sensor mat and has variable resistors (3x3 Matrix).

I want to read the values of any point when you press it the sensor and then, watch the value on the serial monitor.

But when you measure the voltage in one resistor, each one share currents and voltages from neighbour resistor and the value is not correct.

Thank you for your response and want to read suggestions.

The diodes are placed wrongly. All resistors are interconnected, so the intended voltage divider won't work.

For example if you power the yellow row and measure A1. You probably had the illusion that current is running through the left-top resistor and then through the left-most GND resistor which build a voltage divider. But current is also running through the second resistor (on the top row), down to the A2 connection from there over the second resistor of the second row to the first resistor of the second row again to the A1 connection. The same applies to the third column as well as the third row.
You need a diode at every matrix resistor but you can eliminate the diodes on the GND connections.

I've removed the Diodes, but the values it's different, because each resistor shares voltage and currents from the neighbors. As I've said, this one is a simulation of a pressure mat, and I want to plot a correct value proportional to the real values of the resistors.

Thank you so much for your suggestions. Regards.

Did you actually read my answer (post #4)?

Sure, every diode has a voltage drop.

Why did you post here? You are clearly not interested in solving your problem.

You ignore advice, and you vandalise your original post by removing the picture with diodes on them.
Those diodes are clearly not in the right place but you do need them in the correct place for the idea of a matrix to work.
What are these resistor / sensors, can you post a link.

Is this intended to remain a 3 by 3 grid or do you want to expand this to a bigger matrix?

Be aware that most of the time simulators are crap and will not reflect the reality when you get read hardware.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.