SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By azmiik
#95546
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.

Thanks for any ideas you may have.

Mike
By mattkenny
#95553
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.
By azmiik
#95714
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.

Mike
User avatar
By Volkemon
#104271
Hi!

I just got two of the ACS712 and wish to use them with an Arduino. I am up on the hardware end, but a bit shy on the math.

I would like to measure up to a 5amp draw at 110V 60hz mains. (South East USA)

I am not sure on the sampling rate, and how to process the readings I get. :roll: Other than that, I am set. :lol:

Thanks!!
By donnib
#130872
Volkemon wrote:Hi!

I just got two of the ACS712 and wish to use them with an Arduino. I am up on the hardware end, but a bit shy on the math.

I would like to measure up to a 5amp draw at 110V 60hz mains. (South East USA)

I am not sure on the sampling rate, and how to process the readings I get. :roll: Other than that, I am set. :lol:

Thanks!!
Did you find an answer for your questions ? I am interested in the same :)
By fll-freak
#130873
It all depends. (Stock answer #1)

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.
By elik745i
#164343
mattkenny wrote: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.
could you please post arduino code?
Thanks