Go Down

Topic: Problems with ACS758 current sensor (Read 296 times) previous topic - next topic

kadDal

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.

jremington

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).

kadDal

#2
Apr 17, 2018, 10:52 am Last Edit: Apr 17, 2018, 11:09 am by kadDal
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.
Code: [Select]

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);

}

Wawa

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

kadDal

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

jremington

#5
Apr 17, 2018, 07:35 pm Last Edit: Apr 17, 2018, 07:36 pm by jremington
Quote
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?

Wawa

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..

kadDal

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.

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?

jremington

#8
Apr 19, 2018, 05:06 am Last Edit: Apr 19, 2018, 05:10 am by jremington
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.

Wawa

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..

kadDal

#10
Apr 19, 2018, 09:58 am Last Edit: Apr 19, 2018, 10:42 am by kadDal
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.

Wawa

#11
Apr 19, 2018, 12:37 pm Last Edit: Apr 19, 2018, 12:37 pm by Wawa
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..

kadDal


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.

jremington

#13
Apr 19, 2018, 04:55 pm Last Edit: Apr 19, 2018, 04:57 pm by jremington
Quote
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.

kadDal

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.

Go Up