### Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

I am trying to do real....etc measurement using  Allegro ACS712 module and the Voltage divider circuit explained in this amazing site.Load(40W bulb). The method i tried is, i want to combine ACS712 module and voltage divider circuit for energy measurement.

First i would like to show the reading i got:

-46.71 177.35 229.85 0.77 -0.26
-33.13 177.02 229.93 0.77 -0.19
-47.28 178.45 230.92 0.77 -0.26
-33.82 177.99 229.93 0.77 -0.19
-46.39 178.86 230.97 0.77 -0.26
-33.42 177.61 229.08 0.78 -0.19
-47.08 179.09 230.91 0.78 -0.26
-33.11 177.09 229.18 0.77 -0.19
-46.08 177.46 229.98 0.77 -0.26

Second:  The voltage readings are correct(i checked with a multimeter) but the real power became negative and so as a result the powerfactor. not only these but current is also wrong as "I" should have been =(40/230)=0.17Amps.

Code for ACS712(fully functional in hardware tested) and also the emonTX code(which i changed alittle bit because i wanted to try ACS712 module :) ) are attached below.

(i have 20Amp model) thats 100mV/Amp.(ACS712)

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

I suspect the power is negative because you've got it facing the wrong way, just flip it the other way relative to the wire you're monitoring, and it should swing positive.    That wouldn't show up in your ACS712 sketch, because it's doing an RMS, so you'll get a positive result regardless of which way it's facing, and without a voltage signal to reference to, it's impossible to say which way the current is flowing.

I'm not an EmonLib guru, but I'm not sure you need the changes you've made to it.  Before your changes, that code used a digital high pass filter (see step B) to remove the DC offset, which I'd imagine is a better approach than subtracting a hardcoded 512.  You'll need to calibrate the reading.  The calibration constant is the second argument you pass to current().   There are instructions in the Building Blocks section on how to calibrate.

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

Cheers!!! After changing the hardcoded sampleI= 512-analogRead(Ipin) instead of analogRead(Ipin)-512 which you suggested(current direction sense for hall effect XD)
The Readings are as below:

45.77 47.65 245.16 0.19 0.96
45.86 48.10 245.15 0.20 0.95
46.33 48.25 246.23 0.20 0.96
45.06 47.33 245.27 0.19 0.95
46.47 48.17 246.18 0.20 0.96
45.88 47.92 245.05 0.20 0.96
46.01 48.00 245.04 0.20 0.96
45.82 48.06 245.16 0.20 0.95

NOTE: Above readings are stable closer to accurate but I am using a 40W bulb and my main Vrms=247V(code justified Vrms) and then Irms=(40/245)=0.16 (I guess, my current measurement didn't have enough samples because if my Irms=0.16 occured then my Pvi=245*0.16=39.2W(40W),Can you suggest about how to deal with this current issue for accuracy please!!).as a result my Preal is not equal to 40W and also my phasecal has to be changed(i'll takecare of it to make Preal=Pvi).

Thanks !!!

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

After changing the hardcoded sampleI= 512-analogRead(Ipin) instead of analogRead(Ipin)-512 which you suggested

I'm not sure I want to be credited with that suggestion.  I suggested you lose the 512, and use the high-pass filter that you commented out.  Those using a CT have the exact same problem as you do:  the signal swings around a mid-point, and that mid-point needs to be removed from the input.  They've solved that with a more sophisticated solution than subtracting 512.  Is there any reason you don't want to use the existing solution?  You seem happy to use it for the voltage signal, but not for the current signal.   Having said that, yes, flipping the sign of the current reading has the exact same effect as flipping the sensor 180°,  and depending on your physical installation, may well be easier.

Can you suggest about how to deal with this current issue for accuracy please

Yep, just follow the steps here:  http://openenergymonitor.org/emon/buildingblocks/calibration

P.S.  You might want to verify that your 40W bulb is exactly 40W before you calibrate to it.  Bulbs vary a lot.

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

And I suggest using a resistive load much larger - one that draws a current that is about 50% - 75% of the maximum current of your CT, if that is possible - for calibration.

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

You seem happy to use it for the voltage signal, but not for the current signal

yes, because i happen to have ACS712 module ready with me and more over the "main reason" is the CT has a jack at its end and unfortunately all my controllers doesn't have any means for jack pin to be connected. i can't buy a controller just because i need it to be connected for CT. Please suggest if you have any ideas regarding this(with some reference links to learn from).

Can you suggest about how to deal with this current issue for accuracy please

Yep, just follow the steps here:  http://openenergymonitor.org/emon/buildingblocks/calibration

P.S.  You might want to verify that your 40W bulb is exactly 40W before you calibrate to it.  Bulbs vary a lot.

Am working on this, will get back to you with some form of improved results. Thanks alot!!

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

@Robert

I tried the calibration and was only able to achieve a maximum of 0.96(powerfactor) on same 40Wbulb( sorry am away from college, can't get bigger loads any time soon). Can you tell from your experience, is it possible to achieve a powerfactor of 0.99 by changing phaseCal?? As far as my search goes, i found a powerfactor of 0.97 achieved from posts.

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

@dBc

Cheers!! after testing, i found out that both Vrms as well Irms(which i am worried about) are both correct!! and hence Pvi also should be correct. and powerfactor i am able to achieve around 0.96(but not 0.99 for some reason) and hence all readings are fine and ACS712 does its magic properly.
Do you know whether it is possible to achieve 0.99 powerfactor?(i mean is it supposed to be that accurate?

### Re: Real power is coming negative on a 40W bulb(load) when tried with Allegro ACS712 module and Voltage divider circuit

I have seen a pf of > 1.0 (but that was before an error in the sketch was corrected!). You can get a pf of 1.0, and I have sometimes changed the print statement to give more significant figures so that I can see whether it is exactly 1.0. (More often, it has been 0.996 or something like that.) But I do not think you will see a better power factor with a load that small, as errors in the CT will be significant.

But you can always make your ct think you have a larger load, by having a multi-turn primary winding. Normally, the primary winding is a single turn (a straight wire) but by having many turns, you multiply the current (and so the apparent size of your lamp load) by the number of turns. For example, to test the 100 A CT at 250 A, I used a 50-turn primary carrying 5 A. But you must be very careful of temperature rise if you try that, because 50 bunched conductors carrying 5 A will get very hot very quickly.

" You seem happy to use it for the voltage signal, but not for the current signal

If you do not use the high pass filter, any difference between the true average value of the input and the number you subtract (512?) will affect the accuracy of the power calculation and the rms calculations. What you use for the input transducer does not change that. Remember that the HP filter can remove less than 1 count of offset, as it works on floating point values.

yes, because i happen to have ACS712 module ready with me and more over the "main reason" is the CT has a jack at its end and unfortunately all my controllers doesn't have any means for jack pin to be connected. i can't buy a controller just because i need it to be connected for CT. Please suggest if you have any ideas regarding this(with some reference links to learn from)."

If you want to use a CT with an audio jack with a controller (what sort?) that has a different connector, you unsolder or cut off the jack plug. In the case of the YHDC range of CTs, connect only the red and white wires from the CT to the input of your controller.

## Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.