Help with the ACS712

Was wondering if anyone else had a problem with a 5A ACS712 from banggood? I bought some recently for a project and wanted to know if anyone else had some large fluctuations when reading them on you analog pins. At zero volts the range fluctuated +/- almost 30 counts. I saw some posts and videos about removing the offset (currently set to 504 on the code below) and then converting to amps, but original value read from the analog pin isn't tight enough to get a good reading. I could write some hysteresis code to try and average it out, but i wondered if there was some simple fix i was over looking. Thanks

float SensorValue = (504-analogRead(1))* 27.027 / 1023;

Have you looked at the actual current flow using an oscilloscope e.g using a series resistor.

Its quite possible what you are seeing are real variations in the current, caused by supple voltage variations, or load variations.

In which case, take multiple samples and average the result. Not you may need to use a rolling average method to avoid using precious sram

Roger,

Currently there is nothing plugged into the A1, this was just for me to calibrate and zero out the values returned.

(but maybe thats part of the problem)

I attached two pictures that show what i am talking about. The first just has the serial reading the A1 with nothing attached and the second is with the ACS712 attached but with no current running through the leads. There is a very even reading without it attached, but as much as a 20+ count swing when the ACS712 is attached to the analog pin. Thoughts?