 In this project, we are going to make an AC Voltage Measuring Device using Arduino, which will measure the voltage of Alternating Current Supply at our home.  We are going to print that voltage on serial monitor of Arduino IDE as well as show on the multimeter.

Making a Digital Voltmeter is a lot easy than making an analog one because in case of analog voltmeter you must have good knowledge of physical parameters like torque, friction losses etc. whereas in case of digital voltmeter you can just use a LCD or LED matrix or even your laptop (as in this case) to print the voltage values for you. Here are some Digital Voltmeter Projects:

### Required Components:

1. One 12-0-12 transformer
2. 1N4007 diode
3. 1uf capacitor
4. Resistors 10k; 4.7k.
5. Zener diode(5v)
6. Arduino UNO
7. Connecting wires

### Arduino Voltmeter Circuit Diagram: Circuit Diagram for this Arduino Voltmeter is shown above.

Connections:

1. Connect high voltage side(220V) of transformer to the mains supply and low voltage(12v) to the voltage divider circuit.
2. Connect 10k resistor in series with 4.7k resistor but make sure to take voltage as input across 4.7k resistor.
3. Connect diode as shown.
4. Connect capacitor and zener diode across 4.7k
5. Connect a wire from n-terminal of diode to the analog pin A0 of Arduino.

** Note:  Do connect ground pin of Arduino to the point as shown in the figure or circuit will not work.    Need of voltage divider circuit?

As we are using 220/12 v transformer, we get 12 v on l.v side. Since this voltage is not suitable as input for Arduino we need a voltage divider circuit which can give suitable voltage value as input to Arduino

.

Why diode and capacitor is connected?

Since Arduino do not take negative voltage values as input, we first need to remove negative cycle of step down AC so that only positive voltage value is taken by Arduino. Hence diode is connected to rectify the step down voltage. Check our Half wave rectifier and Full wave Rectifier circuit to learn more about rectification.

This rectified voltage is not smooth as it contains large ripples which cannot give us any exact analog value. Hence capacitor is connected to smooth out the a.c signal.

Purpose of zener diode?

Arduino can get damage if voltage greater than 5v is fed to it. Hence a 5v zener diode is connected to ensure safety of Arduino which breakdowns in case this voltage exceeded 5v.

### Working of Arduino based AC Voltmeter:

1. Step down voltage is obtained on l.v side of transformer which is suitable to use across normal power rating resistors.

2. Then we get suitable voltage value across 4.7k resistor

Maximum voltage that can be measured is found by simulating this circuit on proteus (explained in simulation section).

3. Arduino takes this voltage as input from pin A0 in form of analog values between 0 to 1023. 0 being 0 volt and 1023 being 5v.

4. Arduino then converts this analog value into corresponding mains a.c. voltage by a formula. (Explained in code section).

### Simulation: Exact circuit is made in proteus and then simulated. To find maximum voltage that this circuit can measure hit and trial method is used.

On making alternator’s peak voltage 440 (311 r.m.s), voltage on pin A0 was found to be 5 volts i.e. maximum. Hence this circuit can measure maximum 311 r.m.s voltage.

Simulation is performed for various voltages between 220 r.m.s to 440v. ### Code Explanation:

Complete ArduinoVoltmeter Code is given at the end of this project and it is well explained through the comments. Here we are explaining few part of it.

m is the input analog value received on pin A0 i.e.,

`m=    pinMode (A0,INPUT) ;  // set pin a0 as input pin`

To assign variable n to this formula n=(m*.304177),  first some sort of calculations is performed by using the data obtained in simulation section:

As seen in simulation photograph, 5v or 1023 analog value is obtained at pin A0 when input a.c voltage is 311volts. Hence:

1023 analog value corresponds to 311 volt mains supply

So any random analog value corresponds to (311/1023)*m where m is obtained analog                value.

Hence we arrive at this formula:

n=(311/1023)*m volts or n=(m*.304177)

Now this voltage value is printed on the serial monitor by using serial commands as explained below. And also shown on the multimeter as demonstrated in the Video below.

Values printed on the screen are:

```Serial.print("   analog input  ") ; // this gives name which is “analog input”  to the printed analog value

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

Required a.c voltage as specified in the code:

``` Serial.print("   ac voltage  ") ; // this gives name  “ac voltage”  to the printed analog value

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

Code

int m;// initialise variable m
float n;//initialise variable n

void setup()
{
pinMode(A0,INPUT); // set pin a0 as input pin
Serial.begin(9600);// begin serial communication between arduino and pc
}

void loop()
{
n=(m* .304177);// converts analog value(x) into input ac supply value using this formula ( explained in woeking section)

Serial.print("   analaog input  " ) ; // specify name to the corresponding value to be printed
Serial.print(m) ; // print input analog value on serial monitor
Serial.print("   ac voltage  ") ; // specify name to the corresponding value to be printed
Serial.print(n) ; // prints the ac value on Serial monitor
Serial.println();
}

Video

Subscribe below to receive most popular news, articles and DIY projects from Circuit Digest

• Amr Sohil
Dec 22, 2017

Great work, i'm trying to add phase sequence detection using opamp & times , any thoughts ?

• tunu
Oct 18, 2018

Are you looking for a phase sequence meter, email me i have it all, circuit and codes

• Harry Wong
Dec 22, 2017

What simulation software did you use?

• pratik
Mar 20, 2018

can you help me to measure a.c. current using CT...which will in range from 0 to 30 amp.

• tunu
Oct 18, 2018

You need help for measuring AC signal, email me, i wil send you the codes and circuits

• Xian
Nov 26, 2018

• Rushikesh Manve
Mar 30, 2018

can we measure phase sequence using arduino?and how?

• tunu
Oct 18, 2018

Yes, it is possible, you need help just email me i have the codes and circuit

• Xyzz
Apr 06, 2018

If we increase the supply ac voltage above 230v for checking overvoltage condition using arduino, then with respect to that increased voltage will the arduino recognize the fault of overvoltage or will the input given to arduino will also change with respect to changed supply voltage???

• Aswinth Raj
Apr 10, 2018

Do not do it. The arduino will not recognize the over voltage and it might even damage your arduino

• Malefetsane
Apr 13, 2018

hi

van I use arduino to make over voltage load protection??

• Moch Rizky Maulana
May 07, 2018

good evening i wanna ask how the result can be stable in 234. i try to make this but the result cant stable. can you have solution or help me ?

• Aswinth Raj
May 09, 2018

If there is too much noise in you AC lines the result will not be stable. How much variation are you getting/.?

• Dmitry
May 23, 2018

Hello all! How to make it work at higher (40 kHz) frequency and lower (<5V ) voltage?

• Vikas D
Jun 06, 2018

Great work!!!!!
what is the specification for transformer ??
current and voltage

• Rudi
Jun 28, 2018

Why do you use a 220/12V transformer?

Would it not be more accurate if you made a voltage divider to divide 220V (or 240V?) to 5V?

• Aswinth Raj
Jul 04, 2018

No,

Voltage divider are used only for getting a voltage signal. It cannot be used as a power source. Meaning you cannot (should not) draw power from a voltage divider circuit.

• Colin Watters
Oct 26, 2018

The transformer is also for SAFETY reasons. If you use a potential divider connected directly to the mains voltage that would be very dangerous. One fault and the whole circuit could become live. In addition some countries have two live wires/phases instead of live and neutral. You cannot safely assume that "Neutral" is the same voltage as the 0V from the Arduino power supply or USB. Do NOT omit the transformer.

• Aug 08, 2018

Can I measure current milliampere range by this arrangement??

• Mari
Jan 02, 2019

Hello! How to set value of these transformer parameters in proteus for 220/12 V?

Primary Inductance

Secondary Inductance

Coupling Factor

Primary DC resistance

Secondary DC resistance

• Isuru
Apr 06, 2019

did u find the configurations for transformer?

• Isuru
Apr 06, 2019

Hey man,

what are configuration for transformer in proteus?

Primary Inductance

Secondary Inductance

Coupling Factor

Primary DC resistance

Secondary DC resistance

• Azkar
Oct 08, 2020

if i check directly on voltmeter it is showing 214 volts ... while on my serial monitor it is showing 311 volts... kindly help out