Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to properly measure currents with hall sensors 1

Status
Not open for further replies.

SolarTrap

Computer
May 5, 2014
89
Hello All,

I am using a hall sensors (ACS756, 24VDC, 50A bi-directional, link) to build a battery gauge. The problem is the 'zero point' of the sensor. The sensor is fed by 5V and by the specs sheet it should deliver 2.5V if no current is flowing. I am using the analog input of an ATmeaga2560 to measure that voltage. This is my code:

C:
float currBattAmps(float raw)
{
    return ((V_ARDUINO*(raw -zeroAbOffset)/1023.)/ -.04);  // 0.04 for 50A
}

V_ARDUINO = 5.0 and the zeroAbOffset is a value that I have measured when I 'calibrate' the sensor. I take 10000 measurements when no current is flowing and average them.
This comes out between 511-509 and seems to fluctuate for unknown reasons. It also seems to be temperature dependent. Since the minimal resolution of the sensor (in combination with 10 bits A/D) is +/- 0.122A this means quite a big difference and could throw SOC by a lot.

Any experience with this?

Markus
 
Replies continue below

Recommended for you

?? Doesn't the datasheet say that that the 0A output is 1/2 Vcc?

509-511 seems to be pretty close to 1/2 of 1023

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
That is absolutely correct BUT a difference in 1-2 values in 10 bit land actually mean that instead of 0.1A flowing out of the battery they a in fact flowing into the battery.
 
ENOB for a 10 bit A/D on-board an MCU is usually closer to 8 than to 9. So, 509 - 511 is acceptable.

Also, there is temperature coefficient and "Gamma" (Earth's magnetic field). Together, they create more uncertainty than the reduced ENOB does. I would use a shunt for that measurement. And a differential amplifier.

Gunnar Englund
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.
 
"That is absolutely correct BUT a difference in 1-2 values in 10 bit land actually mean that instead of 0.1A flowing out of the battery they a in fact flowing into the battery."

If that's what you're trying to measure, then you are using a cannon as a hammer, and will get commensurate results. The datasheet pretty clearly delineates operational characteristics that are incompatible with that scenario. To wit, VOE(TOP)HT is ±30 mV, which is ±1A, and the 6σ noise is 0.33A.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
Our manager implemented an inventory control system that he was quite proud of. Every time there was a run of X units, he subtracted X number of labels. Then one day production stopped. There were no labels for the printer. Inventory said there were 4,000. Every time the printer started, three labels had to be wasted before the first printed one came out. Calculating battery SOC is a lot like that.
 
@Gunnar: any recommendations on components which are best to build a bi-directional current sensor for 50A with a shunt?

@IRstuff: "you are using a cannon as a hammer" - the problem is I need to cover the full range up to -/+ 50A. I might have to go for the shunt solution then.
 
So, it should have been pretty clear that you needed something with at least 12-bits of dynamic range, which is not supportable by an Arduino. Possibly, you need to have something that can change ranges, as well.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
@Keith: great link - looks like this is even a much less expensive solution. Are there any side effects of using a shunt like more heat, bigger voltage drops?

@IRstuff: I don't see how more bits could be a solution. The problems seems to be the signal noise and not the resolution of the A/D.
 
Just saying that even if you had a decent part, the Arduino wasn't going to give you good answers, anyway.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
I've used the Maxim family of parts several times with good results. Not much downside. I'd only bother with Hall Effect if I was desperately trying to measure a high DC current with a voltage too high for one of the Maxim chips. If I recall, they have a couple of versions that have different gains. The higher the gain the less drop and less heating at the shunt but the higher the noise reading.

If you truly are just looking for a battery fuel gauge there numerous parts for that! You can probably find one you just ask with the Arduino without using it's paltry A2D.

Maxim app note on fuel-gauging (includes part numbers)

Linear Tech (high end parts)

Ti (lots of choices)


Keith Cress
kcress -
 
Thanks Keith, great resources but I want to stay more flexible with the battery gauge and not use an integrated solution. I need a flexible setup that can handle 10AH - 500AH capacity and also adapt to SLA or Lithium or what else might be coming. I think the best solution is the shunt-based current sensor and to do the rest in software.
The only problem I see is that it must be able to handle 30VDC.
 
Treat 511-509 as zero. A 100AH battery doesn't even notice 100 mils. You are on a fools errand trying to calculate SOC to this degree.
 
Datasheet for the Allegro ACS756 indicates a 2.5V output at 0A and 25C of +/-30mV which is +/-6 counts. Noise is +/-10 mV which is +/2 counts. There are also a couple pages of text explaining the overall accuracy and non-linearity.

Looks like your setup is measuring the device within the specs.
 
SOC determination just by relative amps will inevitably drift the SOC to to either 0% or 100%. To overcome this problem I can either disconnect the batteries for 24 hours and measure the settled voltage and translate that to SOC. This is unfortunately not possible because the battery is in use. The other method is to find out if the battery is nearly full. This is the case if the absorption of the battery is close to 0-3% of its capacity. Example for 50AH: when measuring 0.-1.5A at 14.4V flowing into the battery for at least 1 hour then I can assume its full. This is more or less the standard algotithm in 3 stage chargers before they switch to float charge.
Now with these sensor fluctuations I sometimes measure amps flowing out if the battery which throws the detection off. Therefore I could define a tolerance as 'zero' amps as suggested. But it's not precise and therefore I think I would prefer the shunt method.
 
Technically, all approaches discussed are "shunts," the issue is really whether the measurement sensor has sufficient SNR and low offset to achieve what you what. Depending on the cost bogies and application, it might make sense to have two separate sensors with different max ranges, or a single sensor with two ranges, or a single sensor with a VERY LARGE linear range. Note that your apparent requirement is 0.1A/100A, which is 0.1% linearity, which might not be readily achievable in a single sensor.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
So it seems this is all by the specs and I would have to do some algorithmic noise reductions based on temperature. By looking at the other shunt based sensors I get the feeling that I would have to deal with the same noise problems.
 
Interesting reading. I am working on a related project, but I need isolation between the processer(a PIC) and the battery.
Hall effect looked like the answer. Maybe not. Any suggestions ? V-f then a optocoupler ? I do need temperature and long-term stability.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor