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

17 comments

  1. Hi
    Thanks for this toturial… great work.
    I followed it but without the lcd . i wanted to check the voltage from serial monitor.
    the problem is that if use a multi-meter and take readings in the two ends of 1k resistor everything seems to work… when i am connecting it as you showing in the drawing to arduino ground then i can get no readings … it become zero
    arduino monitors shows also zero

  2. when you connect the usb port, the ground from your pc short circuits one of the tho inputs from the arduino because there is no galvanic isolation from the mains to your arduino. the shield on the USB is also the mains Ground

    1. Yes you shouldn’t connect the Arduino to PC! The Arduino should be powered from another source (for example external battery).
      Actually there’ll be no short circuit because there’s a resistor of 560k between the ground and mains line.

  3. i tried it 12c lcd, but in my case lcd shows the value 777 Volts even no pin connected to the A3, i change the pin to A1, but the result is the same

  4. Hello,

    Thank you for the project. What is the blue-lcd device part no. that you are demonstrating at the end of the video?

  5. The other problem that I have is that when the circuit is not conected to the source, it still shows me values not equal to 0 on the LCD screen

  6. Thanks a lot. I followed the tutorial and it worked fine. Why did you use 600 (Amplitude) for Vsine? I’m aware that the AC Frequency is 50Hz.

    Thanks.

  7. This project is VERY DANGEROUS

    NEVER connect mains level voltages direct to your projects. While this circuit will work (going by the comments) it incorporates a VERY DANGEROUS practice. Always use galvanic isolation like a transformer to isolate the mains supply from your projects – plug pack supplies are a good start as the dangerous mains voltages are contained within the ‘plug pack’ module. Be aware that using circuits that connect directly to can kill you if you make the smallest mistake in handling the project.

    With the galvanic isolation in place, you will have no problems connecting the micro to your computer via the USB port.

    I worked the electrical/electronics industry for over 30 years and was well aware of unsafe practices. Manufactures are also well aware of safety issues and go to great lengths to isolate the incoming mains voltages from the electronics in their devices and provide suitable insulation to ensure that it is impossible to touch any live part of the device.

    1. This is why I learned fast that you should NEVER trust anybody with brown skin on the internet when it comes to DIY. The lack of regards for safety or proper information is scary and should be outlawed.

  8. I think in case of galvanic isolation you should see a differential amplifier a simply lm358 would do the job

  9. The LM358 is standard Duel Operational Amplifier (OA) and does NOT provide any isolation (Galvanic or otherwise) that would make it suitable for this project. See my previous comments.

    The LM358 data sheet can be found at https://www.ti.com/sitesearch/docs/universalsearch.tsp?searchTerm=LM358#q=LM358&t=everything&linkId=1

    Re the question of measuring in 3 phase systems, it depends whether you are interested in the ‘phase – phase’ or ‘phase to neutral’ voltage, but the principle is still the same. In theory all 3 phases should be at the same voltage, but in practice there are slight variations though measuring one phase is usually sufficient for most purposes.

Leave a Reply

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