ok leo thanks u so much for everything
From your other thread (yep, cross-posting is confusing).
ovygrecu:
I need to measure the current from a 12V battery
ovygrecu:
...right now I m trying to measure Ac current...
Can't do that.
AC flows in both directions. The code I gave you averages this, so the result of any current is always zero.
You need different code for AC.
Leo..
What I understand from the datasheet of that sensor is that you can influence Vref of the sensor with an external votage if you want unequal charge/discharge ranges e.g. for a forklift battery. e.g. 100Amp charging and 800Amp discharge. That could give you a higher A/D resolution in charge or discharge if needed.
Maybe someone could confirm this.
Leo..
@ovygrecu, do not cross-post. Threads merged.
for my bachelor degree I need to measure the current with this sensor from a 12 v car battery, but right now I am doing tests with ac current cuz I don't have the battery right now. My teacher told me that this week we will do some test with this code, I will let u know if is working.
float Read=0.0;
float Tens=0.0;
float Vref=2.5;
float Ip=0.0;
void setup(){
Serial.begin(9600);
}
void loop(){
Read= analogRead(A0);
Tens = (Read*5/1023);
Ip=(800*(Tens-Vref))/1.25;
Serial.println(Ip);
delay(2500);
}