I am trying to find out what is the linear equation that the ACS712 20A Current Sensor uses. I have attached the code below.
/*
Measuring Current Using ACS712
*/
const int analogIn = A1;
int mVperAmp = 100; // use 100 for 20A Module and 66 for 30A Module
int RawValue= 0;
int ACSoffset = 2500;
double Voltage = 0;
double Amps = 0;
void setup()
{
Serial.begin(9600);
}
void loop(){
RawValue = analogRead(analogIn);
Voltage = (RawValue / 1024.0) * 5000; // Gets you mV
Amps = ((Voltage - ACSoffset) / mVperAmp);
Serial.print("/t Raw Value = " ); // shows pre-scaled value
Serial.print(RawValue);
Serial.print("\t mV = "); // shows the voltage measured
Serial.print(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
Serial.print("\t Amps = "); // shows the current measured
Serial.println(Amps,3); // the '3' after voltage allows you to display 3 digits after decimal point
int sensorValue = A1;
sensorValue = analogRead(A1); // read sensorOne value.
}
In one of my books I read that effective current = analog measurement /185 * 1000000/ 1.414
Which does not make sense from the code.
Does anyone have an idea about it?


