Note: before i explain my issue i would like to note that I am a beginner in electronics please pay attention to that when providing solutions and explanations. Thank you.

I have succeeded at making an auto raging Ohmmeter it is still ofcours experimental there for I would like to get some opinions and perhaps solutions to some of the issues I'm facing.

How it works: It is based on a simple voltage divider. After experimenting it seems that a voltage drop across the unknown resistor in a certain range (this case [3.135V, 0.99V] with a voltage source equal to 3.3V) gives the most precise results compared to other values.

This Ohmmeter has a very useful feature and that is auto ranging, it changes the range automatically when the voltage drop values are not in the previously mentioned interval ([3.135V, 0.99V]).

The accompanied image shows how the device works.

If the value of Rx is too small compared to (R1+R2+R3) the Arduino switches the analog reading from A0 to A1 if the problem still accurse the Arduino will change again to A2 meaning it is now measuring not the value of Rx but (Rx+R1+R2) in series after that the Arduino is programmed to do the subtraction accordingly

This device presents some noticeable inconvenient that need to be eliminated:

1- It depends on experimental values, so it is not certain if it'll function properly in different conditions.

2- For accurate (still not exact) measurements the value of Rx has to be greater than R1

3- It provides acceptable measurements compared to the actual value with an error that is not too big (less than 1% relative error) the precision was obtained by the use of some of the arduino functions (such as voltage reference, and responsive analog read to make it more stable) also I have chosen the voltage source to be 3.3V instead of 5V to reduce noise, now if one wishes to use a different microcontroller other than arduino will it still be possible to obtain the same precision.

I would like to know your professional opinion regarding these inconvenient and if you may solutions for them, I have accompanied the code for better understanding. Thank you

    #include <ResponsiveAnalogRead.h>
ResponsiveAnalogRead analogPin0(A0, true);
ResponsiveAnalogRead analogPin1(A1, true);
ResponsiveAnalogRead analogPin2(A2, true);

int raw1= 0,raw2=0,raw3=0;
int Vin= 3.3;
float Vout1= 0,Vout2=0,Vout3=0;

float R1= 10000,R2=100000,R3=1000000;
float Rx= 0;
float buffer= 0;

void setup()


void loop()
buffer= raw1 * Vin;
Vout1= (buffer)/1024.0;
if(Vout1<=3.135&&Vout1>=0.99) //firstif

buffer= (Vin/Vout1) -1;
Rx= (R1+R2+R3) * buffer;
Serial.print("Vout1: ");
Serial.print("Rx: ");
   else //else1 of first if

   buffer= raw2 * Vin;
   Vout2= (buffer)/1024.0;
      if(Vout2<=3.135&&Vout2>=0.99) //second if of first else
      buffer= (Vin/Vout2) -1;
      Rx= (R2+R3) * buffer;
      Serial.print("Vout2: ");
      Serial.print("Rx: ");
      buffer= raw3 * Vin;
      Vout3= (buffer)/1024.0;
          buffer= (Vin/Vout3) -1;
          Rx= R3 * buffer;
          Serial.print("Vout3: ");
          Serial.print("Rx: ");



simulate this circuit – Schematic created using CircuitLab

New contributor
Rekaia Draoui is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 3
    I think this question could be improved by making it a bit clearer what your question(s) exactly are. And at least for me, those wiring diagrams mean nothing. I am not exactly proud of it, but I cannot get myself to learn the resistor markings. So if you would replace that with a schematic (use the inbuilt tool) and name the parts like you did in your question, that would make the circuit much clearer for me. – Arsenal Sep 14 at 12:51
  • Flagging as “too broad” since there’s no specific question – PDuarte Sep 14 at 13:38
  • i apologize i thought i made myself clear by ponting out the inconvenients i was having with my project. – Rekaia Draoui Sep 14 at 14:00
  • 3
    Ctrl+f followed by "?" gives me 0 matches in your question. – Harry Svensson Sep 14 at 14:00
  • Do you make use of the fact you can drive the Ax pins as outputs? I can't spot it in the code. This would allow you to drive more current into lower value Rx's. – Neil_UK Sep 14 at 14:01

I agree with this question being too broad.

To point you in the right direction I'm going to give you some hints:

You should do a hand calculation of what the voltages at A0, A1, A2 will be when Rx = 1 k ohm, 10 kohm ... 1 Mohm.

Your conclusion should be that when Rx has a low value it will be nearly impossible to accurately measure its value.

The reason for this is that R3 is 1 Mohm and it sort of "dictates" the current that is flowing. This will be a very small current (3 uA or less). A small current through a small (1 k, 10k) resistor will give an almost zero voltage drop.

Real autoranging resistance meters change (increase) the current through Rx until the voltage is in an accurately readable range. Your schematic can do something similar as well but your code doesn't support that at the moment.

For a low value resistor you could make A1 an output and force it low. Then if Rx is 10 k ohm you would read half of the 3.3 V at A0.

Your Answer

Rekaia Draoui is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.