Can i measure negative current with a ACS712 module?

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 ?

Help me please :o :o :o

It's always good to have a datasheet in hand...

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

Thank you for your answer!!

I will use arduino uno so i can measure negative current

pretzelell:
Thank you for your answer!!

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

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

Wawa:
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

Semtex9:
Last time I checked analogread0 represents voltage on analog input.

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

Wawa:
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

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.