hi guys, i was new to this stuff firstly
i've tried bunch of arduino module, and came across this acs712 module (30A) to monitoring my AC current.
here is my goal,
- i'm trying to monitoring AC current around 3-6 Amp (220v/50Hz) with acs712 and arduino uno
- set it to turning on fan when reach to 4 Amp with relay module
i've tried many code and modified some but still can't get a fine result, for example i was workng with this code which i get from http://henrysbench.capnfatz.com/henrys-bench/arduino-current-measurements/acs712-arduino-ac-current-tutorial/
/*
Measuring AC Current Using ACS712
*/
const int sensorIn = A0;
int mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module
double Voltage = 0;
double VRMS = 0;
double AmpsRMS = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
Voltage = getVPP();
VRMS = (Voltage/2.0) *0.707;
AmpsRMS = (VRMS * 1000)/mVperAmp;
Serial.print(AmpsRMS);
Serial.println(" Amps RMS");
}
float getVPP()
{
float result;
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
int minValue = 1024; // store min value here
uint32_t start_time = millis();
while((millis()-start_time) < 1000) //sample for 1 Sec
{
readValue = analogRead(sensorIn);
// see if you have a new maxValue
if (readValue > maxValue)
{
/*record the maximum sensor value*/
maxValue = readValue;
}
if (readValue < minValue)
{
/*record the maximum sensor value*/
minValue = readValue;
}
}
// Subtract min from max
result = ((maxValue - minValue) * 5.0)/1024.0;
return result;
}
when nothing is connected i got reading from my arduino around 0,02-0,03 Amp.
and when i'm connected with 1,7Amp load (reading from my Amp clamp meter), i got around 0,74 Amp from my arduino
my question is acs712 accurate enough to read AC or DC current? or it is more suitable for DC current?
or should i get another current sensor for AC like ta-12-100 or any suggestion to read 3-6 Amp on AC?