Mesure DC curent of a motor using an arduino nano

Hi everyone

i am trying to mesure the curent of a 12v DC motor using an arduino nano. i usedthe diagram attached and this code

void setup() {

Serial.begin(9600);
}

void loop() {

float average = 0;
for(int i = 0; i < 1000; i++) {
average = average + (.044 * analogRead(A0) -3.78) / 1000;

//5A mode, if 20A or 30A mode, need to modify this formula to
//(.19 * analogRead(A0) -25) for 20A mode and
//(.044 * analogRead(A0) -3.78) for 30A mode

delay(1);
}
Serial.println(average);
}

instead of having the right value 12.92ma (measured by amperemeter) i am havung wrong negative values

Somebody can help me please

khalil_ab:
i am havung wrong negative values

If current goes negative, then swap the two wires connected to the screw terminal.

A 30Amp bi-directional hall sensor can't measure 13mA.
Resolution (measuring steps) with Arduino's 10-bit A/D is ~75mA.
Leo..