Measure AC Voltage with Arduino – AC Voltmeter

This post shows how to build a simple AC voltmeter that measure AC voltage with Arduino UNO board where voltage value is printed on 16×2 LCD screen.
This voltmeter can easily measure 110/220/380V AC voltages with frequency of 50 or 60Hz.

No warranty is provided with this project, do it at your own risk!

Hardware Required:
This is a list of all components required to build this project.

  • Arduino UNO board   —-> Atmega328P datasheet
  • 16×2 LCD screen
  • 330 ohm resistor
  • 10k ohm variable resistor or potentiometer
  • 4 x 220k ohm resistor
  • 120k ohm resistor
  • 1k ohm
  • 100nF ceramic capacitor
  • 1N4733A 5.1V Zener diode (or equivalent)
  • 1N4007 diode (or equivalent)
  • Breadboard
  • Jumper wires

Arduino AC voltage RMS value hardware circuit

Arduino AC voltmeter circuit:
The image below shows project circuit diagram.

Arduino AC voltmeter circuit

The AC input is connected to the circuit as shown where diode 1N4007 is used to eliminate the negative half cycles.
After we get the positive parts of the AC voltage signal, it enters to a voltage divider because the Arduino UNO board can’t deal with voltages higher than 5V. The voltage divider is composed of 4 x 220k ohm resistors, 1 x 120k ohm resistor and 1 x 1k ohm resistor, so the impedance of this voltmeter is about 1M ohm (mega-ohm).

The Arduino reads the voltage across the 1k ohm resistor which is equal to the input voltage divided by 1001k ohm (voltage divider equation).
So, if the input voltage is 220V then the voltage across the 1k ohm resistor is 0.220V = 220mV (RMS values).

The 100nF ceramic capacitor is used to stabilize and eliminate noise of voltage signal across the 1k resistor. The 1N4733A Zener diode (reverse-breakdown voltage is 5.1V) is used to protect the Arduino board from voltages higher than 5.1V.

The 16×2 LCD screen (2 rows and 16 columns) is used to display the value of the input voltage where:
RS —> Arduino digital pin 2
E   —> Arduino digital pin 3
D4 —> Arduino digital pin 4
D5 —> Arduino digital pin 5
D6 —> Arduino digital pin 6
D7 —> Arduino digital pin 7
VSS, RW, D0, D1, D2, D3 and K are connected to Arduino GND,
VEE to the 10k ohm variable resistor (or potentiometer) output,
VDD to Arduino 5V and A to Arduino 5V through 330 ohm resistor.

VEE pin is used to control the contrast of the LCD. A (anode) and K (cathode) are the back light LED pins.

Arduino AC voltmeter code:
The following Arduino code measures the RMS value of the input AC voltage by detecting the maximum value of the half wave and then divide it by square root of 2 (√2).
So: Vrms = Vmax/√2

The Arduino detects the maximum value by reading analog voltage on channel 3 (A3) multiple times.
The function get_max() reads channel A3 voltage 100 times during period of more than 20ms (because for frequency of 50Hz the period is 20ms).

In this project the Arduino actually doesn’t give the True RMS of the input AC voltage because it uses the function: Vrms = Vmax/√2
That means the Arduino will give a correct measurement for a sine wave AC voltage input only!

Full Arduino code:

The video below shows a protoboard circuit of the project:

And this one shows Proteus simulation:

Proteus simulation file download (use Proteus version 8.8 or higher to open it!):
Arduino AC voltmeter

One comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.