How To Make a Digital Voltmeter Using Arduino(Simplest)

Last updated on March 22nd, 2024 at 01:16 pm

Voltmeters are required in almost every sector of the electrical and electronics industry. And since Digital multimeters are easily available in the market, buying one is no big issue as it can measure all electrical quantities.

But the real problem arises when one wants to make an analog voltmeter because making one is not easy. Whereas a digital voltmeter can be made easily using a microcontroller (we will use Arduino for this purpose). Arduino will take step-down AC voltage as input and display the real AC voltage on the serial monitor. You can also use an LCD to display the voltage.

This circuit can measure AC voltage as high as 311 volts (r.m.s). It also protects the microcontroller if this AC voltage exceeds 311 volts.

If you prefer video tutorials instead, then watch this video:

Components

1. One 12 – 0 – 12 transformer

2. Resistor 10k, 4.7k.

4.7K RESISTOR
10K RESISTOR

3.  1N4007 diode

1N4007 Diode

4.  1uf capacitor

1uF Capacitor

5.  Zener diode(5V) 

Zener diode(5v)

6. Arduino UNO

7. Connecting wires

Circuit diagram

Below is the circuit diagram of the project:

Digital voltmeter circuit diagram

The high voltage side of the transformer should be connected to the direct AC supply, whereas the low voltage side(side and middle wire)  is connected to the voltage divider circuit.

The output from the 4.7 k resistor is connected to the diode which rectifies the step-down AC voltage and gives it to the 1UF capacitor which further removes any ripples present. This capacitor charges and provides an input voltage to the A0 pin of Arduino.

Note: Arduino cannot take negative voltage value as input since the negative voltage can damage Arduino. Hence, the input AC voltage must be rectified first. Thus, a diode is used to remove the negative voltage rail. After that, one uF capacitor removes the ripples present and thus provides the smooth voltage value to Arduino.

The Zener diode is used to protect Arduino from damage if the voltage across the capacitor exceeds 5v. When this happens, the Zener diode breaks down, and thus, all current flows through the Zener to the ground, thereby ensuring the safety of the Arduino.

Program

int x; 
float y;

void setup()
{
 pinMode(A0, INPUT);
 Serial.begin(9600); 
}

void loop()
{
  x = analogRead(A0);
  y = (x * .304177); 
  Serial.print("   analog input  ");
  Serial.print(x); 
  Serial.print("   ac voltage  ");
  Serial.print(y); 
}

Code explanation

  1. Variable x

X is the input analog value received (voltage) from pin A0 i.e.,

x =    pinMode (A0,INPUT) ;  // set pin A0 as input pin
  1. Variable y

The task of this variable is most important in the whole program i.e., to convert the input analog value into the actual AC voltage from mains. As in the code:

y= (m*.304177) ; // convert into ac voltage

x or actual analog value is multiplied by .304177 because of the following reason:

This exact circuit is simulated in Proteus and the maximum voltage is found out by hit and trial method:

simulation of the circuit
Simulation of the circuit showing analog value= 1023 corresponding to 311 volts (maximum)

So, by simulating the circuit, we observed that when input a.c voltage is 311 volts, 5 v or 1023 analog value is obtained at pin A0. This voltage is the maximum value that this circuit can measure. Above this voltage, the Zener diode will break down. Hence, 311-volt mains supply corresponds to 1023 analog value.

So, any random analog value obtained is equal to (311/1023)*x ac volts, where x is the obtained analog value.

Hence, we arrive at this formula:

y=(311/1023)x volts or y=(x.304177)

Working of digital voltmeter circuit

Step 1: Transformer steps down the input AC voltage.

Step 2: The voltage divider circuit ensures a voltage less than 5 v across the 4.7k resistor and hence maximum input a.c volts as already seen in the simulation must be 311 r.m.s volts.

Step 3: Arduino receives this voltage as an analog value from pin A0 and converts this value into the actual input a.c voltage by the formula:

y=(x*.304177)

Step 4: This value is printed on the serial monitor; thus, we get the required value of input a.c voltage.

Voltage value on multimeter for AC mains supply
Voltage value on multimeter for AC mains supply
Voltage value printed on screen for A.C mains supply

Note – Watch the video given at the beginning to see this code in action.

Printing required values on the screen

Two values are printed on the screen or serial monitor of Arduino IDE, as shown in the picture

Analog input value received by analog pin A0 as specified in the code:

Serial.print(”   analog input  “) ; // this command specify name on top of the values to be printed which is “ analog input”

Serial.print(x);// this simply prints the input analog value

Serial.print("   analog input  ") ; // this command specify name on top of the values to be printed which is “ analog input”

Serial.print(x);// this simply prints the input analog value

Actual value of AC voltage from mains as specified in the code:

Serial.print("   ac voltage  ") ; // this command specify  name on top of the values to be printed which is “ ac voltage”

Serial.print(y) ;  // this simply prints the ac voltage value

Photo of author

Ankit Negi

I am an electrical engineer by profession who loves to tinker with electronic devices and gadgets and have been doing so for over six years now. During this period, I have made many projects and helped thousands of students through my blog and YouTube videos. I am active on Linkedin.

3 thoughts on “How To Make a Digital Voltmeter Using Arduino(Simplest)”

  1. Hi my name is jatin patel I like the method that you did,But I wanted to know that how much 12-0-12 ampr required for it?

    Reply

Leave a Comment