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

171,992

104

37

Posted

Introduction: 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

Parts:

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 - Amazon.com 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)
  • LM358AN IC OPAMP
  • 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 - Adafruit.com, ID: 356 or similar
  • JST-PH Battery Extension Cable - 500mm - Adafruit ID: 1131 or similar

Tools:

  • 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.

Build.

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

Test.

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 plug.to 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.

Calibration.

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

Install.

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 Adafruit.com 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

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Paper Contest 2018

    Paper Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

34 Comments

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

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?

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!

Wrap the conductor around the sensor several times.

The real thing man :)

http://henrysbench.capnfatz.com/henrys-bench/arduino-current-measurements/acs712-arduino-ac-current-tutorial/

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

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.

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

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.