EmonLib at no load doesn't give zero current readings

Hello, I am building an energy meter for a project.
I used ACS712 5A module,


this is the code I used

> // EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance
void setup()
{  
  Serial.begin(9600);
  
  emon1.current(A0, 5.405);             // Current: input pin, calibration.
}
void loop()
{
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
  Serial.print("current is");
  //Serial.println(Irms*230.0);
  //Serial.println(" ");
  Serial.println(Irms);  // Irms

I used current callibration at 5.405 because ACS712 has 185mV/A and from the openenergy I found that for a voltage type sensor Current/VOltage will give the current callibration constant.

The problem is, at no load it gives these readings

current is 0.13
current is 0.13
current is 0.13
current is 0.13
current is 0.13
current is 0.13
current is 0.13
current is 0.13

and when I am using a load, 75 watt lamp it gives these readings

current is 0.36
current is 0.36
current is 0.35
current is 0.36
current is 0.36
current is 0.36
current is 0.36

and using a clamp meter i found the current to be 0.42 Amps.

I have been going crazy, I would extremely appreciate if someone would help me and tell me how to get zero current readings at no load.

Your calibration seems to be correct, those numbers indicate that you have about 25 mV of noise at the output of your ACS712 / the input of your (presumably) Arduino.

I would first look to your power supply. Is it providing a clean, noise-free voltage? Depending on where you sourced your Arduino, you might find that using the on-board regulator or not makes a difference. Search this forum - I am sure it has been mentioned (and if not, search “Archived”).

Have you got the filter and bypass capacitors CF and CBYP shown on the ACS712 data sheet?

If you disconnect the output of the ACS712 from the Arduino analogue input, what do you read?

I suggest you read the paragraph “Noise” on P.9 of the data sheet. That indicates that the readings you are seeing are close to the minimum current that the ACS712 can measure accurately.

Also, read p.13 with regard to using the filter pin to reduce noise.

First of all, thank you for you reply.
I am so sorry for late reply as my exams were going on.

I have this breakout module

it already has bypass and the filter capacitor in it.
After disconnecting acs712 from the input analouge I am getting garbage values.

So, it does look as if you are reading noise from the sensor combined with noise in the analogue input of your Arduino.
Have you tried a different power supply? Do you have access to an oscilloscope, which would allow you to look at the supply? If your power supply is good, there is, sadly, nothing that you can do about it.

Well I don’t have an oscilloscope right now but I am surely gonna try it tomorrow at the university and tell you the result.
I also wanted to ask you whether I should provide a supply from a dc source directly on the vin pin or through the usb port or through adaptor port?

I am not an expert on the various types of Arduino. There are posts either here or in the Archived section about this, which you should be able to find. Here is just one mention: Noise in Arduino based builds. | Archived Forum

If you’re putting it on a scope I’d go for whichever gives you the least ripple on your Vcc rail. For most Arduinos you’ll get the best ADC results by using the DC-in jack with a suitably high voltage for your Arduino specs. Most of them have pretty good linear regulators between the DC-in jack and the Vcc rail, that will reject most of the ripple coming out of your ~10V wall-wart.

If you plan to feed the Vcc rail directly with 5V which is typically what happens when you power it via USB (assuming a 5V Arduino), then your choice of 5V wall-wart becomes super critical. Any ripple in its output will be on your Vcc rail.

If you’re using a 3.3V Arduino, you’ll need to check how they derive their 3.3V rail.