Project tutorial
DIY Autorange Ohmmeter

DIY Autorange Ohmmeter © GPL3+

The device is sufficiently accurate and uses minimum number of external components.

  • 1,744 views
  • 1 comment
  • 5 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project


This is a simple auto-ranging ohmmeter using Arduino. The measured resistance is displayed using a 16×2 LCD display. The device is sufficiently accurate and uses minimum number of external components. Easy way to measure an unknown resistance is to use a voltage divider. You apply a known voltage across two series resistors, one known, one unknown, and measure the voltage at the junction. The current through two resistors will be equal.The voltage across the unknown resistance is measured using the ADC of the arduino(A5). With Ohm's law we can easy calculate value of unknown resistor.

The idea for the project as well as the code are taken from the Circuits Today website, where there are more detailed explanations about the operation and mathematical calculations. What we need here is a scheme for estimating the value of Rx roughly and then putting a matching resistor in place of R1 and this method is called auto ranging. The circuit given below demonstrates auto ranging.

The accuracy of the instrument is the largest in the range from 10 Ohm to 100 KOhms and is about +/- 5% which is a good result, considering that the device is relatively simple to build. It is desirable to supply the instrument from a stable source for maximum accuracy.

Code

CodeC/C++
#include<LiquidCrystal.h>
int vin=A5;

int t=1;
int u=6;
int v=7;
int w=8;
int x=9;
int y=10;
int z=13;

int at;
int au;
int av;
int aw;
int ax;
int ay;
int az;
int a;
double vx;
float rx;
double i;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
pinMode(vin,INPUT);
lcd.begin(16,2);

pinMode(t,OUTPUT);
pinMode(u,OUTPUT);
pinMode(v,OUTPUT);
pinMode(w,OUTPUT);
pinMode(x,OUTPUT);
pinMode(y,OUTPUT);
pinMode(z,OUTPUT);

digitalWrite(t,LOW);
digitalWrite(u,LOW);
digitalWrite(v,LOW);
digitalWrite(w,LOW);
digitalWrite(x,LOW);
digitalWrite(y,LOW);
digitalWrite(z,LOW);
}
void loop()
{

digitalWrite(t,HIGH);
digitalWrite(u,LOW);
digitalWrite(v,LOW);
digitalWrite(w,LOW);
digitalWrite(x,LOW);
digitalWrite(y,LOW);
digitalWrite(z,LOW);
delay(100);
at=analogRead(vin);




digitalWrite(t,LOW);
digitalWrite(u,HIGH);
digitalWrite(v,LOW);
digitalWrite(w,LOW);
digitalWrite(x,LOW);
digitalWrite(y,LOW);
digitalWrite(z,LOW);
delay(100);
au=analogRead(vin);
digitalWrite(t,LOW);
digitalWrite(u,LOW);
digitalWrite(v,HIGH);
digitalWrite(w,LOW);
digitalWrite(x,LOW);
digitalWrite(y,LOW);
digitalWrite(z,LOW);
delay(100);
av=analogRead(vin);



digitalWrite(t,LOW);
digitalWrite(u,LOW);
digitalWrite(v,LOW);
digitalWrite(w,HIGH);
digitalWrite(x,LOW);
digitalWrite(y,LOW);
digitalWrite(z,LOW);
delay(100);
aw=analogRead(vin);


digitalWrite(t,LOW);
digitalWrite(u,LOW);
digitalWrite(v,LOW);
digitalWrite(w,LOW);
digitalWrite(x,HIGH);
digitalWrite(y,LOW);
digitalWrite(z,LOW);
delay(100);
ax=analogRead(vin);


digitalWrite(t,LOW);
digitalWrite(u,LOW);
digitalWrite(v,LOW);
digitalWrite(w,LOW);
digitalWrite(x,LOW);
digitalWrite(y,HIGH);
digitalWrite(z,LOW);
delay(100);
ay=analogRead(vin);



digitalWrite(t,LOW);
digitalWrite(u,LOW);
digitalWrite(v,LOW);
digitalWrite(w,LOW);
digitalWrite(x,LOW);
digitalWrite(y,LOW);
digitalWrite(z,HIGH);
delay(100);
az=analogRead(vin);

if(az>=450)
{
vx=az*0.00489;
i=(5-vx-0.55)/22000;
rx=(vx/i);
}
if(ay>=450 && az<450)
{
vx=ay*0.00489;
i=(5-vx-0.55)/10000;
rx=(vx/i);
}
if(ax>=448 && ay<448 && az<448)
{
vx=ax*0.00489;
i=(5-vx-0.55)/4700;
rx=(vx/i);
}

if(aw>=439 && ax<439 && ay<439 && az<439)
{
vx=aw*0.00489;
i=(5-vx-0.55)/2200;
rx=(vx/i);
}

if(av>=439 && aw<439 && ax<439 && ay<439 && az<439)
{
vx=av*0.00489;
i=(4.8-vx-0.55)/1000;
rx=(vx/i);
}

if(au>=430 && av<430 && aw<430 && ax<430 && ay<430 && az<430)
{
vx=au*0.00489;
i=(4.5-vx-0.55)/560;
rx=(vx/i);
}

if(at>=430 && au<430 && av<430 && aw<430 && ax<430 && ay<430 && az<430 )
{
vx=at*0.00489;
i=(4.5-vx-0.55)/220;
rx=(vx/i);
}

if(at<430 && au<430 && av<430 && aw<430 && ax<430 && ay<430 && az<430 )
{
vx=at*0.00489;
i=(4.5-vx-0.55)/220;
rx=(vx/i);
}
lcd.setCursor(0,0);

if(vx>4.8)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("----INFINITY----");
}
else
{
if(rx<1000)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print(rx);
lcd.setCursor(7,0);
lcd.print((char)244);
}
else
{
lcd.clear();
rx=rx/1000;
lcd.setCursor(0,0);
lcd.print(rx);
lcd.setCursor(6,0);
lcd.print("k");
lcd.print((char)244);
}
}
lcd.setCursor(0,1);
lcd.print("Arduino Ohmmeter");
}

Schematics

Schematic
Untitled sketch bb mfd4bxs3lq

Comments

Similar projects you might like

DIY Simple Measuring Wheel with Rotary Encoder

Project tutorial by Mirko Pavleski

  • 5,846 views
  • 1 comment
  • 17 respects

DIY Sensitive ADXL335 Earthquake Detector

Project tutorial by Mirko Pavleski

  • 5,988 views
  • 4 comments
  • 12 respects

DIY Si4730 All Band Radio (LW, MW, SW, FM)

Project tutorial by Mirko Pavleski

  • 24,103 views
  • 8 comments
  • 58 respects

DIY Sensitive Software Defined Radio with AD9850 VFO

Project tutorial by Mirko Pavleski

  • 4,635 views
  • 0 comments
  • 15 respects

DIY Retro Look FM Radio with TEA5767 Module

Project tutorial by Mirko Pavleski

  • 17,182 views
  • 10 comments
  • 60 respects

DIY Ultra Sensitive EMF Detector

Project tutorial by Mirko Pavleski

  • 6,472 views
  • 4 comments
  • 35 respects
Add projectSign up / Login