Cannot measure current using Sensor ACS712 5A

Hello

I am doing a project which need to measure current and input to Arduino. I used the current sensor ACS712 (5A). The reading is very unstable, the sensor still gives reading when there is no current.
Increase/Decrease the current value, the sensor readings also very unstable.
Change to another ACS712, result same.

Partial of my coding

int ACS_offset = 2500;
int mVperAmp = 185;

Raw = analogRead(CurrentIn)
Volt = (Raw / 1023.0) * 5000;
Amp = ((Volt - ACS_offset) / mVperAmp);

Serial.println(Amp,6);

Thank you
Hu Dechang

DC or AC? the sensor is at VCC/2 V if measured current is 0 (to be able to measure 'negative' current)

Of course it’s unstable. Using six decimal places, you are trying to print resolution you do not have. What you are seeing are the effects of using floating point numbers. If you want to see how stable the actual measurement is, look at the raw analog counts.

You’ve got about 30 milliamps maximum resolution. Limit your print statement to two decimal places and see if that is stable. It will not be perfect but then you’re talking about a $1 sensor.

You’re also neglecting any zero offset the senor may have. Use a proper library and this will be handled for you.