Here’s a really useful and easy project you can do with an Arduino. If you have a hard time reading the color bands on resistors like I do, this project is perfect for you. Instead of struggling every time you need to find the resistance of a resistor, just build an Ohm meter and measure all of your resistors. If you come up with a good way to label and organize them, you’ll never need to spend time guessing the difference between those tiny grey and purple bands again.

BONUS: I made a quick start guide for this tutorial that you can download and go back to later if you can’t set this up right now. It covers all of the steps, diagrams, and code you need to get started.

Wiring the Ohm Meter

The circuit is really simple. All you need is an Arduino, the resistor you want to measure, and another resistor with a known value. We’ll set up a voltage divider with the known and unknown resistors, and measure the voltage between them with the Arduino. Then we’ll run a program that will calculate the resistance from Ohm’s Law.

First, wire up the circuit like this:

Arduino Ohm Meter CORRECTED

The Code

Now, enter this code into the Arduino IDE and upload it to your board:

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);
  }
}

Enter the value of your known resistor (in Ohms) on line 5 of the code above. In my case, I’m using a known resistor with a value of 1K Ohms (1000 Ohms). Therefore, my line 5 should look like this: float R1 = 1000;.

The program sets up analog pin A0 to read the voltage between the known resistor and the unknown resistor. You can use any other analog pin though, just change the pin number in line 1, and wire the circuit accordingly.

When you open up the serial monitor you’ll see the resistance values printed once per second. There will be two values, R2 and Vout.

  • R2: is the resistance of your unknown resistor in Ohms.
  • Vout: is the voltage drop across your unknown resistor.

Output the Readings to an LCD

One reader commented that they would like to display the resistance measurements on an LCD. This is easy to do. First you’ll want to read our tutorial on setting up an LCD display on the Arduino. That will show you how to connect everything. After you’ve got the LCD set up, connect the Ohm meter as shown above, and upload this program to the Arduino:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

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

void setup(){
  lcd.begin(16, 2);
}

void loop(){
  raw = analogRead(analogPin);
  if(raw){
    buffer = raw * Vin;
    Vout = (buffer)/1024.0;
    buffer = (Vin/Vout) - 1;
    R2 = R1 * buffer;

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("R2: ");
    lcd.print(R2);
    delay(1000);
  }
}

How Accurate Is It?

These are the readings I got with a 200 Ohm “unknown” resistor:

Arduino Ohm Meter Serial Monitor 2

The values are pretty accurate, that’s only an error of 1.6%.

However, these are the readings I got when I measured a 220K Ohm “unknown” resistor:

Arduino Ohm Meter Serial Monitor 3

The error here is greater than 100%.

That’s because I was still using a 1K Ohm known resistor. The accuracy of the Ohm meter will be poor if the value of the known resistor is much smaller or larger than the resistance of the unknown resistor.

The problem is easily fixed by using a known resistor that’s closer in value to the unknown resistor. Once I replaced the 1K Ohm known resistor with a 100K Ohm resistor, the accuracy of the measurements improved greatly.

Don’t forget to change the code above (where it says float R1 = 1000) to the value of your new known resistor.

These are the values I got with the same 220K Ohm “unknown” resistor and a 100K Ohm known resistor:

Arduino Ohm Meter Serial Monitor 4

These values are much more accurate, with an error of about 1.8%.

Here’s a video tutorial for this project if you want to see the Ohm meter working:

This project should help you identify your resistors without the guesswork involved in reading color bands. I just measured all of my resistors and wrote the resistance value on the paper strips holding them together. It’ a lot easier than looking at the color bands every time you need a certain resistor!

If you’re having trouble with this project, just leave a comment below and I’ll try to answer it… And if you liked this tutorial, be sure to subscribe and we’ll send out an email to let you know when we publish new articles!