This is a project based on Arduino board which can measure the unknown AC and DC voltages. When we connect the unknown voltage on the breadboard circuit, the 16*2 LCD displays the voltage value. The project uses an Arduino pro mini board whose ADC feature is used along with the concept of Voltage Divider circuit to develop thisVoltmeter.

Fig. 1: Prototype of Arduino based AC Voltmeter
Architecture of the project
The entire project can be divided into three basic blocks;
1) AC/DC Voltage Sensor Unit
2) Processor Unit
3) Display Unit

Fig. 2: Block Diagram of Arduino based AC Voltmeter
The Sensor Unit takes two inputs, DC voltage and AC voltage. The Sensor Unit scales down the input DC and AC voltages into a DC voltage in the range of 0 to 5 V and provides the same as output.
The Processor Unit takes input voltage in the range of 0 to 5V. This unit takes the Sensor Unit’s output as input voltage and uses the ADC to read this voltage. An Algorithm is then applied tocalculate the voltage. The unit then sends a 4bit data to the Display Unit which includes the AC and DC voltage values.
The Display Unit takes the 4bit data from the Processor Unit and produces a 16x2 display for AC and DV voltages.
1) AC/DC Voltage Sensor Unit
A basic voltage divider circuit is used as the AC/DC Sensing Unit to scale down the input DC and AC voltages into a DC voltage in the range of 0 to 5 V. The Processor Unit can read this scaled down voltage and calculate the actual AC/DC voltages.
Design the value of R1:
Let us first select a maximum voltage that could be measured as 500V. When we apply 500V as ‘V’, the ‘V2’ should not be more than 5V and hence ‘V1’ will be 500 – 5 = 495V. At very high voltages like 495, the first thing to be taken care of is the power rating of the resistor. We are using resistors with the power rating 0.25W, and the power consumed by the resistor ‘R1’ should be less than this, otherwise the resistors get heated up and catch fire.
The equation for power is, P = V12 / R1.
Where;
P Power rating of the resistor
V Voltage across the resistor
R Resistance of the resistor
For the resistor R1 with power rating 0.25 W and 495 V across it,
0.25 = 495 * 495 / R1
Or, R1 = 980100 ohms, take 1 M ohm standard resistor.
Design the value of R2:
Now the value of R2 can be calculated using the previous equation, V = V2 * (1 + R1 / R2) as follows;
R2 = R1 / ((V / V2) – 1)
R2 = 1000000 / ((500 / 5) – 1)
R2 = 10101 ohms, take 10K ohm standard resistor.
DC voltage as input:

Fig. 3: Circuit Diagram of a typical voltage divider network used for sensing voltage
The voltage ‘V2’ is a fraction of the actual applied voltage ‘V’. The applied voltage ‘V’ can be calculated from the fraction of applied voltage ‘V2’ with the help of the following equation.
DC voltage, Vdc = V2 * (1 + (R1 / R2))
AC voltage as input:
When we are applying an AC voltage we use a rectifier diode in series with the Voltage divider circuit to prevent the negative cycles from entering the circuitry. No need for step down transformers because we are already getting a voltage ‘V2’ in the range of 0 to 5 V only, across R2.

Fig. 4: Image showing rectified output at Voltage Divider Circuit to avoid negative cycles
Requirement for Range selector:
We require multiple ranges in avoltmeter due to the error appears in readings because of Resistance Tolerance.
a) Decrease in the ratio of R1/R2 decreases the error
b) There is a limit beyond which the R1/R2 cannot decrease further:
To measure different values of V with minimum error we need different set of R1 with a common R2. The voltage V whose value need to be measured is connected with an R1 which gives the least ratio of R1/R2, taking care of the fact that V2 should not go above 5V range.
(R1 / R2) > (V / 5) – 1
For example to measure V = 500V, R1 / R2 > 99, hence we can use the set R1 = 1M and R2 = 10K which gives R1 / R2 = 100.

Fig. 5: Circuit Diagram of Voltage Sensor used in Voltmeter
Processor and Display Unit
2) Processor Unit
The processor unit in this project is the Arduino board and it uses the ADC module to read the output voltage from the Sensor Unit. In the Arduino board we are using an 8 channel, 10 bit ADC with the reference voltage pin connected to 5 V. The ADC reads the voltage V2 and generates an equivalent value ‘ValueADC‘at the ADC register.
The voltage output from the Sensor Unit V2 is calculated using the following equation;
V2 = ValueADC * VRESOLUTION
Where;
VRESOLUTION is the 'ADC Voltage Resolution' or the minimum voltage that the ADC can detect for a given reference voltage and given number of output bits.
Calculating for a ‘VREFRENCE’ of 5V and ‘RESOLUTION’ of 10 bits, we get the value
VRESOLUTION = 5V / 1024 = 4.88 milli Volts

Fig. 6: Overview of ADC Channels in Arduino Uno
Measuring DC voltage:
The code running in the Arduino obtains the ‘ValueADC’, which then used to calculate the voltage ‘V2’ with the help of following equation;
V2 = ValueADC * 4.88, milli Volts
The following section of the code calculates the maximum V2 voltage from 5000 voltage samples, taking multiple samples helps in obtaining maximum voltage of sinusoidal AC waveform.
for(sample_count = 0; sample_count < 5000; sample_count ++)
{
adc_value = analogRead(A0);
if(voltage_peak_value < adc_value)
voltage_peak_value = adc_value;
else;
delayMicroseconds(10);
}
dc_voltage_V0 = voltage_peak_value * 0.00488;
Once ‘V2’ is obtained the value of appliedAC or DC voltage ‘V’ is calculated using the known values of ‘R2’, ‘V2’ and ‘R1’ with the help of previously discussed equation;
DC voltage, Vdc = V2 * (1 + (R1 / R2))
The following section of the code calculates and displays the DC voltage for (R1/R2) = 10;
lcd.print(" DCV");
lcd.setCursor(0, 1);
lcd.print("50 ");
lcd.print(dc_voltage_V0 * 10 * range50_cal);
Measuring AC voltage:
The ADC of the Arduino then measures the maximum DC voltage or the Peak voltage ‘Vp’ of the AC waveform.
Vp = Vdcmax

Fig. 7: Image showing Peak Voltage on an AC Waveform
The Voltage of the sinusoidal AC voltage is then expressed in terms of its ‘Root Mean Square’ (RMS) value. The RMS is an equivalent DC voltage value corresponding to a sinusoidal AC waveform, which can provide the same amount of Power to a device as the sinusoidal AC voltage does.
The RMS value of the AC voltage VRMS can be calculated from the Peak voltage ‘Vp’ using the following equation;
AC voltage Vac = VRMS = Vp * 0.7071 = Vdcmax* 0.7071
The voltage drop at the rectifier diode also needs to be considered, hence
AC voltage Vac = Vdcmax* 0.7071 + 0.7
The following section of the code calculates the maximum V2 voltage from 5000 samples to obtaining maximum voltage of sinusoidal AC waveform.
for(sample_count = 0; sample_count < 5000; sample_count ++)
{
adc_value = analogRead(A0);
if(voltage_peak_value < adc_value)
voltage_peak_value = adc_value;
else;
delayMicroseconds(10);
}
dc_voltage_V0 = voltage_peak_value * 0.00488;
ac_voltage_V0 = dc_voltage_V0 / 1.414;
The following section of the code calculates and displays the DC voltage for the ratio of R1/R2 = 10;
lcd.print(" ACV");
lcd.setCursor(0, 1);
lcd.print("50 ");
lcd.print(dc_voltage_V0 * 10 * range50_cal);
3) 16x2 LCD module
This is a standard 16*2 LCD on which the Arduino displays the resistor value. The LCD has been wired in four bit mode to reduce the number of output pins of the Arduino board to be used.

Fig. 8: Typical Image of character LCD
Circuit and Code Description
Circuit Description

Fig. 9: Circuit Diagram of Display Unit, Range Selector and Voltage Sensor Circuits used in making AC Voltmeter
The complete circuit diagram of the Arduino based Voltmeter is given in which the voltage to be measured ‘V’ is connected across the Voltage Divider circuit whose ‘R1’ value can be selected using a range selector switch. In the following section let us discuss how to calculate the values of R1 and R2.
The voltage ranges are selected using the Function/Range selector switch as shown in the following table; Value 1 indicates switch closed and value 0 indicates switch open.
R2 | FUNCTION |
0 | DC VOLTAGE |
1 | AC VOLTAGE |
Code Description
The code continuously read the ADC register for a while to get the maximum value appearing. Using this maximum value the DC and AC voltages are calculated for all the voltage ranges.The code then displays the DC voltage and then the AC voltage on the 16*2 LCD. The code identifies the function and range to display by reading the values of Function/Range selector switch.
The code running in the Arduino used the library function analogRead() to obtain the ADC value and lcd.print() to display the data on 16*2 LCD.

Fig. 10: Flowchart representing Arduino Code used for measurement of AC voltage
Note :
When measuring high voltages, please ensure your safety.
.
Comments
how to separate the code for
how to separate the code for measure 500VAC?
In my project i need measure
In my project i need measure 120VAC! The voltmeter measure this value or the peak? The peak is 170VAC!!
It will measure Vp. That is
It will measure Vp. That is
Hi, thanks for share the
Hi, thanks for share the great project! how we use the function, range selector ? i notice there are two selector in the circuit, one for the voltage range with 4 selection, one with 5V supply but i not sure what to label and fucntion for them can you advice ?
HI I WANT TO MONITOR 220V AC.
HI
I WANT TO MONITOR 220V AC. WHAT RESISTOR VALUE SHOULD I USE?
Use a voltage dividor of 1m &
Hi Ajish Alfred,I have read
Hi Ajish Alfred,
I have read your project and I would like to built both circuits dvm volts and amps on home power supply. I really want to know what do I have to do to add both codes into one in order to have both information voltls and amps on the same LCD 16x2. I have some experience in electronics but I am starting with arduino codes and circuits, I mean, I am at 'Hello, world' level yet..
I really appreciate your help. If you need write me at: cad.rj.2015@gmail.com
Nice project, congratulations!!
Carlos
Hi, I forgot to say that I
Hi, I forgot to say that I use an arduino Uno R3 board.. regards
Hi,
Hi,
Hi,
Hi,
Hi,
Hi,
Hi,
Hi,
Hi,
Hi,
in 500VAC burn 1N4148???
in 500VAC burn 1N4148???
so long as the voltage
so long as the voltage potential between anode and cathode are within specs (75v i think) you should be ok ... ( to a point)
I'd use a 1n4007 or uf4007 in place of however
sir, i want mesure 230v ac
sir, i want mesure 230v ac 50hz supply by ardino with optocoupler for safty purposeand how to connect the optocoupler with the arduino
This isn't going to work if
This isn't going to work if you're measure voltage across a load though, or measuring voltage drop across some resistor. You need a really good and stable voltage attenuator instead of a resistor divider.
the resistor divider is an
the resistor divider is an attenuator and it will work quite well except, the AC inputs will be offset by the diodes forward drop, and the AC will do peak V and not RMS. If your waveform is badly distorted it will be quite a bit off. The diode drop can be adjusted out over a large range of inputs, and the RMS can be factored out if the input is a polite sine wave. You would do these corrections in software.
" No need for step down
" No need for step down transformers because we are already getting a voltage ‘V2’ in the range of 0 to 5 V only, across R2."
The other reason to use a step down transformer is to isolate the Aduino from the AC circuit. Of course that 'assumes' one uses an transformer that does not have a common ground between the primary and secondary coils.
if i need to measure 48V with
if i need to measure 48V with 65mAh thus above circuit work for me, and if yes how much will be the error percentage.
i just want to combine dvm
i just want to combine dvm ,dam with dom. Is itpossible by connecting the 3 indivitual circuits and then switching between them to get the desired output?
What are the Arduino to LCD
What are the Arduino to LCD pin connections ?
I want to submit project so
I want to submit project so please help me
i want to build a similar
i want to build a similar project that can measure 0-60Vdc and 0-600Vac with dual point measurement capability. The system must display at the same time both local and remote values. What can i add to enhance the circuitry to my requirements.
Hello Sir,Will anything worse
Hello Sir,
Will anything worse happens if we connect diode directly to 230 AC supply?
Will the diode withstand huge voltage?
Hello Sir,I tried the above
Hello Sir,
I tried the above circuit but I failed to get the output whenever I vary my AC input.I used a variable transformer to supply AC input and based on my AC input equivalent DC output was produced but in Arduino I did not get the actual output.Please help me