How to Make an Arduino Ohm Meter
by CreativeStuff in Circuits > Arduino
16735 Views, 45 Favorites, 0 Comments
How to Make an Arduino Ohm Meter
We find it difficult to read color codes on resistors to find its resistance. In order to overcome the difficulty of finding the resistance value, we are going to build a simple Ohm Meter using Arduino. The basic principle behind this project is a Voltage Divider Network. The value of the unknown resistance is displayed on 16*2 LCD display.
Components Required:-
- Breadboard (https://www.banggood.in/custlink/Kv3KBp15nG)
- Arduino UNO (https://www.banggood.in/custlink/DmmmecTtQy)
- 16x2 LCD display (https://www.banggood.in/custlink/3GGD6JTVbV)
- Jumper wires (https://www.banggood.in/custlink/Kmm34JuHs8)
- 10k potentiometer (https://www.banggood.in/custlink/D3D36p7F6A)
- 470ohm resistor (https://www.banggood.in/custlink/vDvDBJ7PNl)
Circuit and Connections:-
LCD PIN 1------------GND
LCD PIN 2------------VCC
LCD PIN 3------------Middle pin of the pot
LCD PIN 4------------D12 of arduino
LCD PIN 5------------GND
LCD PIN 6------------D11 of arduino
LCD PIN 7------------NC
LCD PIN 8------------NC
LCD PIN 9------------NC
LCD PIN 10----------NC
LCD PIN 11----------D5 of arduino
LCD PIN 12----------D4 of arduino
LCD PIN 13----------D3 of arduino
LCD PIN 14----------D2 of arduino
LCD PIN 15----------VCC
LCD PIN 16----------GND
Calculating Resistance Using Arduino Ohm Meter:
The working of this Resistance Meter is very simple and can be explained using a simple voltage divider network shown below.
From the voltage divider network of resistors R1 and R2,
Vout = Vin * R2 / (R1 + R2 )
From the above equation, we can deduce the value of R2 as
R2 = Vout * R1 / (Vin – Vout)
Where R1 = known resistance
R2 = Unknown resistance
Vin = voltage produced at the 5V pin of Arduino
Vout = voltage at R2 with respect to ground.
Note: the value of known resistance (R1) chosen is 470Ω, but the users should replace it with the resistance value of resistor they have chosen.
The Code:
#include <LiquidCrystal.h>
//LiquidCrystal(rs, sc, d4, d5, d6, d7) LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int analogPin = 0;
int analogval = 0; int vin = 5;
float buff = 0; float vout = 0; float R1 = 0; float R2 = 470;
void setup() { lcd.begin(16, 2); }
void loop() {
analogval = analogRead(analogPin); if (analogval) { buff = analogval * vin; vout = (buff) / 1024.0;
if (vout > 0.9) { buff = (vin / vout) - 1; R1 = R2 * buff; lcd.setCursor(0, 0); lcd.print(" -Resistance-"); lcd.setCursor(0, 1);
if ((R1) > 999) { lcd.print(" "); lcd.print(R1 / 1000); lcd.print("K ohm"); } else { lcd.print(" "); lcd.print(round(R1)); lcd.print(" ohm"); }
delay(1000); lcd.clear();
} else { lcd.setCursor(0, 0); lcd.print(" ! Put Resistor"); lcd.setCursor(0, 1);
} } }
Conclusion:
This circuit with the R1 being 470 ohm will work fine between 100Ohm to 2k ohm of resistances. You can change the value of the known resistance for higher values of unknown resistances.
Hope you liked this tutorial.
Consider supporting me on youtube .I am sure you won't be disappointed. youtube.com/creativestuff