I am making a project that involves AC current measurement from the Mains. I have done a bit of research and have found that the ACS712 can do this.
I would like to know the correct way of using this module so that it outputs analog data that my microcontroller can read(I would like to get the total WATTS) .
I will use http://www.ebay.com/itm/New-design-30A-range-Current-Sensor-Module-ACS712-Module-Arduino-module-/310506962976?pt=LH_DefaultDomain_0&hash=item484ba84020. I am assuming that incoming current will go to one of the screws, and the wire connected to the load , to the other one(correct me if i am wrong)
I read somewhere that capacitors are needed. Please tell me how, and why. Also tell me if the ground pin needs to be connected from the ground of the mains
The two screws go in series with the load (ie, imagine cutting one of supply wires, and putting one of the cut ends into each screw)
Ground pin does not need to be connected to line ground.
That board already has two caps on it though - it may already have whatever caps you need (don't know off the top of my head what you need other than bypass cap, which is present on the board)
It is not necessary to connect the GND pin to AC ground. The side with the screw terminals is electrically isolated from the other side.
Here is the manufacturer's page:
The output at 0A is Vcc/2. So if you are using a 5V Arduino, 0A will give you a count of about 511 on an analogRead.
The output will be the same waveform as the AC current. So you can't just take one reading at random, or you will get some random value equal to or less than the peak current. It is helpful to have some indication of zero crossing. You can simply look for the zero crossings (ie, data is at 511 or so) every half cycle. Take regular measurements and then take the readings between two full cycles and take the root-mean-square.
You might want to just take the peak current and divide by the square root of two, but that only works for a sine wave. And the current is very likely -not- a sine wave.
Square each measurement, add them together. Divide the sum by the number of measurements. Then take the square root of that number.
It is important that it be an integer number of full cycles, and that it be a fair number of samples. Enough so you are capturing at least 3 or 4 samples at the highest frequency content.
Page 37 (page 25 counting by page numbers):
Even better, using the Arduino to make power measurements:
I almost forgot - before you do any squaring and square rooting, you must convert the analogRead value into a floating point number and subtract 511 or whatever your zero point is. Or the math won't work.
So basically , I take the wire, cut into two, place the chip in between the two newly exposed wires, and I am done ?
that simple ?
Yes, cut the wires, strip, clamp under the screw terminals.
Ground and Vcc to your Arduino, and the output to an Arduino analog input. It is that simple, and it is completely isolated.