Homemade Multimeter with different "internal" resistances

I am attempting to build a multimeter using my Arduino Uno. I would like to be able to approximate the resistance value of an unknown resistor using three different "internal" resistance values. For example, my internal resistances are 270[Ω], 910[Ω], and 560[Ω]. In essence, I am attempting to make a multimeter using the voltage divider rule. I want to connect my unknown resistor and have it be approximated by three different "internal" resistances. I am having trouble finding a way in switching between three fixed resistor values for the internal resistance. I would really appreciate some help on how to toggle between three different and fixed resistor values. Thanks in advance. Here is my code so far:

int analogPin = 0;    // reading voltage from A0
int raw = 0;
int Vin = 5;
float Vout = 0;
float R1 = 270;
float R2 = 910;
float R3 = 560;
float R4 = 0;
float x = 0;

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

void loop()
{
  digitalWrite(2,HIGH);
  raw = analogRead(analogPin);
  if(raw) 
{
x = raw * Vin;
Vout = x/1024.0;
x = (Vin/Vout) - 1;
R4 = R1 * x;
Serial.print("Vout: ");
Serial.println(Vout);
Serial.print("R4: ");
Serial.println(R4);
delay(1000);
}
}

I’m not sure how you’re getting internal resistance. Where are you schematics.

I am trying to simulate an ohmmeter. I plan to build a circuit and write a code, which I'm not fully sure how to make myself, that allows me to use a different "internal" resistance to approximate the unknown resistor using the voltage divider rule.

Have you tried to look at other Arduino ohm meter projects? I’m still not sure what you mean by “internal”. You only need to know the value of one resistor and the voltage to figure out the resistance of an unknown. I don’t see the value of switching to different resistors especially if they’re so close in value.

If you flip your divider over with Rx on top and Rstd going to ground (which is how your calculation expects things), you could switch the different Rstd’s with n-channel mosfets. The on resistance (Rds) of any modern logic level mosfet should be less than an ohm so the effect on your measurement will be minimal.

If you’re using a digital output pin for the voltage source, you’ll get far better results using the 5V pin, it has a much lower source impedance and filtering. More importantly, 1023 analog counts will always equal the 5V output. A digital output will not measure 1023 analog counts since it is less than VCC due to the voltage drop in output transistors.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
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?

OPs diagram

Tom... :slight_smile:

Hi,
Why don't you just use one REFERENCE resistor, instead of three and use OHMS LAW?

You will have to use OHMS LAW with the three REFERENCE resistors anyway.

Tom... :slight_smile: