Project with wattmeter in Proteus works and in practice there is difference of values

In my project I'm using the current sensor ACS712 30A for measuring current. I tested on Proteus 8.6 sp3 and it works OK, but in practice (using protoboard) the sensor is showing current without any loads connected.

Here's the part of my code that deals with the ACS712 obs: I'm measuring AC current and using 220 V as voltage.

while(1)
{
char ACS[15];
char Corrente [15];
pino1 = 0;

for (i = 0; i < samples; i++)
{
}

current = pino1;
current = current / samples;
current = current * current;
current = sqrt(current);
current = current / 8.6f;

FloatToStr(current, Corrente);
potencia = (current * 220);
FloatToStr(potencia, ACS);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1, 1, "AMP =");
Lcd_Out(1, 7, Corrente);
Lcd_Out(2, 1, "P =");
Lcd_Out(2, 5, ACS);
Lcd_Out(2, 16, "W");
}

• "it's accusing current without any loads connected." - how much current is it 'accusing'? Jul 17, 2019 at 19:43

   pino1 = pino1+ ( ADC_Read(0) - 511.95  );


   current = pino1;