Arduino multi-channel ohmmeter

hello, I'm trying to make a multi-channel ohmmeter
how can I make it?

Which are the demands?

measure the resistance of four samples at the same time and each circuit is operated independently

Start building one unit and have it working. The add the components needed for the remaining 3 samples.

Here is my cord.
one unit works well. but if I follow this cord, It doesn't work well ㅠㅠ

int raw0 = 0;
int raw1 = 0;
int raw2 = 0;
int raw3 = 0;
int Vin = 5;
float Vout = 0;
float R1 = 100000;
float R2 = 0;
float R3 = 0;
float R4 = 0;
float R5 = 0;
float buffer = 0;

void setup(){
Serial.begin(9600);
}

void loop(){
raw0 = analogRead(A0);
raw1 = analogRead(At1);
raw2 = analogRead(A2);
raw3 = analogRead(A3);
if(raw0){
buffer = raw0 * Vin;
Vout = (buffer)/1024.0;
buffer = (Vin/Vout) - 1;
R2= R1 * buffer;
Serial.println(R2);
delay(100);
}
else if(raw1){
buffer = raw1 * Vin;
Vout = (buffer)/1024.0;
buffer = (Vin/Vout) - 1;
R3= R1 * buffer;
Serial.println(R3);
delay(100);
}
else if(raw2){
buffer = raw2 * Vin;
Vout = (buffer)/1024.0;
buffer = (Vin/Vout) - 1;
R4= R1 * buffer;
Serial.println(R4);
delay(100);
}
else if(raw3){
buffer = raw3 * Vin;
Vout = (buffer)/1024.0;
buffer = (Vin/Vout) - 1;
R5= R1 * buffer;
Serial.println(R5);
delay(100);
}
}

What does "doesn't work well" look like?
What pin is At1 used in raw1 = analogRead(At1)?
Does that even compile?

Hi,
Welcome to the forum.

Please read http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
What model Arduino are you using?
Will the resistors be in a circuit or are you measuring them on their own separately?

Have you GOOGLED arduino ohm meter

Thanks.. Tom.. :slight_smile:

To Railroader
At1 is just a typo, At1 is actually A1 haha...
At a serial monitor, each circuit doesn't seem to be independent and affects each other...
I found that each resistance value repeats equally

To TomGeorge. Here is a code thx!

int raw0 = 0;
int raw1 = 0;
int raw2 = 0;
int raw3 = 0;
int Vin = 5;
float Vout = 0;
float R1 = 100000;
float R2 = 0;
float R3 = 0;
float R4 = 0;
float R5 = 0;
float buffer = 0;

void setup(){
Serial.begin(9600);
}

void loop(){
  raw0 = analogRead(A0);
  raw1 = analogRead(A1);
  raw2 = analogRead(A2);
  raw3 = analogRead(A3);
  if(raw0){
    buffer = raw0 * Vin;
    Vout = (buffer)/1024.0;
    buffer = (Vin/Vout) - 1;
    R2= R1 * buffer;
    Serial.println(R2);
    delay(100);
  }
  else if(raw1){
    buffer = raw1 * Vin;
    Vout = (buffer)/1024.0;
    buffer = (Vin/Vout) - 1;
    R3= R1 * buffer;
    Serial.println(R3);
    delay(100);
  }
  else if(raw2){
    buffer = raw2 * Vin;
    Vout = (buffer)/1024.0;
    buffer = (Vin/Vout) - 1;
    R4= R1 * buffer;
    Serial.println(R4);
    delay(100);
  }
  else if(raw3){
    buffer = raw3 * Vin;
    Vout = (buffer)/1024.0;
    buffer = (Vin/Vout) - 1;
    R5= R1 * buffer;
    Serial.println(R5);
    delay(100);
  }
}

Arduino model is Uno
And I'm trying to put the circuit picture in, but it doesn't exceed the capacity ㅠㅠ

To Tomgeorge
I attach this tinkercad link because picture inserting is not done ㅠㅠ

You can think of LED as a sample

temmy_lee:
At a serial monitor, each circuit doesn't seem to be independent and affects each other...

Can't see that picture without signing in (not going to).

float R1 = 100000;
100k pull up? That will cause cross-talk between channels.
Two solutions are available, but we first need to see a diagram.
Leo..

To Wawa
thank you for your comment
I don't know what you say "cross-talk between channels"
I'm trying to insert a picture (diagram) ㅠㅠ


Here is a serial monitor
R2 is in line 4n+1 (n=0,1,2,3...)
R3 is in line 4n+2
and R4, R5 are the same way.

each resistance value are the same (problem 1)
and if one of them changes resistance value, another resistances are affected (problem 2)

temmy_lee:
I don't know what you say "cross-talk between channels"

The Arduino has only one A/D, with a multiplexer switching between the analogue inputs.
The sample cap of the A/D could still have some charge left from the previous channel after switching.
That 'ghost charge' becomes worse if the impedance presented to the analogue input is >10k. You have 100k.

Solution#1: Add a 100n ceramic capacitor from each analogue pin to ground.

Solution#2: Double-read the analogue input, maybe with a small delay in between, so the sample cap has time to charge/discharge. Only the second reading is then used.

Try one at the time. You might have to use both tricks.
Leo..

To Wawa
hmm...

Wawa:
Solution#2: Double-read the analogue input, maybe with a small delay in between, so the sample cap has time to charge/discharge. Only the second reading is then used.

How can I design code? I have to change "void setup" part?

Hi,
Ops pic in jpg, had to screen capture, kiddykad will not provide jpg export.

Hi,
How do you expect to measure resistance with an LED in the circuit?
How do you expect to measure resistance when the resistance "network" supply does not share the same ground with the UNO?

What is the basis that you think you can measure resistance with out a proper potential divider network.

Please draw and post a PROPER circuit diagram?

Can you please tell us your electronics, programming, arduino, hardware experience?

Have you build this, or are you using the simulator?

Tom.... :slight_smile:

temmy_lee:
To Wawa
hmm...How can I design code? I have to change "void setup" part?

No, as said, try reading the input twice, with maybe a delay in between.

  raw0 = analogRead(A0); // dummy reading
  delay(10);  // optional
  raw0 = analogRead(A0); // real one
  raw1 = analogRead(A1); // dummy reading
  delay(10); // optional
  raw1 = analogRead(A1); // real one
  .....

To TomGeorge
thank you for your kindness reallyX1000000

First, LED was drawn on behalf of the sample I made. the sample is a flexible and variable resistance.
the mechanism of resistance change is bending, touching.
If I touch (or bend) the sample, the resistance value of the sample goes up and then recovers soon.

My sample shows an ideal resistance recovery speed at 20V

But, If UNO receives an external voltage of more than 12 volts, it will be damaged.

So, I set this circuit to solve this problem, but... same ground... I don't know sure...

my major is bio-engineering especially Bio Microelectromechanical systems(Bio-MEMS)

Programming, Arduino, hardware experience.. hmm... I learned at 2020 once, basic ㅠㅠ