Hi. This is my first post on the Forum.
Im building an amp meter using arduino and this sensor:
http://www.panucatt.com/files/datasheets/cs50_100_200a_datasheet.pdfIt´s a 100amp hall sensor and I made a sketch for read this sensor , although with no consistent results.I think the equation is wrong and I have no clue where to start

.
here is the sketch:
const int numReadings = 200;
int readings[numReadings]; //numero de leituras do pino
int index = 0; // indice de leitura
int total = 0; // total de leituras
float average = 0; //media
int inputPin = A0;
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
Serial.begin(9600);
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;
}
void loop() {
total= total - readings[index];
readings[index] = ((analogRead(inputPin)*(5.0/1024.0))-2.5)/.02; //thats where I think It´s wrong.
total= total + readings[index];
index = index + 1;
if (index >= numReadings)
index = 0;
average = total / numReadings;
Serial.println(average, 2);
lcd.setCursor(0, 1);
lcd.print("Amps ");
lcd.print ((average),2);
}
The equation i took from the .PDF datasheet.
The LCD displays weird measures, like 50 60 amps ( Im measuring 12.5a on my clamp meter) and when the amps get lower, the measures on display don´t follow this decreasement.What´s wrong?
Thanks in advance.
Cheers from Brazil.