Open In App

How to make digital voltmeter using Arduino?

Last Updated : 16 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Digital Voltmeter

Voltmeter is an instrument used to measure the potential difference or voltage (V) between two points of an electric circuit. Voltage is the potential difference between two points. It pushes charged electrons through conducting loop. It is also known as electric pressure, electromotive force or potential difference, etc. The voltage is indicated by a unit known as a volt (V). 

In this article, we will learn how to make a digital voltmeter using Arduino Uno R3.

Arduino

Arduino is an open-source electronics platform. It consists ATmega328P 8-bit Microcontroller. It can be able to read inputs from different sensors & we can send instructions to the microcontroller in the Arduino. It provides Arduino IDE to write code & connect the hardware devices like Arduino boards & sensors.

Voltmeter using Arduino

Arduino has analog pins to read analog input voltage and it can be converted into a digital value. For more information about Analog Read and Analog channels in Arduino, refer to this article.

The digital value is in the resolution of 2^N, for Arduino Uno R3 the resolution is 2^10 = 1024. Whereas Arduino Uno R3 has a 10-bit of Analog Digital Converter.

The digital value is in the range of 0 to 1023 for the voltage range of 0 to 5 Volts. 

Analog to Digital Conversion Formula

Digital value = ( Input Voltage / Reference voltage) * Resolution

For Arduino Uno R3,

Digital value = ( Input Voltage / 5) * 1023

If the input voltage to the analog channel is 2 Volts, The digital value can be calculated as follows.

Digital value = ( Input Voltage / 5) * 1023

                     = ( 2 / 5) * 1023

Digital value = 409

Digital value to Voltage Conversion

Input Voltage = ( Digital value / Resolution) * Reference voltage

For Arduino Uno R3,

Input Voltage = ( Digital value / 1023 ) * 5

If the digital value is 409, The input voltage can be calculated as follows.

Input voltage = ( Digital value / 1023 ) * 5

                      = ( 409 / 1023) *5

Input voltage = 1.999 = 2 volts (Approximately)

Components Required

  1. Arduino Uno R3
  2. Input voltage source ( 0 to 5 volts)
  3. Jumper wires

Circuit Setup

  1. Connect the positive terminal of the input voltage source to any of the analog pins of Arduino.
  2. Connect the negative terminal of input to the GND of the Arduino.

Note: Arduino can measure only in the range of 0 to 5 volts. If the input voltage is greater than 5 volts, the components of Arduino may be damaged.

Circuit Diagram

Voltmeter using Arduino

Arduino Code

C++




void setup()
{
  //Initialize serial monitor at 9600 baudrate
  Serial.begin(9600);
}
  
void loop()
{
  //Reading analog input from A0 pin
  int digitalValue = analogRead(0);
  //Converting digital value to voltage
  int voltage = (digitalValue*5)/1023;
    
  //Printing digital value in serial monitor
  Serial.print("Digital Value: ");
  Serial.print(digitalValue);
  //Printing measured input voltage in serial monitor
  Serial.print(", input voltage: ");
  Serial.println(voltage);
}


Output

Digital Voltmeter using Arduino



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads