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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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.


shivakumar1995 (author)2017-04-04

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

AlvaroH8 (author)shivakumar19952017-04-25

I have adapted the code. I hope this helps:

Muhammad SaadB (author)AlvaroH82017-11-12

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

AlvaroH8 (author)2017-04-25

Did anyone understand why window length is 20/testfrequency ?

TomaszK8 (author)AlvaroH82017-10-11

Di you figured this out? :)

AlvaroH8 (author)TomaszK82017-10-11

Unfortunately, not. : (

AlvaroH8 (author)2017-04-25

Congratulations! This is very impressive and works very well!

rohan988 (author)2017-04-21


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?

Sherainne LouiseC (author)2017-03-08

Hello :) We really find this project really interesting and we are doing it for a project in our lab class :) may we ask if there is an alternative for the wireless remote control socket? can we use a simple socket adapter?

Kim Erso (author)2016-08-18

hello, i've been trying to find instructables like yours. i'm just curious how does the ACS712 limits the voltage and the current from an AC source. i have read other projects which do not recommend ACS712 for ac sources for which it can damage the arduino. thanks for your reply :)

smooth_jamie (author)Kim Erso2016-11-23

It doesn't limit the current or voltage, it uses the "Hall effect" i.e. the sensor samples the magnetic flux around the Current carrying conductor, not the current itself. Therefore the Arduino is isolated from the measured Current.

Exactly, its datasheet says that this sensor has been tested for 2100VAC dielectric strength.

amit.gaur.94009 (author)2017-03-01

You got it wrong, 8vdc is max power supply voltage for the sensor and you will be giving it 5v from arduino.

gordong25 (author)2017-02-05

HI, do you have an idea on how it will work on a DC power Supply? i have a load of 12W and i connected the load with a DC power Supply to test out with my ACS712 module . I have tried a few method but the test result of the currents value are incorrect . Can someone help me please.

gordong25 (author)gordong252017-02-06

sorry, its not a 12W load .Its a 5W load

Emmanuel2015 (author)2016-04-04

Hello, there is another way you might try, it's a signal detection to estimate the amplitude of the 50 or 60 Hz signal. This should be more precise than a simple RMS detection. I used it to detect very low intensities (like 0.1 A) with a hall detector inside a toroidal ferrite, where noise would prevail in the RMS estimate. Of course, it won't really matter with 'heavy' loads. If you're interested, I can send you the piece of code.

Hi do you mind sending the codes? :D Want to check them out!

HolgerP (author)Emmanuel20152016-05-25

hi, could you send your Code also to my pm?

Thanks a lot!


soilwork (author)Emmanuel20152016-04-06

Hi , I'm really interested in your code :), you can send me a PM

Emmanuel2015 (author)soilwork2016-04-06

hi, will do, I'll just have to translate the comments in English first...

soilwork (author)Emmanuel20152016-04-06

There's no need, spanish or english I speak both, any other language using google translator made things simple:P

ioCare ResearchT (author)2016-07-28


how exactly you calculated intercept and slope in excel?

FeatherMan made it! (author)2016-06-17

Made with AdaFruit Wifi Feather and OLED wing board and 20A ACS712 sensor.
Feather is running a 12bit ADC.
Not final packaging but proto with showing Amps on OLED screen against Multimeter.

duaner19 (author)2016-06-05


This did not work for me. I have an Mega 2560 Sainsmart (runs all arduino code) and if I use a baud rate of 57600, everything printed out is symbols and wingdings. Baud of 9600 shows amps at 0.23 and sigma at 8.20 when no current is flowing.

When I close circuit, i get the same values. I have all libraries called, just seems the code example may not work for my baud rate?

any help would be appreciated :/

EdgarEstrada (author)2016-05-15


I don't really care about measure amps, I just want to make sure all my water and air pumps are getting 127v, and if not, I can turn on the power gen.

Do you think this ACS712 can serve that purpose?


Orngrimm (author)2016-04-05

here is a idea to increase resolution in the lower currents, gaining precision there and don't loose the big dynamics (up to the chosen 5amps):

I made a master-project for current sensing in the DC domain 20microamps to 4amps with a error of 2% or less. I managed this by using different sensors: 8 calibrated sensors and for every measurement (one every 0.1milisecs, measurement-f=10kHz) I picked the lowest sensor which wasn't in saturation. this way I got the best precision from the best sensor for the current at this time of 0.1ms)

the same scheme could be applied here: use different ranged hall-Sensors and read all values. Then pick the most sensible sensor which is not in saturation already.
this would give you a big precision-boost for sure...

About This Instructable




More by e024576:Small Parts Rack From Repurposed Chick-Fil-A Fruit CupsMagnetically Attached Small Part BinsArduino Controlled Game: Pong-Bot Vs Human
Add instructable to: