Using LEM LTS 25np to measure current

Hello,

I am using a Lem sensor to measure short circuit current from a solar panel. The Vout at 0 A is supposed to be 2.5 V however my serial monitor reads 2.7028 or 2.707 and so on (not staying constant)
But when I measure using multimeter ( by touching the Vout and ground pin on sensor) I get 2.51 V. Not only that , the current measured from arduino was different from being measured by multimeter.

My board is powered by usb and Vcc to Sensor if from 5V pin.

Why is the value coming out of Atmega 328p different from value measured by multimeter?

#include <SPI.h>
#include <SD.h>

const int chipSelect = 4;

File sdata;
int voltage=A2;
int value;
float volt;
float current;
void setup() 
{
  pinMode(voltage,INPUT);
  Serial.begin(9600);
  pinMode(10, OUTPUT);      // set the SS pin as an output (necessary!)
  digitalWrite(10, HIGH);   // but turn off the W5100 chip!
  SD.begin(chipSelect);
  sdata= SD.open("Data.csv",FILE_WRITE);
  sdata.println ("Volt Current");
  Serial.print ("Voltage ");
  Serial.println ("Current");
  
}

void loop ()
{
  
  value=analogRead(voltage);
  volt=(5./1024.)*value;
  current=(volt-2.7075195)/0.05; // 2.707 is the reference voltage(supposed to be 2.5) , 0.05 is the          
                                                sensitivity of the sensor
  sdata= SD.open("Data.csv",FILE_WRITE);
  if (sdata){
     
  Serial.print(volt,7);
  Serial.print(' ');
  Serial.println(current,7);
  delay(10);
  sdata.print(volt,7);
  sdata.print(' ');
  sdata.println(current,7);
  sdata.close();
  
  }
}

fazi22:
I am using a Lem sensor to measure short circuit current from a solar panel. The Vout at 0 A is supposed to be 2.5 V however my serial monitor reads 2.7028 or 2.707 and so on (not staying constant)

Vout of a hall sensor is ratiometric. It’s not 2.5volt, but VCC/2.
It’s only 2.5volt if VCC is 5volt (which it never exactly is).

Serial.println(current,7);

Seriously?

An Arduino A/D has 1024 steps.
If the sensor is made for 10A, then you can’t even get two decimal places.
Remember that less than half of the A/D is used, because the sensor is bi-directional.
A hall sensor is also very noisy. Smoothing and/or averaging code must be used.

Maybe you can use parts of this sketch I wrote for an ACS712.
Leo…

// 20A bi-directional ACS712

int sensorPin = A0; // the pin that the sensor is connected to

// calibration
float offset = 511.5; // zeroing bi-directional sensor | could be 510.0 to 513.0
float span = 0.04883; // span | depends on type of sensor used (e.g. 20A) | finetune max readout

const byte numReadings = 32; // number of readings for smoothing (max 64)
int readings[numReadings]; // raw A/D readings
byte index = 0; // index of the current reading
unsigned int total = 0; // running total
float current; // resulting current

void setup() {
  Serial.begin(115200); // ***set serial monitor to this value***
  for (index = 0; index < numReadings; index++) { // fast-fill the array at startup
    readings[index] = analogRead(sensorPin);
    total = total + readings[index];
  }
  index = 0; // reset index
}

void loop() {
  total = total - readings[index]; // subtract the last reading
  readings[index] = analogRead(sensorPin); // one unused reading to clear any ghost charge
  readings[index] = analogRead(sensorPin); // read the sensor
  total = total + readings[index]; // add the reading to the total
  index = index + 1; // advance to the next position in the array
  if (index >= numReadings) // if we're at the end of the array
    index = 0; // wrap around to the beginning

  // convert value to current
  current = (total / numReadings - offset) * span; // value to current conversion

  // print to serial monitor
  Serial.print("Current is  ");
  Serial.print(current); // default two decimal places | ...(current, 1);  is one decimal place
  Serial.println("  Amp");

  delay(100); // use a non-blocking delay when combined with other code
}