ACS712 AC measurement questions

Hi,

I have a bunch of questions regarding the usage of ACS712 measurement accuracy (AC mains load).

The first one is simple:
PEAK to PEAK measure and correction factor.

My ACS is connected an Arduino UNO (5V, GND, A2).
No AC power is applied on IP+ and IP-, also these pins are short circuited to avoid floating values.
(I note that I have the same result with ACS connected to 220V mains but no load applied).
I expect to read the average value to be 512.
However, looping on the analog read (during at least 1 sec) and collecting the minimum and maximum value, I have something like:

Average: 511
Minimum: 510
Maximum: 513

Average: 511
Minimum: 510
Maximum: 513

This roughly means that the 0 offset incorrect.
I have the same issue with two different devices (one 5 Amps and one 30 Amps).

Does someone have the same experience?
Should I use a correction factor to adapt the rest measurement, for instance by adding 2 at the minimum sample and subtract 1 to the maximum one?

Next question will come later.

Thanks already

Robert

I expect to read the average value to be 512.

As the maximum reading on the Arduino is 1023, the reading at 2.5V output will be 511 and not 512. BTW, don't expect a standard UNO to be that accurate, at least not with the standard power options.

Should I use a correction factor to adapt the rest measurement, for instance by adding 2 at the minimum sample and subtract 1 to the maximum one?

No, just accept that the read value is accurate +/- 2. If you want a bit more accuracy power the Arduino directly with a stable 5V. If you want more accuracy use an external ADC with a higher resolution (and also a stabilized supply).
If you have a scope, connect it to the Arduino 5V pin and you'll see that the power isn't stable (straight line) in the ranges you expect it to be. Don't forget the measurement you get from the internal ADC is just the value of the fraction of the voltage applied to the AVCC pin of the MCU (which is identical to the voltage on the 5V pin on standard Arduinos).

darvade:
these pins are short circuited to avoid floating values.

I expect to read the average value to be 512.

This roughly means that the 0 offset incorrect.

:slight_smile: This is a hall sensor. It's current sensing element is a short straight wire past the chip.

An even set of possible values (1024) can never have a value that's exactly in the middle

A hall sensor is very noisy, so output voltage (VCC/2) is not extremely stable.
Look at the datasheet. You see a cap on pin6 of the sensor for noise management.
That can be a larger value for mains power applications.
Or average in software.
Try reading the sensor five times in a row, add the value every time to a total, and then divide by five.
Leo..

Regarding the first question, I agree that the sampling skew is not directly due to the ACS module but also to the precision and the stability of the Arduino UNO analog measure. However, the skew is quite stable depending of the ACS module (I practically loop on sampling collections over 2 seconds, recording the minimum and maximum value over the sampling time.)

Let me share my experience with power measurement using ACS712 (actually a Chinese SH150917 device with a 100nF VCC and 1nF Filter decoupling capacitors).

My purpose is to complete my house automation remote switches with the capability to measure the AC (220V/50Hz) power consumption.

The test environment:
I use a Arduino UNO connected to an ACS712 (I have a 05 and a 30 Amps models), which is in series with a power plug.
From the power plug, I start to measure the peak to peak analog signal when several light bulbs are connected.
I must admit a lack of “professional” environment (basic multimeter, no scope, weak connections, unstable power supply, etc…), so the following results may not considered as a benchmark but only as a good idea of the ACS measurement capability for hobbyist.

Now the calculation, used to measure the RMS current.
For analog signal: 5V = 1024 Samples
1 Sample is equal to 0,004882813 V

For different module sensitivity (peak to peak):

ACS712-05	185 mV/A	1 Sample = 0,026393581 A PtP
ACS712-20	100 mv/A 	1 Sample = 0,048828125 A PtP
ACS712-30	 66 mV/A 	1 Sample = 0,073982008 A PtP

RMS Calculation is (peak to peak value/2)*((sqrt 2)/2) or 0,353553391 multiplication factor
So for:

ACS712-05 (0,026393581 A PtP) - 1 Sample = 0,00933154  A RMS
ACS712-20 (0,048828125 A PtP) - 1 Sample = 0,017263349 A RMS
ACS712-30 (0,073982008 A PtP) - 1 Sample = 0,02615659  A RMS

Practically this means for power calculation (my mains voltage varies from 220 to 239 V):

Power for mains	220 V RMS  239 V RMS		
ACS712-05       2,1 W      2,2 W		
ACS712-20       3,8 W      4,1 W		
ACS712-30       5,8 w      6,3 W

First conclusion; the precision granularity of each ACS is limited to the above values.

Now the test.
For that I am using several Light (Incandescent, Economical and LED bulbs and also an air dryer with max power announced to be 1700W - 2000W).
The result are (note the the “No Load” value when the power is switched off):

Device ACS712-05     Amps          Pwr.220 V RMS Pwr.239 V RMS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
No Load              0,065321 A RMS   14,4 W       15,6 W
Air Dryer 3-2        N.A.
Lamp 75W             0,373262 A RMS   82,1 W       89,2 W
Lamp 60W             0,317272 A RMS   69,8 W	   75,8 W
Lamp 25W             0,167968 A RMS   37,0 W	   40,1 W
Lamp 11W - LED IKEA  0,102647 A RMS   22,6 W       24,5	W
Lamp 11W - LED ETHOS 0,214625 A RMS   47,2 W       51,3	W
Lamp 4W - LED Sensys 0,12131  A RMS   26,7 W       29,0	W
Lamp 4W - ECO IKEA   0,177299 A RMS   39,0 W       42,4	W
Lamp 3.1W - LED ARO  0,111978 A RMS   24,6 W       26,8	W

Device ACS712-30     Amps          Pwr.220 V RMS Pwr.239 V RMS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
No Load	             0,104626 A RMS    23,0 W     25,0 W
Air Dryer 3-2	     7,716194 A RMS  1697,6 W   1844,2 W
Lamp 75W             0,418505 A RMS    92,1 W    100,0 W
Lamp 60W             0,366192 A RMS    80,6 W     87,5 W
Lamp 25W             0,209253 A RMS    46,0 W     50,0 W
Lamp 11W - LED IKEA  0,130783 A RMS    28,8 W     31,3 W
Lamp 11W - LED ETHOS 0,261566 A RMS    57,5 W     62,5 W
Lamp 4W - LED Sensys 0,15694  A RMS    34,5 W     37,5 W
Lamp 4W - ECO IKEA   0,209253 A RMS    46,0 W     50,0 W
Lamp 3.1W - LED ARO  0,130783 A RMS    28,8 W     31,3 W

Second conclusion, measures done with a 05 or 30 Amps module are quite similar if we take into account the difference with the “No Load” current (however extra precision should be obtain for low current!).

The third conclusion is that a “No Load” correction factor on all measures may be applied to have a better result.

Example using a correction factor on all measures:

Device ACS712-30     Amps               220 V RMS   239 V RMS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
No Load	             0        A RMS     0,0 W      0,0 W
Air Dryer 3-2        7,611567 A RMS  1674,5 W   1819,2 W
Lamp 75W             0,313879 A RMS    69,1 W     75,0 W
Lamp 60W             0,235409 A RMS    51,8 W     56,3 W
Lamp 25W             0,104626 A RMS    23,0 W     25,0 W
Lamp 11W - LED IKEA  0,026157 A RMS     5,8 W      6,3 W
Lamp 11W - LED ETHOS 0,15694  A RMS    34,5 W     37,5 W
Lamp 4W - LED Sensys 0,052313 A RMS    11,5 W     12,5 W
Lamp 4W - ECO IKEA   0,104626 A RMS    23,0 W     25,0 W
Lamp 3.1W - LED ARO  0,026157 A RMS     5,8 W      6,3 W

Fourth conclusion is that the measure is fairly correct for resistive loads (air dryer and incandescent bulbs).

Fifths conclusion is about load below 25W for which results are incoherent with the labels written on the bulb. Now these measures are made on non-resistive devices (LED and Economical ones) so perhaps.

  1. Some of these devices are in the limit of the measurement precision which is 6,3 W for an ACS712-30, therefore we may consider:
Lamp 11W - LED IKEA  0,026157 A RMS     5,8 W      6,3 W
Lamp 4W - LED Sensys 0,052313 A RMS    11,5 W     12,5 W
Lamp 3.1W - LED ARO  0,026157 A RMS     5,8 W      6,3 W

To be correct.
2. Most of these devices are “Made in China” and I suspect the marketing information a little bit cheating. In other words we should not trust too much the actual power indication on the bulb itself (only one “Lamp 11W IKEA” which has a clear power description 11W with 50 mA, seems to be correct).
3. Economic Lamp are clearly above the specifications ?
4. Or LED and Economic Lamps are so noisy that the 1nF filter capacitor is not enough (I will try to see if increasing this capacitor improves the measure. If this is the case, I hope my grid power meter as sufficient filtering capabilities :slight_smile:
5. For actual low current measurement, the measurement technique above is not adequate, and using a module such as SparkFun Low Current Sensor Breakout - ACS712 (see SparkFun Current Sensor Breakout - ACS723 (Low Current) - SEN-14544 - SparkFun Electronics) should be more appropriate, to improve sensitivity at low current.

My personal conclusions, for my specific environment are:

  1. It is useless to measure individual low power sources (less then 25W), if an overall result is necessary, a better way is to find a way to report on the data of the grid meter.
  2. It is useful to collect information over power hungry devices (wash machine, tumble dryer, etc..) to figure out the exact power consumption and the time of the day usage.
  3. These power hungry devices will probably use more than 5 Amps at peak period, so it is useless to use a ACS712-05, better is to use a ACS712-20 or 30 for this purpose.

I hope that someone else did the same test in order for me to validate / share my experience.

Robert

Not a lot of experience here with what you're doing.
Have a look at this site.

Level shifted AC into an A/D reduces the range of the A/D to "A/D resolution * 0.7 / 2", so max 358 values.
A 1697.6watt readout is not achievable with Arduino's A/D.

Word of warning. The ACS712 itself is only rated for 110volt AC, not for 230volt AC. The ACS758 is.
The circuit board it's on might not be rated for mains power at all.
If you're going to experiment with that, make sure you have polarised power plugs (some countries have not), and use the sensor in the neutral line.
Leo..

Leo,

Thanks to remember me the reactive aspect of non resistive loads, I will read the pointed article with interest and comeback with more questions if necessary.
Now, I have to figure out if using the ACS is the way to collect non resistive, no linear power.

Also, I don't understand your 358 values limitation, the ACS is furnishing from 0 to 5V linear information which is sampled in 1024 steps by the Arduino A/D (512 above and 512 below the middle point).
Actually the 1697,6 W which correspond to a 7,716194 Amps RMS is well in the range of the ACS712-30 (30 amps) and correspond to the maximum power indicated on the air dryer.

Regarding the voltage limitation of the 712 model vs. the 758 one, I see nothing related to that in the data sheets, (but the 758 is for higher current, starting from 50 amps). The ACS module is in series, not in parallel with the mains, what is important for safety is the isolation between the output and the mains input.

Thanks for your feedback
Robert

darvade:
Also, I don't understand your 358 values limitation, the ACS is furnishing from 0 to 5V linear information which is sampled in 1024 steps by the Arduino A/D (512 above and 512 below the middle point).

True.
When measuring a sine wave, you have to "lift" the A/D input to mid-voltage, so you can measure positive going as well as negative going.
Both sine halves contain the same current information. That means you effectively only use half of the A/D (512 values).

A 5Amp ACS sensor can measure -5Amp DC to +5Amp DC.
That same sensor can only measure 3.5AmpAC.

  1. Because you only use half of the A/D.
  2. AC peaks are 1.414 times higher than DC.

So a +/- 30Amp DC sensor can only measure 30*0.7= 21Amp AC.
Not sure how I got the values, but voltage swing of the ACS is not the full 0-5volt.
Therefore you use less than 512 values (steps, resolution) over the current range.

As for the voltage limitation, look in the datasheet.
I see a working voltage of 184volt DC (~128AC) for double isolated use.
I think that means ungrounded Arduino in e.g. a bathroom/laundry/kitchen environment.
Leo..