×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# How to properly measure currents with hall sensors

## How to properly measure currents with hall sensors

(OP)
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:

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

### RE: How to properly measure currents with hall sensors

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

### RE: How to properly measure currents with hall sensors

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
www.gke.org
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.

### RE: How to properly measure currents with hall sensors

"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: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!

### RE: How to properly measure currents with hall sensors

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.

### RE: How to properly measure currents with hall sensors

(OP)
@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.

### RE: How to properly measure currents with hall sensors

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: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!

### RE: How to properly measure currents with hall sensors

(OP)
@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.

### RE: How to properly measure currents with hall sensors

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 - http://www.flaminsystems.com

### RE: How to properly measure currents with hall sensors

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

### RE: How to properly measure currents with hall sensors

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.

### RE: How to properly measure currents with hall sensors

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.

### RE: How to properly measure currents with hall sensors

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

### RE: How to properly measure currents with hall sensors

It's appalling how fast the "sub-task" of a system's SOC indicator can suddenly grow to 90% time/cost of the entire system development.

Keith Cress
kcress - http://www.flaminsystems.com

### RE: How to properly measure currents with hall sensors

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: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!

### RE: How to properly measure currents with hall sensors

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

### RE: How to properly measure currents with hall sensors

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.

### RE: How to properly measure currents with hall sensors

Browsing around the web I came across a Flux Gate transducer for DC Current.
It seems to me that with several turns through the primary it would be quite sensitive.

### RE: How to properly measure currents with hall sensors

(OP)
It has been almost 6 months now and I ended up using a shunt to measure current instead of the hall sensor. I re-designed the entire board and have attached a pic of the current PCB layout for reference.
I am having a Kickstarter campaign running since Monday now so wish me luck to get this project off the ground :)

Markus

### RE: How to properly measure currents with hall sensors

Thanks for the update!
You have what looks like a well thought out layout there. I see you went with a Maxim shunt amp.
I assume it did the the trick for you.
Good luck on your KStarter project.

Keith Cress
kcress - http://www.flaminsystems.com

### RE: How to properly measure currents with hall sensors

Well.. I believe Maxim was the first, Ti essentially copied it but I take your point.

Keith Cress
kcress - http://www.flaminsystems.com

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!