Ac current measurement using acs712 hall effect current sensor and Arduino. In this tutorial, you will learn how to design alternating current measurement system using acs712 hall effect current sensor and Arduino Uno R3. But you can apply same concept to Arduino mega, pic microcontroller, 8051 microcontroller or avr microcontroller. you just need make change in code but the rest of the concept will remain same. In my last tutorial, I have shown how to measure dc current using acs712 current sensor. In that tutorial, I have also explained introduction to acs712 hall effect current sensor, working of current sensor and how to measure current from hall effect sensor. I will apply same concepts in this article to measure ac current with acs712 hall effect current sensor. you may also like to read how to measure ac voltage using Arduino.
How to measure ac current with acs712 hall effect current sensor
As I have discussed in my last article, acs712 current sensor converts input current into proportional voltage depending on nature of the input current. If input current is dc, the output voltage of current sensor will be dc also. if input current to current sensor is ac, the output voltage of current sensor will be also alternating voltage. Shape of output voltage depend on the shape of input current. if shape of input current is sine wave, then the shape of output voltage will be also sine wave which is usually happens in case of ac current. The pin out of hall effect current sensor is given below.
so we will get sine wave at the output of hall effect sensor. So we need a method to measure peak of sine wave and then we can convert this peak voltage back into rms voltage by simply multiplying it with square root of 2 which is the relationship between peak value and rms value of voltage. I have explained it more details in my last article on interfacing of acs712 hall effect current sensor with Arduino. I recommend you to read it first, if you want to understand, how to measure this output voltage and how to convert this output voltage back into current using Arduino.
Ac current measurement using acs712 current sensor and Arduino
Circuit diagram for ac current measurement using acs712 current and Arduino is given below:
Code for ac current measurement using acs712 current sensor
In above code, I have taken 500 samples of output voltage of current sensor and detect the peak value of sine wave. After detecting peak value of voltage, it is converted back into current using the sensitivity formula given in code.