Make Arduino Ohmmeter – How to Measure Resistance?

An ohmmeter is an instrument that measures the electrical resistance of a material. Ohmmeters calculates the sample resistance value by applying the Ohm’s law V=IR. It usually works by measuring the voltage drop by applying a small quantity of current to the test resistance and a known reference resistance. The unknown resistance is then found by calculating the voltage value with the known resistance value.

digital ohmmeter

Serial Monitor based PC Ohmmeter

Here the resistance is calculated by means of voltage division in a series connection. That is, in a series connection the voltage drops across resistors in a direct proportion to their magnitude of resistance. Higher the resistance, higher the voltage drop across it.

arduino ohmmeter circuit diagram

In the circuit, the test resistance is connected across the 5V pin and Analogread pin A0. A known reference resistance (Rrefer =1000) is connected to the analog input and GND. The analog input reads the voltage across (V1) the reference resistance.

The test resistance value is obtained by the equation,

Rtest = (5 - v1) * Rrefer / v1;

For measuring always try to maintain the value of reference resistor near to the test resistance. How much the value of test resistance can be made closer to the reference resistance, that much accuracy can be maintained in the readings. That is the error will be larger as the value of the unknown resistor is considerably larger or smaller than the value of the known resistor.

Code

float v1, Rtest, Rrefer = 1000;

void setup() {
  Serial.begin(9600);
}
void loop() {
  v1 = analogRead(A0);
  v1 = v1 * (5.0 / 1023.0);
  Rtest = (5 - v1) * Rrefer / v1;
  Serial.print("Resistance = ");
  Serial.print(Rtest);
  Serial.println("ohm");
  delay(1000);
}

Whenever the value of reference resistance in the circuit is changed, the value in code also needs to change. The value of reference resistance in the circuit and the code should be always same. The value of the reference resistance can be adjusted in the program by replacing the value of Rrefer. For serial monitor ohmmeter, the code has an input option to enter the reference resistance value. So we can enter the test resistance value during each start or reset.

float v1, Rtest, Rrefer = 0;

void setup() {
  Serial.begin(9600);
  Serial.print("Enter refernce resistance = ");
  while (Rrefer == 0) {
    Rrefer = Serial.parseInt();
  }
  Serial.print(Rrefer);
  Serial.println("ohm");
}
void loop() {
  v1 = analogRead(A0);
  v1 = v1 * (5.0 / 1023.0);
  Rtest = (5 - v1) * Rrefer / v1;
  Serial.print("Resistance = ");
  Serial.print(Rtest);
  Serial.println("ohm");
  delay(1000);
}

The reference resistance should have an accurate value. If the tolerance of the reference resistance is not negligible, it should be considered while setting the actual Rrefer value. The tolerance in the value of reference resistance will considerably affect the reading.  So the chance of error increases with the variation of the refer resistance from its rated value.

LCD Digital Ohmmeter

The only change in the LCD resistance meter is just an addition of  LCD interface instead of the serial monitor display.

arduino lcd ohmmeter, arduino resistance meter

Code

#include <LiquidCrystal.h>
float v1, Rtest, Rrefer = 1000;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Rtest = ");
}

void loop() {
  v1 = analogRead(A0);
  v1 = v1 * (5.0 / 1023.0);
  Rtest = (5 - v1) * Rrefer / v1;
  lcd.setCursor(8, 0);
  lcd.print(Rtest);
  lcd.print("ohm");
  delay(1000);
}
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *