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. Don’t struggle every time you need to know 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 will never need to spend time guessing the difference between those tiny grey and purple bands again.

Building the Arduino Ohm Meter

The circuitry is simple, all you need is a resistor of known resistance, the resistor you want to measure, and an Arduino. We will set up a voltage divider and measure the voltage between the known resistor and the unknown resistor:

Arduino Ohm Meter CORRECTED

The Arduino Ohm Meter Program

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

Line 5 in the code above (float R1 = 1000) is where you can change the value of the known resistor (1 kOhm = 1000 Ohms in this example). More on this below.

The program sets up analog pin A0 to read the voltage between the known resistor and the unknown resistor.

If you open up the serial monitor you will see the resistance values being read by the Arduino. There is a line for R2: and Vout: that will appear once per second.

R2: is the resistance value your unknown resistor value in Ohms.

Vout: is the voltage drop across your unknown resistor:

Arduino Ohm Meter Serial Monitor 2

Accuracy of the Ohm Meter

These are the readings I got with a 200 Ohm resistor, and the values are pretty accurate (1.6% error). One thing to be aware of though, is that the error will increase as the value of the unknown resistor gets much larger or much smaller than the value of the known resistor. For example, if you try to measure a 220 kOhm unknown resistor with a 1 kOhm known resistor, the value output by the Arduino may not be accurate enough:

Arduino Ohm Meter Serial Monitor 3

These are the readings I got when trying to measure a 220 kOhm unknown resistor with a 1 kOhm known resistor. There is a large error here (greater than 100%). This problem is fixed after changing line 5 in the code above (float R1 = 1000) to the value of your known resistor. If we change this to 100000 and replace the 1 kOhm resistor in our circuit with a 100 kOhm resistor, the accuracy of the measurements will be greatly improved.

Arduino Ohm Meter Serial Monitor 4

These are the values I got measuring the same 220 kOhm resistor after changing the code in line 5 to float R1 = 100000, and replacing the 1 kOhm known resistor in the circuit to a 100 kOhm resistor. The values are much more accurate (about 1.8% error).

This project will 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’s really a lot better than looking at the color bands every time you need a certain resistor!

If you’re having trouble setting up this project, just leave a comment below and I’ll try to answer it quickly.

Here’s the video tutorial for this project:

Need an easy-to-use way to design circuits and layout PCBs?