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
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:
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.
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.
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?