Problems with ACS758 current sensor

I'm using ACS758 to mesure DC providing from a battery, bat the problem is when I give it any other values except zero as input it's show in arduino monitor the value 1023. please help me, I don't know what's wrong.

Please read and follow the directions in the "How to use this forum" post. Post your code, using code tags, and a hand drawn wiring diagram (not a Fritzing mess, please).

I'm so sorry for not posting any of my code and diagram. So i'm attachining it here. If someone can here me please.

float Ib_DCsample=0;            // Raw value read by the arduino from current sensor battery
float Imesb=0;                  // the mesured value of current form battery 
float Voffsset =2500;           // The offset value mV
float VpAb = 20;                // The scale factors bi-directional 
float Iunit = 4.88;             // Unitary value (mV)
float AmpB_DC=0;                // The real value of currente mesured from the battery




void setup() 
{
  Serial.begin(9600);

}

void loop() 
{
  Ib_DCsample=analogRead(A0);       //  voltage read after ADC

  Imesb=(Iunit*Ib_DCsample);        //  Voltage mesured mV 
  AmpB_DC=(Imesb-Voffsset)/VpAb;     
  
  Serial.print(" value read in arduino : ");
  Serial.println(Ib_DCsample);
  Serial.print("value of the voltage  (mv) : ");
  Serial.println(Imesb);
  Serial.print("la valeur amps : ");
  Serial.println(AmpB_DC);
  
  delay(2500); 

}

Arduino monitor.JPG

A raw value of 1023 could mean that the ground connection between sensor and Arduino is faulty.
Leo..

what do you mean by the ground connection between sensor and Arduino is faulty? is that related to the cable I used?

what do you mean by the ground connection between sensor and Arduino is faulty

He means that you may have a bad connection between the sensor ground and the Arduino ground.

Another possibility is that the current is out of sensor range.

Exactly which version ACS758 are you using?

What is the battery voltage, the load resistance, and the expected current value?

jremington:
Another possibility is that the current is out of sensor range.

Then the A/D would return about 950-1000, because sensor output can't go fully rail2rail.

OP, posting a REAL picture of the setup could help.
Leo..

jremington:
Exactly which version ACS758 are you using?

What is the battery voltage, the load resistance, and the expected current value?

I'm using ACS758 100B, a 12V battery and with different value of load resistances: 5k, 10k, 150k. For the mean time I'm just testing, but originaly I'm planing to use it with 48V battery and for a load that use between 30-40A.

Wawa:
Then the A/D would return about 950-1000, because sensor output can't go fully rail2rail.

What can I do if the A/D is returning about 950-1000? Is that because the value of current is to small to be read?

A 12V battery and a 5K resistor will produce a current of 0.0024 A through the current sensor.

The ACS758-100B has a sensitivity of 20 mV per Ampere.

As an exercise, calculate the expected sensor output voltage.

Extra credit! Calculate the current through a 150K load resistor, and the expected sensor output voltage.

kadDal:
What can I do if the A/D is returning about 950-1000? Is that because the value of current is to small to be read?

No, that A/D value is only returned when there is a shipload of current flowing through the sensor.
An A/D value of 1023 can AFAIK only be caused by a broken ground wire between the sensor and the Arduino.

jremington is right about the resolution.
Theoretical resolution of a bidirectional 100Amp sensor (+100Amp to -100Amp), measured with a 10-bit A/D (1024 values), can only be 200/1024. Or ~200mA per A/D step. Practically, about 500mA.
Leo..

So did I choose the wrong sensor? The voltage is it too small to be detected?
I'm so sorry for being that ignorant, I'm a beginner i'm still learning, and thank you for your hepl.

You must have bought that 100Amp bipolar sensor for a reason. Because you needed that range?
Resolution is a percentage of maximum range, in this case about 0.25%. Not bad.
But if you only ever are going to charge/draw 10Amp from the battery, you should use a 10Amp sensor.
This is one of the cases that bigger is not better.

Fix that problem you're having first, before you're going to worry about resolution.
Leo..

As you said I choosed that sensor because I need it with that range. But for the time Being I only wanted to test the sensor, but I think the load I used was not sufficient to draw a raisonnable current for the sensor to works.

I think the load I used was not sufficient to draw a raisonnable current for the sensor to works.

You can actually prove this, if you follow my advice in reply #8.

You do need to understand Ohm's Law, if you want to be successful in this hobby.

jremington:
You can actually prove this, if you follow my advice in reply #8.

You do need to understand Ohm's Law, if you want to be successful in this hobby.

Yes, you're right, I did as you adviced, And the voltage produced was too small to be detected by a sensor with 100 A as a range, then i tried to use big loads, however all the load I could use for testing wasn't sufficient nor even close to be compared to a real load that basically I'm designing this system for.
So I'm using now the ACS712 20A for my prototype.
Thank you so much, by testing and experimenting I learned and understood a lots of basics and laws.

Whats the use of Cf and Rf on the data sheet? My sensor 200b can't read accurately,
Whats are the things that must be checked?
-I placed a .1uF capacitor between ground and vcc
Is it the code?
The actual measurements I measured is 0-60A.
Is it the range of my 200B current sensor?

Cf/Rf are a low pass filter network.

My sensor 200b can't read accurately,

Normal, its a hall sensor, they are very noisy. The datasheet tells you how noisy in the "performance
characteristics" tables.

Hall sensors measure magnetic field around the current path, so they pick up stray magnetism too,
they are not great performers but are fully isolated and have low loss.

If you want to measure 0..60A, the +/-200A version of the sensor was the wrong choice. The total
error is given as +/-1.2%, that's +/-2.4A (or put another way you have 5A of slop, worst case).

Perhaps you should have chosen the 100U or even 050U version?

I ordered 100A(B), is it ok?

Janmeinard:
I ordered 100A(B), is it ok?

What are your accuracy requirements?