1

Hello everyone I am working on a project that will measure ohm value of a resistor .

Schematic / article link https://create.arduino.cc/projecthub/iasonas-christoulakis/how-to-make-an-arduino-ohm-meter-90fda8

And

Here is the code below

int analogPin= 0;
int raw= 0;
int Vin= 5;
float Vout= 0;
float R1= 1000;
float R2= 0;
float buffer= 0;

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

 void loop()
{
raw= analogRead(analogPin);
if(raw) 
{
buffer= raw * Vin;
Vout= (buffer)/1024.0;
buffer= (Vin/Vout) -1;
R2= R1 * buffer;
Serial.print("Vout: ");
Serial.println(Vout);
Serial.print("R2: ");
Serial.println(R2);
delay(1000);
}
}

There need to be a known and another unknown resistor.

The ohm value of known resistor is supposed to be 1k ohm

So my question is, what is the max ohm range will my arduino ohm meter be able to measure of the unknown resistor with 1k reference resistor and how to calculate it?

5 - 10% accuracy is enough for me

Thanks for giving me your attention :D

3
2

Your resolution of the ADC (the analogRead) will be 1/1024 * 5V (since you get a reading in the range 0 to 1023), that is, you can tell the difference in increments of 5/1024 which is 0.00488V, so say roughly 0.005V.

Now, I wrote a little bit of code to work out the voltages that you would get with various values for your varying resistor:

r1 =      0, v = 5.000
r1 =    100, v = 4.545
r1 =    200, v = 4.167
r1 =    300, v = 3.846
r1 =    400, v = 3.571
r1 =    500, v = 3.333
r1 =    600, v = 3.125
r1 =    700, v = 2.941
r1 =    800, v = 2.778
r1 =    900, v = 2.632
r1 =   1000, v = 2.500
r1 =   1100, v = 2.381
r1 =   1200, v = 2.273
r1 =   1300, v = 2.174
r1 =   1400, v = 2.083
r1 =   1500, v = 2.000
r1 =   1600, v = 1.923
r1 =   1700, v = 1.852
r1 =   1800, v = 1.786
r1 =   1900, v = 1.724
r1 =   2000, v = 1.667
r1 =   3000, v = 1.250
r1 =   4000, v = 1.000
r1 =   5000, v = 0.833
r1 =   6000, v = 0.714
r1 =   7000, v = 0.625
r1 =   8000, v = 0.556
r1 =   9000, v = 0.500
r1 =  10000, v = 0.455
r1 =  20000, v = 0.238
r1 =  30000, v = 0.161
r1 =  40000, v = 0.122
r1 =  50000, v = 0.098
r1 =  60000, v = 0.082
r1 =  70000, v = 0.070
r1 =  80000, v = 0.062
r1 =  90000, v = 0.055
r1 = 100000, v = 0.050
r1 = 110000, v = 0.045
r1 = 120000, v = 0.041
r1 = 130000, v = 0.038
r1 = 140000, v = 0.035
r1 = 150000, v = 0.033
r1 = 160000, v = 0.031
r1 = 170000, v = 0.029
r1 = 180000, v = 0.028
r1 = 190000, v = 0.026
r1 = 200000, v = 0.025
r1 = 210000, v = 0.024
r1 = 220000, v = 0.023
r1 = 230000, v = 0.022
r1 = 240000, v = 0.021
r1 = 250000, v = 0.020
r1 = 260000, v = 0.019
r1 = 270000, v = 0.018
r1 = 280000, v = 0.018
r1 = 290000, v = 0.017
r1 = 300000, v = 0.017

You can see that the difference in voltage is only 0.005V (the ADC resolution) between r1 of 90k and 100k. Further down, you can't tell the difference (within 0.005V) of 270k and 300k.

I'm not sure how to express that as an error percentage, perhaps someone better at maths than me can do that. :)

7
  • So does that literally mean that I can measure max 100k resistor with 1k reference resistor? Sorry to say but ur explanation has confused me a little bit. Oct 27 '20 at 8:23
  • I'm not saying that, but if you look at the voltage for 200k (0.025V) and 250k (0.020V), then you won't be able to tell the difference between 200k and (say) 220k. So you might say, for 200k that it would be +/- 50k. That is your error amount. So you could measure a 200k resistor, but the error amount would be 50/200, that is 25%. Now for 100k, it would appear to be 10/100, or 10%. Subject to my arithmetic being right, that would seem to indicate that 100k is about your limit, if you want 10% accuracy or better.
    – Nick Gammon
    Oct 27 '20 at 10:17
  • There would be a reason why cheap multimeters want you to choose a range for resistance measurement, they probably swap in an appropriate reference resistor to give a reasonable error amount for the range you are measuring.
    – Nick Gammon
    Oct 27 '20 at 10:19
  • Ok thanks , getting it clear now Oct 27 '20 at 10:21
  • Even the very expensive ohm meters switch range, it may be transparent to you but they do. I have repaired and calibrated many over the years and they all did it.
    – Gil
    Oct 27 '20 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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