loading

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.

<p>hey</p><p>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?</p><p>and if possible can you send me the code?</p>
<p>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</p>
<p>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?</p>
<p>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 :)</p>
<p>It doesn't limit the current or voltage, it uses the &quot;Hall effect&quot; 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.</p>
<p>Exactly, its datasheet says that this sensor has been tested for 2100VAC dielectric strength.</p>
<p>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.</p>
<p>sorry, its not a 12W load .Its a 5W load</p>
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.
<p>Hi do you mind sending the codes? :D Want to check them out!</p>
<p>hi, could you send your Code also to my pm?</p><p>Thanks a lot!</p><p>Holger</p>
Hi , I'm really interested in your code :), you can send me a PM
<p>hi, will do, I'll just have to translate the comments in English first... </p>
<p>There's no need, spanish or english I speak both, any other language using google translator made things simple:P</p>
<p>HI CAN YOU EXPLAIN CALIBRATION PART!</p><p>how exactly you calculated intercept and slope in excel?</p>
<p>Made with AdaFruit Wifi Feather and OLED wing board and 20A ACS712 sensor.<br>Feather is running a 12bit ADC.<br>Not final packaging but proto with showing Amps on OLED screen against Multimeter.</p>
<p>Hi,</p><p>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.</p><p>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?</p><p>any help would be appreciated :/</p>
<p>Hello!</p><p>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.</p><p>Do you think this ACS712 can serve that purpose?</p><p>Thanks!</p>
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):<br><br>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)<br><br>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.<br>this would give you a big precision-boost for sure...<br>

About This Instructable

44,179views

113favorites

License:

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