Introduction: Simplified Arduino AC Current Measurement Using ACS712 Hall Effect Sensor

This is a simplified approach to my prior Instructable regarding measuring AC current with the ACS712 current sensor..link

Simplifications include:

  1. Eliminating the special Signal Conditioning Circuit Board - instead we're going to use the "RunningStatistics" function available in the Ardunio Filters library. link
  2. Eliminating the need to build a special extension cord to "splice-in" the ACS712 Module, instead we'll be hacking an inexpensive wireless remote receiver outlet. link In addition to being much simpler, this approach results in a more compact, professional looking form factor.

As a review from my prior Instructable, the challenge with using the ACS712 sensor is that measuring AC current with the ACS712 module yields an output signal sine wave centered around 1/2 Vcc regardless of the AC current draw, only the peak-to-peak fluctuation about the center line increases as the AC current drawn increases (see photo of oscilloscope images). Thus, the Arduino normal "analogRead value" won't change regardless of the AC current being drawn. This is where the Arduino Filters library "Running Statistics" function's ability to measure the fluctuation comes in.

This Instructable assumes you're already familiar with Arduino programming and basic circuit wiring. Not counting the Arduino, part cost is only $10-$12.

Caution - You'll be working with AC household power which can be deadly if mishandled.

Step 1: Parts and Tools

Parts:

5 Amp Range Current Sensor Module ACS712 - Amazon.com or ebay (< $2 from Ebay, $4+ from Amazon). Also available in 20A and 30A versions

Hookup wire, solder, and wire jumpers

3-pin female connector

Indoor Wireless Remote Receiver - I used one from Menards (only $6.99 as of APR2016), but most any one should work - link

Arduino (I used an UNO)

Tools:

Small flat head screwdriver

Homemade tri-lobe screwdriver made from an old small shank screwdriver to open Wireless Remote Receiver - see next step for details.

Soldering iron, de-soldering braid

Wire cutters

Dremal or similar tool

Optional - a "Kill a Watt Meter", or similar to meter to measure AC current (only needed to double verify calibration)

Step 2: Opening the Wireless Remote Receiver

1. Since the receiver was held together with tri-lobe screws buried deep in a skinny hole, I modified a an old Phillips screwdriver using a Dremel abrasive wheel to match the tri-lobe screw (see photo). Unscrew tri-lobe screws and remove the remote receiver cover.

2. Next, unscrew the printed circuit board mounting screws and cut the three wires at the PCB. Find the two wires connected to the "split-leg" AC terminal and strip the ends. The 3rd wire is not needed - so cut it completely off.

Step 3: Test Mount the ACS712 Sensor and Connect to Arduino

1. Connect the ACS712 sensor screw terminals to the two wires you stripped in the previous step.

2. Connect jumper wires between the sensor board 3 pins and the Arduino as follows:

Sensor OUT to Arduino A0

Sensor VCC to Arduino 5V

Sensor GND to Arduino GND

Step 4: Download Library and Program Sketch Files to Arduino IDE & Intial Test

1. You'll need to install the Filters library to the Arduino IDE. General instructions for how to install libraries are here . You can get the Filters library from here.

2. Download AC_Sensor_Example.ino sketch to test AC sensor output.

3. Plug the sensor assembly into an AC power strip and connect an AC load such as a lamp to the AC socket as shown in photo.

As a reminder -

Caution - You'll be working with AC household power which can be deadly if mishandled.

4. Connect the Arduino to your computer and upload the AC_Sensor_Example. ino sketch, then open the IDE Serial Monitor, setting baud rate to 57600.

6. Without turning on any AC load, the serial monitor window output should look similar to the photo. The amp reading should be around 0.03 to 0.05 which is pretty close to the ideal 0.0 amps value.

7. Try increasing the AC load - the Ardunio Sensor measured amps should go up with increasing load up to the max sensor limit of 5 amps.

8. I tested with a 3-way 50/200/250 watt bulb. I also added a Kill-A-Watt meter to get AC current readings from it - see the Results table.

Step 5: Final Assembly

1. To create a more permanent connection, de-soldered the screw terminal and then soldered the AC wire leads directly to the board. Also solder 3 short wire leads to the underside of the board's 3 pin connector, solder the other end of these 3 wires to a female 3 pin connector. Secure the board in place with hot glue as shown. Color code the connector.

2. Using a Dremel or similar tool to cut a small slot (see photo) in the top cover of the Wireless Remote Receiver.

3. Route the female 3 pin connector thru the cover slot, re-attach the cover with the original tri-lobe screws, and secure the connector in place with hot glue.

4. That's it you're done.

Enjoy

Step 6: Optional Sensor Calibration

1. I calibrated the sensor by applying 0, 50, 200 & 250 Watt AC loads, and recorded the raw sigma value (a measure of the magnitude of signal fluctuation - see Introduction step) using the Arduino IDE serial monitor output with sketch AC-Sensor_Cal.ino.

2. The sketch produced raw sigma value readings about every second, and I ran each condition for about 1 minute. I copied and pasted the values from the Arduino IDE serial monitor into Excel column C and then manually added in column D the Kill-A_watt meter amp readings.

3. I excluded transient current spike values and then use Excel's Trendline function to generate a linear curve fit relationship between the raw sigma value and the Kill-A_watt meter amp readings.

4. Calibration results are baked into AC_Sensor_example.ino sketch lines:

float intercept = -0.1129; // to be adjusted based on calibration testing
float slope = 0.0405; // to be adjusted based on calibration testing

// convert signal sigma value to current in amps
current_amps = intercept + slope * inputStats.sigma();

5. Please feel free to repeat your own calibration test.

Robotics Contest 2016

Participated in the
Robotics Contest 2016