How to Measure AC Current Using Hall Effect Sensor With Arduino or Other Common Microcontrollers




Please see a new simpler approach here

Objective: This Instructable shows how making an interface box that, when spliced into an extension cord, allows common microcontrollers like Arduino to measure AC current as a DC voltage signal proportional to AC current. My specific application is measuring refrigerator energy usage.

The challenge: Measuring AC current with a microcontroller such as an Arduino would at first seem simple using readily available current sensor modules based on ACS712 IC - BUT ITS NOT.

ACS712 data sheet

After all, the module requires just 3 connections: +5 Vcc, ground, and analog voltage out. The problem is that measuring AC current with the ACS712 module yields a sine wave centered around 1/2 Vcc; the greater the current, the greater the peak-to-peak magnitude about the center line. Thus, the average voltage will always be 1/2 Vcc regardless of the current draw. This type a signal is not easily processed by the microcontroller's A/D function. Fortunately, with some signal conditioning, we can get a VDC signal that's portortional to the AC current drawn.

Please see YouTube video regarding how the signal conditioning works. I strongly recommend viewing the video before building this project

Results. The completed project allows AC current to be easily measured as a VDC signal and a microcontroller.

Props. Signal conditioning circuit original design by Lewis Lofin.

Original Loflin circuit

Warning. This project requires the construction of a moderately complex circuit in a tight space. If you're new to circuit construction, this is probably not a good first project.

Step 1: Parts and Tools


One each unless otherwise noted

  • Perf Board - Radio Shack dual mini board 276-148
  • Project enclosure 4 x 2 x 1" - Radio Shack 270-1802
  • 5 Amp Range Current Sensor Module ACS712 - or ebay. Also available in 20A and 30A versions
  • 3 wire AC power cord and plug - hardware store. The orange colored plug I used is GE #54283. The AC power cord came from my scrap box.
  • 3 conductor wire (for connection to Arduino or other microcontroler -length as needed)
  • Signal Diode 1N914
  • (3) 10Kohm resistors, (1) 47 10Kohm resistor, (1) 100Kohm resistor
  • 4.7 uF, 25V aluminum electrolytic capacitor radial leads
  • (2) 3-pin 0.1" Female header, (1) 3-pin 0.1" Male header
  • 10K trim pot -, ID: 356 or similar
  • JST-PH Battery Extension Cable - 500mm - Adafruit ID: 1131 or similar


  • Soldering iron
  • Multimeter to measure VDC and "Kill a Watt Meter", or similar to measure AC current (both are only needed for initial calibration)
  • Dremal or similar tool to cut away material from plastic enclosure.
  • Wire cutters
  • Screwdriver

Step 2: Build an Extension Cord With ACS712 Module in the Middle

See photo and diagram.

The terminals of the ACS712 module should connect "in series" to the extension cord hot wire. The hot wire connects to the skinny prong of the plug - it is usually a black wire. It doesn't matter which ACS712 module screw terminals connects with which wire lead.

I made my cord about 18 inches long, but you can make it longer if needed.

Step 3: Build, Test, and Calibrate the Signal Conditioning Circuit Board

See photo and circuit diagram.


Solder the components to the perf. board as shown. I used point to point wiring method.


a) Make the following connections:

  1. Signal Conditioning Circuit Board input side GND, Signal, and +5VDC lines to GND, OUT and VCC pins of ACS712 module
  2. Signal Conditioning Circuit Board output side GND +5VDC lines to 5VDC power source.
  3. Signal Conditioning Circuit Board output side GND and A/D pin lines to Multimeter set to VDC range.
  4. Extension cord female plug to a variable AC load - I used a 3 way light bulb (50W, 200W & 250W)
  5. Extension cord male Kill A Watt meter (set to AC Current range) which is then plugged into AC wall outlet.

b) Test method:

Gradually increase the AC load. The VDC at the multimeter should increase as the AC is increased, as should the Kill A Watt meter Amp readings.

Adjust the Trim Pot of the Signal Conditioning Circuit Board so that at with no AC load the VDC signal is around zero. You may not be able to get it all the way down to zero VDC. I got 0.463 VDC with no AC load.


Using the above test setup, apply a variable AC load and measure AC current load (AMPS) and the VDC signal output. (See the data table I recorded using the 3 way lightbulb mentioned above) This is your calibration data, with the volts being the "X" value and amps the"Y" value.

Plug this data into a spreadsheet or a pocket calculator with linear regression function to determine the trend line equation.

For my data, I got the following calibration equation using Excel:

y = 1.9545X - 0.8035

So for 1.0 VDC, the AC current would be 1.151 A

Step 4: Installation in Plastic Enclosure & Use


Cut down the vertical ribs as shown so that the circuit board will fit inside.

Cut 3 slots along the top edge as shown to hold the extension and signal cables in place. The slots should be a little shallow so that the lid kind of crimps the cables in place.

A small screw or hot glue will hold the signal conditioning board in place, the ACS 712 module is just held in place by the extension cord.

To Use.

Connect the AC load you wish to measure up to AC outlet using the extension cord and run the signal cable GND, +5VDC and A/D Pin lines into your microcontroller. Remember to convert the measure DC voltage value to AC Amps using your calibration equation.

Final Comment.

I find this device quite similar to a commercial product known as a "Powerswitch Tail," sold by and others. The Powerswitch Tail allows a microcontroller to easily and safely turn on AC loads, while the device I've shown here allows measurement of AC current loads, so perhaps this could be a commercial product someday?

Powerswitch Tail



    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest

    35 Discussions


    1 year ago

    The real thing man :)

    1 reply

    Reply 6 months ago

    interesting site, but as far as I can see, Harry loses the negative sine as I don' t see him offsetting the AC at all. His formula however is great.... if the 'zero crossing' had a 1/2Vcc (or 1/2 Vpp) offset


    1 year ago

    You strongly recommend watching the Youtube video first. I was not able to find a link to the video. Please help me out.


    1 year ago

    hi, i bought acs712 30A version sensor module trying to test on ac supply, it turns out that its Vout always giving some high values,( 28Vac passing a 5.6k ohm resistor load across the acs712, the current meter showing me around 25mA ) by using a voltmeter to test on the Vout, it shows me around 9Vac, was it due to the lack of signal conditioning circuit as above?

    Diedrich Vorberg

    1 year ago

    Hi, I’ve built this to spec, but I didn’t pay attention and bought the 30A ACS712 Sensor Module. With the OPAMP in place, I can barely measure the change in output voltage depending on the AC load. Is it possible to boost amplification? I don’t know a lot about electronics. Any help would be great!

    1 reply

    2 years ago

    Hi can it measure small current, let say around 10mA ?


    2 years ago

    What is the maximum current this circuit can measure? From the trend line I can see for maximum 5v reading it can go for max of 10 amps reading. Please confirm.

    1 reply

    Reply 2 years ago

    This would depend on the board used. 712 is a 10amp board but you can get up to 30am I've found.


    2 years ago

    so this tut is good and the only one I can find on the hall effect sensor but what I am trying to build is a circuit that will sense how much current is moving though a DC circuit then based on the value being over or under a predefined amount turn an led on or off.

    I am not sure on the specifics yet but will be looking at a 5v circuit with a small current.


    2 years ago

    how about the wave from acs712? can i see?


    Reply 3 years ago

    Do it in software. Cheeper then hardware.


    Measuring AC Current Using ACS712


    const int sensorIn = A0;

    int mVperAmp = 66; // use 100 for 20A Module and 185 for 5 Module

    double Voltage = 0;

    double VRMS = 0;

    double AmpsRMS = 0;

    void setup(){



    void loop()


    Voltage = getVPP();

    VRMS = (Voltage/2.0) *0.707;

    AmpsRMS = (VRMS * 1000)/mVperAmp;


    Serial.println(" Amps RMS");


    float getVPP()


    float result;

    int readValue; //value read from the sensor

    int maxValue = 0; // store max value here

    int minValue = 1023; // store min value here

    uint32_t start_time = millis();

    while((millis()-start_time) < 1000) //sample for 1 Sec


    readValue = analogRead(sensorIn);

    // see if you have a new maxValue

    if (readValue > maxValue)


    /*record the maximum sensor value*/

    maxValue = readValue;


    if (readValue < minValue)


    /*record the maximum sensor value*/

    minValue = readValue;



    // Subtract min from max

    result = ((maxValue - minValue) * 5.0)/1023.0;

    return result;



    Reply 3 years ago

    Thanks for the idea, I tried the code you suggest, using int mVperAmp = 185; for my 5 amp ACS712 sensor.

    With no current draw - that is the AC power line disconnected, the code results were 0.27 to 0.35 amps RMS, with 50W incandescent bulb load (0.43 amps per Kill a watt meter) the code result was 0.49 to 0.53 amps RMS, with 200W incandescent bulb (1.75 to 1.81 amps per kill a watt meter) the code result was 1.39 to 1.48 amps RMS, and with 250W incandescent bulb (2.17 to 2.19 amps per Kill a watt meter) the code result was 1.68 to 1.72 amps RMS.

    My household AC line voltage was about 125 VAC per Kill a Watt meter. My Arduino UNO was powered by the USB port of my computer.

    I had a 2nd AS712 module, so I repeated the test with nearly identical results.

    So my conclusion is the code results are too high at no or low current and too low at higher current levels - least in my real world testing. Perhaps the code would work better if a had laboratory grade household AC power in my house.


    Reply 3 years ago

    In the source sketch is used 1024, and why do not you use the coefficient?


    Reply 3 years ago

    This code you have written is for which controller ?

    Can you please provide code for pic18f4550 or any source or reference for the same.


    Reply 3 years ago

    The set h came from here.