So I am working a little project that needs to detect current. Well it is even more simple then that. It just needs to detect if a circuit (110V) is live or not. So I though hey that ACS712 chip looks like it will do the trick and ordered one of the break out boards from here.
So I have it breadboarded up in the following manner.
IP+ - 110V out
IP- - 110V in
VCC - 5V rail
.1uF to GND
VOUT - A0 on Arduino
Filter - 1nF jumped to GND
GND - GND
Now it does work. I can see a change in the reading over serial.
My big question is there a way to reduce the amount of jitter.
With no current passing I get an analog reading of between 510 and 515ish. With a current running through it I get readings in the realm of 512 ± 100.
What I really need is a way to have the effect of a pull up resistor on a digital pin is my guess.
Are you sure it’s jitter? The ACS712 outputs the instantaneous current, not the RMS current. So for an AC signal, you should see it oscillating about 512.
I use the 20amp version of this chip and it works really well for detecting current draw on an AC machine (240V here in Aus). I sample it at 1000Hz, which means 20 points per cycle (50Hz here), and calculate the RMS each cycle. The value I obtain matches what I get on a true RMS meter.
You know I was completely forgetting about the negative part of AC. My n00bness seems to know no bounds. Thanks I have implemented an averaging method that seems to have fixed my problems.
If you want an extremely precise value of RMS current you need to sample and perform the RMS averaging at an infinitely fast rate. As you slow down, you incur more error. How fast/slow you go is based on the amount of error you can tolerate.
If you JUST want to know if you have a current flow, then a minimum of twice the line frequency is needed but I would recommend at lease 4x. On the Arduino, just sample as fast as you can. From each sample subtract any bias and then take the absolute value to fold the negative current flow into the positive. Now sum these values to a running total. Every few hundred samples divide by the number of samples. If this average is above some threshold, you have current flowing. If not your circuit is off.
mattkenny:
Are you sure it’s jitter? The ACS712 outputs the instantaneous current, not the RMS current. So for an AC signal, you should see it oscillating about 512.
I use the 20amp version of this chip and it works really well for detecting current draw on an AC machine (240V here in Aus). I sample it at 1000Hz, which means 20 points per cycle (50Hz here), and calculate the RMS each cycle. The value I obtain matches what I get on a true RMS meter.