Simplified Arduino AC Current Measurement Using ACS712 Hall Effect Sensor





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

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


5 Amp Range Current Sensor Module ACS712 - 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)


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.


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.



  • Epilog Challenge 9

    Epilog Challenge 9
  • Pocket-Sized Contest

    Pocket-Sized Contest
  • Science of Cooking

    Science of Cooking

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




hi guys!

I am using ACS712 current sensor to measure AC current. It gives instantaneous values of the current wave but the samples are not be with equal time interval as well as the number of samples are differ for one cycle to another. Thus i want periodical samples to calculate the rms value of the current & i want a solution to increase the number of samples for a cycle.
Can any one help me?

Did anyone understand why window length is 20/testfrequency ?

Di you figured this out? :)

Unfortunately, not. : (

I guess that part is for the Filters Library."20/testfrequency" from my understanding it could also be represented as (20 x 1/testfrequency).


1/Frequency = Period

Period refers to the time required for one cycle to occur.

Going back to the sample code. The frequency is set to 60hz, it is because our mains line depending on location/country is either 50Hz or 60Hz. Now the mains being AC changes as time progress we wont be able to get a fixed value current as we can see on the oscilloscope the current will also be a sine wave. The way we could measure the current is taking the average of it.

So basically the code wants to get values in 20 cycles from the sensor reading. And the way it does is computing for the time needed for 20 cycles to occur and using it as a window time to gather the input data.

hey the code here works well but I am coming across the issue that the current values are not coming right when I try to exit the while() loop and get into other functions. Only when i stay in the loop indefinitely it is giving the right values. I tried using break: but the same problem persists. please suggest what I can do about this

I have adapted the code. I hope this helps:

the link is not working... can you kindly share it again?

Congratulations! This is very impressive and works very well!


i have sensor which measure upto 200 amps of current. i need to measure current of different appliances. for that i am using an arduino, but the problem is that the output of the sensor is AC, since ac current is to measured. the ac output of the sensor is given to the arduino. the problem is that the arduino is not able to read the amps .what should i do?

and if possible can you send me the code?