How to make voltmeter using Arduino

ABOUT THIS PROJECT

About

This project is about the simple hack of voltmeter by Arduino. The main reason behind making this is from my personal experience, when I was performing one experiment in the lab, I could not find a voltmeter so I made this hack to fulfill my requirement and also I think it will help others too.

Good project for beginners which uses basic concepts, yet a power full tool.

While running the code, you can find the output on the serial monitor.


Calculating Voltage

Formula for calculating voltage:

Vout = (Val * 5.0) / 1024.00;

Here in these formula Val is the value that is read by Arduino as analog input, which is further multiplied by the voltage that is been supplied by Arduino and thus to get the Vout it is divided by the cycle of time that is covered after every bit to get the value.

Vin = Vout / (R2/R1+R2)

By this formula we can find the Vin that will be around 0, which indirectly means we are creating ground.

NOTE: Here there is no restriction on using the specified amount of resistors, one can vary it according to the availability of the resistors.

Final Advice

If one has resistor of resistance say R ohm and other is R' ohm, then just one needs to change the const in the code.

Warning: Make sure that you don't mess with the anode and cathode part during testing, it may damage Arduino Board.

Components Required

1. Arduino UNO / NANO

2. 16x2 LCD Display

3. 10K Preset.

4. 100K Resistor.

5. 10K Resistor.

6. DC Supply.


Circuit Diagram



 Arduino coding 

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

int analogInput = 0;

float vout = 0.0;

float vin = 0.0;

float R1 = 100000.0; // resistance of R1 (100K)

float R2 = 10000.0; // resistance of R2 (10K)

int value = 0;

int a[5] = {};

void setup() {

  Serial.begin(9600);

  pinMode(analogInput, INPUT);

  lcd.begin(16, 2);

  lcd.setCursor(0, 0);

  lcd.print("Welcome.");

  lcd.setCursor(0, 1);

  lcd.print("RC Invention");

  delay(5000);

  lcd.clear();


}

void loop() {

  lcd.print("Chack DC Voltage");

  // read the value at analog input

  value = analogRead(analogInput);

  vout = (value * 5) / 1024.0;

  vin = vout / (R2 / (R1 + R2));

  Serial.println(vin);

  if (vin < 0.09)

  {

    vin = 0.0;

  }

  lcd.setCursor(0, 1);

  lcd.print("Voltage V :");

  lcd.print(vin);

  delay(3000);

  lcd.clear();

}

Comments

Popular posts from this blog

How to make talking Voltmeter at home

how to make taking distance measurement device using Arduino and ultrasonic sensor