Readings from ACS712-30A is falling with in 10 minutes

Hi
I have a little sun project where im messuring the amps from my panel.
I brought a ACS712-30A and trying to read the values from it.

But when i start messure 500mA, it show's 578mA
and after 10 min it show's 430mA ?

is this normal ?

Here's my sketch:

int  sampletime=60; // sætter alle sample værdier så alle får samme antal samples

float  sample2, Amps=0.0;


  for(int i=0;i<sampletime;i++) 
    {
      sample2 = analogRead(solarCurrentSensor)*5.0/1023.0;    
      Amps = Amps + (sample2 -2.50)/0.061;   //    amps = (R - Z) * C
      delay(2);                                             //    where C = 5.0/(1024.0 * 0.185)
    }                                                          //    Amps= (sample2 - 2.50)* 5.0/(1023.0 * 0.066);

    if (Amps < 1.0)
      {Amps = 0.0;   //Så den ikke står og tror den laver strøm når der ikke er sol mere en for 10mA
       Serial.print("Amps er under 0.1 og derfor 0" );
      }

    Amps=Amps/sampletime;   // hiv gennemsnittet 

    Serial.print("Read Amps and Show Amps ");
    Serial.println(Amps);

This is offcourse unaccecptable, so is there another current messure method, i can use ?

Thanks in advance.
Tim

Remarks.

If i disconnect it, for 2 min, and remove the load. (It should show 0 mA)

It first starts with 76mA. ??
if i connect the load, it will show 578mA (falling)

1 min 555mA
2 min 520mA
3 min 500mA
4 min 480mA
5 min 465mA
6 min 460mA
7 min 455mA
8 min 450mA
9 min 445mA
10 min 440mA
11 min 440mA
12 min 460mA
13 min 460min
14 min 460mA
15 min 450mA

And my fluke meter is rock steady at 500mA

If i remove the load after 15 min, it messure 0mA
Reconnect load = 500mA
remove for 10 sec 0mA
Reconnect load = 500mA 490mA (falling)
Power off to arduino Mega for 10 Sec, and power on (with out load) 0mA
connects load = 490mA (falling)

Any body else seen this problem ?

Br Tim

What if you don't compute the average of samples.Try to print the instant value to see what happens just for debug.Those sensors have an offset voltage of 2.5V @ 0 amps but perhaps it would be a good idea to use the full scale of the ADC not just half.You could do that using am Opamp ...

The sensitivity of the ASC712 30A is typical: 66mV/A, the noise is 7mV, so up to 100mA difference from actual reading is to be expected. Read the x30A PERFORMANCE CHARACTERISTICS from the data sheet for more info.
Also this line: sample2 = analogRead(solarCurrentSensor)*5.0/1023.0;
Is you Arduino exactly 5V? maybe 4.95V or 5.05V or it may fluctuate when loaded.

HugoPT:
What if you don't compute the average of samples.Try to print the instant value to see what happens just for debug.Those sensors have an offset voltage of 2.5V @ 0 amps but perhaps it would be a good idea to use the full scale of the ADC not just half.You could do that using am Opamp ...

Oki.... will try it. Thanks

elac:
The sensitivity of the ASC712 30A is typical: 66mV/A, the noise is 7mV, so up to 100mA difference from actual reading is to be expected. Read the x30A PERFORMANCE CHARACTERISTICS from the data sheet for more info.
Also this line: sample2 = analogRead(solarCurrentSensor)*5.0/1023.0;
Is you Arduino exactly 5V? maybe 4.95V or 5.05V or it may fluctuate when loaded.

Yep, is read. And im aware of the noise. But that shouldent made the reading take a down "walk".

hmm the supply is 4.98V and ACS712 at 0 mA is 2,493V

I will try to correct it. But still ..it's drifting over 10 min

HugoPT:
What if you don't compute the average of samples.Try to print the instant value to see what happens just for debug.Those sensors have an offset voltage of 2.5V @ 0 amps but perhaps it would be a good idea to use the full scale of the ADC not just half.You could do that using am Opamp ...

It's just fluctuating between 400mA and 780mA .... so it doesent work.

So is it to much to calculate with 10mA ?
would be easy just to calculate with 100mA

I could divide the sample with 100, so the result would only show in 100/00 mA.

Not 469mA but just 0.4A but then the calculations with watt aso, would be lost.
And i would not have solved my drifting problem.

Is there another sensor mark ?

With the 30A version reading >1A within 1/4A accuracy it is well suited for.
For small currents <1A try something like this.
It uses an Op-Amp like HugoPT suggested you try.
The schematic for the board is on the product page.
It's not very complicated to build your own low current board, use an ACS712 5A module and the PDIP version of the OPA344PA, Ti has samples of them. I've made a few boards with the Ti samples.

As for the sampling try this:

float sample2 = 0.0; // value read from sensor
float sample2Avg = 0.0; // averaged sample value
float solar_crnt = 0.0; // prepared current variable 
for (int i = 0; i < 150; i++)
  {
    sample2 += analogRead(solarCurrentSensor);
    delay(2);
  }
  sample2Avg = sample2 / 150.0;
  solar_crnt = sample2Avg*5.0/1023.0;

use that in conjunction with the rest of your calculations.

Could you post your full sketch and a schematic/drawing or picture of your setup.

I think the calculations is working fine. Its the ACS712 who have the problem.... its drifting, and i dont think a opamp would cure that. Basically it's just a small print with 1 resistor and 2 caps on.

problem is also that its not alway 2,493V at startup, somtimes it's 2,477V ??? and a 66mV/1A! its around 250mA

But i may have to buy a 5 Amps version. And if that one too, is drifting..... build my own as you mentioned.

Thanks