• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ACS712 Hall sensor current measurement module

Status
Not open for further replies.

earckens

Member
Hi, I have not good luck trying to get a module with a ACS712 Hall current sensor to work. The test setup consists of the module connected to a PSU, a ATmega 328 microcontroller and a load where I can send anything between 0A and 3A through the load.

I wrote a little program measuring 5 consecutive times with appropriate delay (50ms) and the average is displayed as well as the difference between min and max readings of those 5 (noise).

The result is that the noise goes from 10 to 50mA at 0A load, 50mA to 80mA at 0.5A load and 250mA to 300mA at 2A load.

The fact that there is so much noise worries me; there are no magnetic fields in the vicinity, the filter cap is changed to a 100nF ceramic cap (maybe not a good materials choice?); but when I revert to a non-modified module I get about the same results.

Any ideas?
 

Misterbenn

Active Member
I'm assuming your using the 5A version?

If you look at the performance characteristic the noise is given as 21mV which is 116mA of noise to start off with.

You'll also have quantization error which with the 10-bit ADC and a 5V supply rail will be 4.8mV or 26.6mA

And an error of 1.5% (assuming your at ambient) so thats 30mA @2A load. This goes half way to explaining your noise.

If you are using a Switched mode power supply then the power rails could be noisy to start with and also if you are using any digital signals which are poorly routed next to the analogue signals that will add noise. Grounding is also important.

you might consider a unity gain amplifier after the ACS712 with a low pass filter on the output.
 

earckens

Member
It is indeed the 5A version.

I disagree with your second line: the spec sheets says that the noise (21 mV) divided by the sensitivity (185 mV/A) provides the smallest current that the device is able to resolve: 0.11mA.

ADC 10-bit resolution, 4.9mV: ok. This is the smallest difference in voltage that the ADC converter can discern; 26mA is not a very good figure.

Total output error, non-linearity,..: 1.5%, well yes, that is 30mA for a 2A load. But at 100mA this still is 1,5% so 1,5mA. I can live with that.

The supply I use is from the USB port; not a very good source indeed. I will try and use another supply and report back.

Overall: not really what I was hoping from this module; certainly unable to accurately measure with 10mA resolution but part is indeed due to the low resolution of the ADC converter in the microcontroller.
I was hoping that adjusting the frequency compensation capacitor to a value of say 470nF would make a difference; I do not measure it, unless someone tells me that a ceramic capacitor is not up to the job?
 

spec

Well-Known Member
Most Helpful Member
A ceramic capacitor will be ideal for your filtering application.

The problem with ceramic capacitors is that:

(1) Their capacitance value varies greatly with temperature (except COG dielectric)

(2) Their value varies greatly with applied voltage (except COG)

(3) They generate distortion so they are best kept well away from audio circuits where they introduce a sort of grainy sound (if that makes sense)

The advantages of ceramic capacitors are:

(1) They have a high capacitance for a given size (except COG)

(2) They have a very low Effective Series Resistance (ESR)

(3) They perform well at both low and high frequencies

It is best to stick with X7R and COG dialectics when choosing ceramic capacitors and as a general rule with X7R types, the physically bigger the better.

spec

2016_09_19_Iss1_ETO_CERAMIC_CAPACITOR_V_VARIATION.png
Two X7R Dielectric Ceramic Capacitors Variation with Voltage​
 
Last edited:

Les Jones

Well-Known Member
Most Helpful Member
Hi earckens,
In post #3 you say "the spec sheets says that the noise (21 mV) divided by the sensitivity (185 mV/A) provides the smallest current that the device is able to resolve: 0.11mA." It is not 0.11 mA it is 0.11 A (110mA)

Les.
 

earckens

Member
Hi earckens,
In post #3 you say "the spec sheets says that the noise (21 mV) divided by the sensitivity (185 mV/A) provides the smallest current that the device is able to resolve: 0.11mA." It is not 0.11 mA it is 0.11 A (110mA)

Les.
Great! I urgently need to take care of my unities.
 

earckens

Member
To spec: it is good to know the different capacitor types, but my local supplier has the following signal (non-polarised) variaties in stock: ceramics, MKS, MKT, MKP, tantalum. So I choose the most expensive, MKT (metallized polyester film)?
 

Misterbenn

Active Member
I'd be interested to hear your results with a better power supply, linear ideally.

Presumably you need voltage isolation in your application or is it the low series resistance that's attractive? otherwise you could use a current shunt resistor.

If you don't need the voltage isolation then a low side current shunt with 0.1% tolerance and a instrumental amplifier would be better. If you do need voltage isolation you could use a differential isolation amp like the AMC1100, but you would need extra components.
For high accuracy current shunt circuits please look at http://cds.linear.com/docs/en/application-note/an105fa.pdf
 
Last edited:

earckens

Member
Misterbenn, thank you for this very interesting paper; my conclusion is to remain on the low side with a shunt resistor. For that purpose I ordered a module with a INA219B chip and a 1% 0.1 ohm 2W resistor on it. I can then also simply read the output voltage through a divider on an input of a microcontroller connected to PSU GND (and connected to the INA219 for current measurements).

I have not yet tested with a stable voltage source (probably this week).
Please let me know where to find the 0.1% tolerance shunt resistors, so far I could not locate them. I have a Fluke 289 that measures to 0.01 ohm but if 0.01% is needed that is not enough. The INA has a 1% 0.1 ohm resistor, so that will be 0.100 ohm which I cannot even measure.

But then my experiments with the ACS712 learned me that the 10 bit ADC I am using implies a resolution of less then 4.8mV, which corresponds to about 10mA (without counting noise, drift, ..). Now the INA has a 9 to 12 bit ADC, so not much better. I start to get it that I may be happy with a display resolution of 0.1A. Therefor I think that the 1% accuracy of the INA shunt should be adequate.

But hey, may reasoning may be wrong somewhere, please correct me.
 

Misterbenn

Active Member
Glad you found the paper helpful.

With regard to your first circuit you will certainly never get 10mA accuracy but it is performing worse than it should so I've a few more queries. Is the circuit on a PCB or proto board?

the ATmega 328 circuit:
  • are you using a capacitor on the Vref pin? section 25.5.2 of datasheet
  • are you using an LC filter on AVcc pin? section 24.6.2 of datasheet
  • are you using the ADC noise canceller function ?
With regard to your new circuit:
0.1% 100mOhm resistors
http://uk.rs-online.com/web/p/surface-mount-fixed-resistors/6841646/
and same from digikey
http://www.digikey.co.uk/product-de...-group/Y14880R10000B9R/Y1488-.1BCT-ND/4333500

The INA219B is a great choice but actually designed for high side sensing as it can give you the bus voltage as well the current. It also only has an I2C output not an analogue one, unless your module has provision for an analogue output.

The INA ADC can have 12 bit resolution which is 4 time higher resolution compared to 10bit. But importantly it also includes a sign bit. So in your original circuit you had 1043 divisions between -5A and +5A you now have 4095 divisions for 0A to 3.2A and 8190 divisions over the full range of -3.2 to +3.2A.
 

earckens

Member
Misterbenn, can you send me the datasheet your are using? The 50 page document I have makes no mention of any of the items you point to.

No breadboard is involved, I use a Arduino pcb.
 

MikeMl

Well-Known Member
Most Helpful Member

Misterbenn

Active Member
Misterbenn, can you send me the datasheet your are using? The 50 page document I have makes no mention of any of the items you point to.

No breadboard is involved, I use a Arduino pcb.
for the INA219?
http://www.ti.com/lit/ds/symlink/ina219.pdf

Or for the ATmega 328
http://www.atmel.com/images/Atmel-8...PA-168A-168PA-328-328P_datasheet_Complete.pdf

If you are using an arduino it will not be optimised for analogue signals and you'll be likely to pick up quite a bit of noise between your current sensor and the arduino inputs on what ever external module / wires you are using.

The INA219 with its I2C output will avoid these noise pickup issues to the arduino
 

earckens

Member
Misterbenn, yes I will be testing and probably using the INA219B. However, since in the future I will keep making use of the analog Atmega (or Pro Mini) inputs I will study the deeper end of this, therefor I appreciate your post #10 on that issue.
As far as the supply for the Atmega goes, not tested yet, I am waiting for a separate PSU for this, as soon as tested I post. Meanwhile I get some strange results out of the ACS712B: it should give 0.185V/A, yet at 2A load the sensor output changes only to 2.28V from 2.50V, not quite the -2 * 0.185V/A.... and this on two units!
 

Misterbenn

Active Member
your seperate PSU will still most likely be a switch mode power supply. The idea would be to find a 7.5V PSU and put a 5V LDO in series with it.

This http://www.crazy-audio.com/2013/09/raspberry-pi-power-supply-noise-on-the-5v-rails/ article gives an idea of the different quality and noise some power supplies will give you.

As for your strange values at 2A drive, can you confirm the zero current voltage. As this device is zero current biased to half the supply voltage i'm wondering if this isn't exactly 2.5V.
 

earckens

Member
Separate PSU: I will be connecting a battery supply, just waiting for the holder to arrive.

At 0A load, I measure with Fluke 2.56V and the ADC values swing between 508 and 519.

At 2A I measure 2.29V and ADC output of between 456 and 480.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top