ac voltage measurement using Arduino: ac voltage detector

Ac voltage measurement using Arduino: In this article, we will see how to measure ac voltage using arduino and how to design ac voltage detector circuit using arduino uno r3 and how to design alternating voltage measurement sensor using a very simple technique and at the end, we will see how to write ac voltage / potential measurement code in arduino programming. So it will be a simple arduino based ac voltmeter which can measure 220 volt very easily and without any need of external sensor. I will start writing articles from this week on how to measure ac current , ac power, power factor using Arduino and I have already written a articles on all these topics using pic microcontroller. But on the request of users,I will be also writing these articles using Arduino. Check following articles which are based on pic microcontroller projectssimulation of ac voltage measurement using arduino

So now lets see how to measure ac voltage using Arduino and how to design ac voltage sensor using Arduino and I recommend you to check arduino tutorials and Arduino projects first, if you are a beginner in Arduino programming.

Components required for ac voltage measurement with Arduino

Followings are the main components required for the design of ac voltage detector with Arduino:

  • Arduino Uno R3: It is a main component of this project. It measures analog voltage with the help of built in analog channels and converter the analog measured voltage into digital value and then we convert this measure digital value back into voltage my multiplying it with resolution factor of Arduino ADC.
  • 16 x 2 LCD: Liquid crystal display is used to display measured voltage value. If you don’t know how to interface LCD with Arduino, I suggest you check this tutorial on lcd interfacing with Arduino.
  • difference amplifier: In this alternating voltage measurement method, difference amplifier is used to step down voltage from 220 volt ac to less than 3.3 volt ac. I will explain it in more detail in next section of this article.

How to design ac voltage measurement sensor?

To measure ac voltage with the help of Arduino, first of all you need to design alternating current voltage measurement sensor. First example if you want to measure voltage of magnitude 220 volt AC. you need to step down this voltage first. Because Arduino has built in ADC channels and maximum voltage that Arduino analog channel can measure is 5 volt. So we can not measure voltage greater than 5 volt with the help of Arduino directly. you should also know how to measure analog voltage with the help of Arduino or how to use analog channel of Arduino. if you don’t know, check this article on how to measure analog voltage with Arduino.

It will give you an idea on how to use analog channel of Arduino. Because it is a first step towards designing ac voltage sensor with Arduino and ac voltage detector meter with Arduino. As I have explained earlier, in this project I have used difference amplifier to step down voltage from 220 volt AC to less than 3.3 volt AC. Because built in ADC of Arduino can not measure voltage more than 5 volt. So we need to find a way to step down voltage. There are many other methods to step down voltage like potential transformer or step down transformer which is a expensive method for low cost applications. Voltage divider method, it is a least expensive method for this purpose. But it has disadvantage of less voltage range and more power consumption. So we can not use it critical power applications.

So I have come up with another method using operational amplifier. I have use operational amplifier for a step down purpose. Operational amplifier is used a difference amplifier. By adjusting the gain of operational amplifier, we step down the voltage to less than 3.3 volt. I have explained all the theory and working of difference amplifier for to step down ac voltage in separate article on ac voltage measurement using pic microcontroller. I recommend you to check it, if you want to get more understanding about this method.  Circuit diagram of difference amplifier is given below:

difference amplifier ac voltage measurement arduino

Input to difference amplifier is 220 volt ac and output of difference amplifier is less than 3.3 volt. I have also added 5 volt dc to ac to convert negative cycle into positive cycle. Because Arduino can not measure negative voltage directly. Again refer to the article on ac voltage measurement using pic microcontroller for more understanding and why I added 5 volt dc level to the circuit. Output of this circuit is fed to analog channel of Arduino which measures this voltage and after performing some calculations displays measured voltage value on LCD.

Video simulation in Proteus

Circuit diagram of AC voltage measurement using Arduino

buy code and simulation[/button-brown]

Circuit diagram of ac voltage measurement using Arduino is given below:

circuit diagram of ac voltage measurement using arduino

9 thoughts on “ac voltage measurement using Arduino: ac voltage detector”

  1. can you please send me the code of this ac voltage measurement circuit using arduino. I tried this circuit by in lcd i couldn’t get the voltage as you mentioned in the video. please help me.Giving my email below. Thanks

  2. I’m not sure about this method to become practical.
    This is a non-isolated method.
    it is better to use an optocoupler or transformer before to opamp to avoid electric shock and ground level difference

    • This method just works fine without any issue and I have implemented it many times. you will find this circuit in many modern inverters and power electronics circuits.
      Although it is good to have optocoupler and transformer, But it will make system device costly.

  3. You are right 😀.
    The reason behind that not just a 50 RS.
    The circuit shown in above figure has better accuracy and precision.
    Other circuits use a capacitor to filter ac components which is vulnerable to frequency.
    Frequency is very according to load.
    Please refer isolated opamps and ac voltage measuring ICs

  4. Hello Sir
    Yesterday i couldn’t reply you..i will tell what is the problem that i am facing when i am doing the project.. first of all i had referred your previous article ” Ac Voltage measurement using pic microcontroller “. I saw the code that you had given there for the ac voltage measurement using op-amp. i went through that code and i took the idea from there and i put it in my code.
    i am using ATmega328P as my MCU for this project. i am not using Arduino for my project because in Arduino also they are using the same controller. But i am using avr studio as my IDE. i will give the code here.. I test this circuit in the proteus simulation. The problem that i am facing is when i run the code it doesn’t show the voltage that i can see in your simulation.i will share the pic also. Kindly check the code and tell me if there is any fault i made.

    void ADCInit();
    int ReadADC(unsigned char);

    unsigned int Get_AD_Data=0,count=0;

    unsigned int Buff[30];

    float Sum_AD=0;

    volatile float Volt=0;

    void main()





    Get_AD_Data = ReadADC(0);
    Sum_AD = (Get_AD_Data * 10)/1024;
    Sum_AD -= 5.0;
    Buff[count] = Sum_AD*110.1909091;

    ADCSRA &=~(1<<ADEN);
    Volt = Buff[0];

    Volt = Buff[count];

    Volt *=0.707106781;

    ADCSRA |=(1<<ADEN);


    void ADCInit()

    int ReadADC(unsigned char ch)
    ch &=0x0f;
    ADMUX &= ch;
    while(!(ADCSRA & (1<<ADIF)));
    } """

    • Hi

      Unfortunately I do not have tutorial related to atmega,
      I will try to write about it in future

Leave a Comment