How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers

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

How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers

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

    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers

    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

    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers

    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:

  • Signal Conditioning Circuit Board input side GND, Signal, and +5VDC lines to GND, OUT and VCC pins of ACS712 module
  • Signal Conditioning Circuit Board output side GND +5VDC lines to 5VDC power source.
  • Signal Conditioning Circuit Board output side GND and A/D pin lines to Multimeter set to VDC range.
  • Extension cord female plug to a variable AC load - I used a 3 way light bulb (50W, 200W & 250W)
  • 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

    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers
    How to Measure AC Current using Hall Effect Sensor with Arduino or other common Microcontrollers

    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

  •  
     

    Tag cloud

    make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel