Go Down

### Topic: Can i measure negative current with a ACS712 module? (Read 231 times)previous topic - next topic

#### pretzelell

##### Oct 07, 2020, 05:06 am
Hi guys, I have to measure negative current using arduino so i will use ACS 712 module

SoCan i measure negative current using this module ?

#### TheUNOGuy

#1
##### Oct 07, 2020, 05:11 amLast Edit: Oct 07, 2020, 05:11 am by TheUNOGuy
It's always good to have a datasheet in hand...
It's better if you check the internet  ( your friend ) before posting..!

#### Wawa

#2
##### Oct 07, 2020, 08:02 am
Depends on which Arduino you're using.

On an Uno, zero current will give an A/D value of about 512.
A current one way will increase that value, current the other way will decrease that value.

Depending on which ACS712 you have (±5A, ±20A, ±30A), that current will result in A/D values of ~102 or ~921.

That sensor is 5volt only, so not compatible with more modern 3.3volt boards or ESP boards.
Leo..

#### pretzelell

#3
##### Oct 08, 2020, 01:37 am

I will use arduino uno so i can measure negative current

#### Semtex9

#4
##### Oct 08, 2020, 06:47 amLast Edit: Oct 08, 2020, 06:49 am by Semtex9

I will use arduino uno so i can measure negative current
you will need to ofset it properly in code, by subtracting probe zero value, and you need voltage to current rating of the probe to calibrate

#### Wawa

#5
##### Oct 08, 2020, 07:03 am
voltage to current rating of the probe to calibrate
Make that A/D value to current. Voltage has nothing to do with a current probe.
The ACS712 outputs 10-90% of it's supply, not 0.5-4.5volt.
Well, only if the supply is 5.000volt, which it rarely is.

float current = (analogRead(A0) - 512) * 0.04878; // basic code for 20Amp sensor

This only works for smooth DC.
Leo..

#### Semtex9

#6
##### Oct 08, 2020, 09:30 amLast Edit: Oct 08, 2020, 10:32 am by Semtex9
Make that A/D value to current. Voltage has nothing to do with a current probe.
The ACS712 outputs 10-90% of it's supply, not 0.5-4.5volt.
Well, only if the supply is 5.000volt, which it rarely is.

float current = (analogRead(A0) - 512) * 0.04878; // basic code for 20Amp sensor

This only works for smooth DC.
Leo..
Last time I checked analogread0 represents voltage on analog input. But thats what I ment for calibration yes, the exact conversion number *0.04878, I called it voltage to current rating because it has to do with A/D value from measured hall effect voltage that corresponds to the passed current,scaled to arduino compatible voltage by diff amp on the probe if I remember right...

we can argue that time has noting to do with it either, wont get us closer to the truth about A/D conversion

he should check the datasheet on it to be sure, and -512 is the offset. He might want to ofset it slightly more or less depending on the results, last time mine red -0.25A in idle...

Sry for being contra intuitive, just wanted him to understand the whole process... forgot it was called A/D rating on the datasheet too, my bad

#### Wawa

#7
##### Oct 08, 2020, 10:41 am
No it doesn't.

Most Arduinos have a ratiometric A/D (default Aref = VCC).
*0.04878 is calculated from 5.0volt, which it rarely is.
If you use a Nano on USB supply (~4.6volt), then your 'voltage' code doesn't work any more.
Best to stick with 'ratio'. A/D value directly to current.

And yes, idle is about 512, and can also be influenced by nearby magnetic fields.
When I use the ACS712 I use multiple readings, and average them (smoothing code).
Then you can also better fine-tune that zero point.
Leo..

#### Semtex9

#8
##### Oct 08, 2020, 07:54 pmLast Edit: Oct 08, 2020, 07:55 pm by Semtex9
No it doesn't.
Ok, I get you now, it has to do with ratiometric equation because both Vin and Vref is taken from a single source, and you are thinking global, but you're really breaking me, if Vin on A0 is not magic it must be voltage between 0 and Vcc(Vref), that gets quantized by counting time that a rising internal saw signal of known frequency takes to get from 0 to Vin, while it resets on Vref, and producing a corresponding value between 0 and 1024 in code. I am just viewing it from a low level angle, I use the same code, sorry for the misunderstanding

#### MarkT

#9
##### Oct 09, 2020, 11:51 amLast Edit: Oct 09, 2020, 11:52 am by MarkT
Note that Hall-effect current sensors like the ACS series are very noisy and you may want to
sample lots of times and average for any kind of accurate DC readings.  The main selling point
of the Hall sensor is its galvanic isolation - the circuit being sensed can be 100V or more different
from the sensing circuit (read the datasheet for details).

However if that's not needed often a simple shunt-resistor current sensor will perform better.

And the sensitivity to magnetic fields has already been mentioned.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

Go Up