Menu Close

Arduino – Digital Voltmeter

This tutorial of Robo India explain, how to make voltmeter with Arduino.

1. Introduction:

Voltmeter is the device to measure voltage in any circuit. In this tutorial, we have designed a simple Arduino Digital Voltmeter, which can measure voltage upto 50V.

1.1 Working:

To measure voltage up to 5V , we can directly connect voltage to Analog pin of Arduino. And for voltage higher than 5V , we need to connect using voltage divider as the range of Analog pins of Arduino is 5V. Voltage Divider circuit consist two resistors of 100k and 10k. In order to get accurate output, the ratio of both resistors must be minimum.

For example, to measure 40V, the Ratio of R1/R2 must be greater than (40/5)-1.

To convert Analog output into Digital output, we have used Arduino ADC.

2. Hardware required

S.No.ItemQuantity
1.Arduino 1
2.Breadboard 1
3.Resistor 10k 1
4.Resistor 100k 1
5.Male to Female Jumper Wires 4
6.Male to male Jumper Wires 6
7.Power Source 1
8I2C Scanner LCD Backpack 1

3. Building Circuit

Voltage Range: 0-5V

Voltage Range: 5-50V

4. Programming-1: (0V to 5V)

You may download this arduino sketch (code) from here.

//Robo India tutorial on Arduino digital Voltmeter
//https://www.roboindia.com/tutorials/

#include <Wire.h>  
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20, 4);
float voltage = 0.0;
int input_val;

void setup() 
{
  lcd.init();
  lcd.backlight();        // makes Backligh ON. 
  lcd.clear();            // Clears LCD
  lcd.print("Arduino Voltage");     //display on LCD after code upload
  lcd.setCursor(6, 1);
  lcd.print("Meter");
  delay(2000);

}

void loop() 
{
   input_val = analogRead(A0);
   voltage = (input_val * 5.0) / 1024.0;   //conversion formula for voltage

   if (voltage < 0.1) 
   {
     voltage=0.0;
   } 
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Voltage = ");
    lcd.print(voltage);
    lcd.setCursor(14,0);
    lcd.print("V");
    delay(30);
}

5. Programming-2: (5V to 50V)

You may download this arduino sketch (code) from here.

//Robo India tutorial on Arduino digital Voltmeter
//https://www.roboindia.com/tutorials/

#include <Wire.h>  
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20, 4);
float voltage = 0.0;
float temp=0.0;
int input_val;
void setup() 
{
  lcd.init();
  lcd.backlight();        // makes Backligh ON. 
  lcd.clear();            // Clears LCD
  lcd.print("Arduino Voltage");     //display on LCD after code upload  
  lcd.setCursor(6, 1);
  lcd.print("Meter");
  delay(2000);
}

void loop() 
{
   input_val = analogRead(A0);
   temp = (input_val * 5.0) / 1024.0; //conversion formula for voltage

   voltage = temp/(0.0909);          //[R2/(R2+R1) R1=100k, R2=10k]
   if (voltage < 0.1) 
   {
     voltage=0.0;
   } 
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Voltage = ");
    lcd.print(voltage);
    lcd.setCursor(15,0);
    lcd.print("V");
    delay(30);
}

6. Output

Attached LCD displays the voltage.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply