keen bm
Newbie level 2
Hello guys, i am working on IoT project in which i need to measure AC current of Home appliances.Mains power supply voltage is 240 V 50HZ. Smallest load is drawing 100 m Amps. and highest load is drawing 5 Amps.I am using ACS712 hall effect for current sensor. I have 8 channel relay board,at each relay contact i have connected ACS712. At lower range i am not able to differentiate between noise and current output.I don't precise current measurement.I am using 12bit ADC of Wemos Lolin 32 for measurement.
How can i measure AC current as small as 200 mA? also is there any other integrated that i can use instead of ACS712.
How can i measure AC current as small as 200 mA? also is there any other integrated that i can use instead of ACS712.
Code:
const int sensorIn = A0;
int mVperAmp = 100; // use 100 for 20A Module and 66 for 30A Module
double Voltage = 0;
double VRMS = 0;
double VRMS1 = 0;
double AmpsRMS = 0;
void setup()
{
Serial.begin(115200);
}
void loop()
{
Voltage=getVPP();
VRMS=(Voltage/2.0)*0.707;
AmpsRMS=(VRMS*1000)/mVperAmp;
Serial.print(AmpsRMS);
Serial.println(" Amps RMS");
// put your main code here, to run repeatedly:
}
float getVPP()
{
float result;
int readValue;
int maxValue=0;
int minValue=4095;
uint32_t start_time=millis();
while((millis()-start_time)<1000) //sample for 1 sec
{
readValue=analogRead(sensorIn);
if(readValue>maxValue)
{
maxValue=readValue;
}
if(readValue<minValue)
{
minValue=readValue;
}
}
//maxValue = 4095-maxValue;
//minValue=4095-minValue;
result=((maxValue-minValue)*3.3)/4095.0;
Serial.println(maxValue);
Serial.println(minValue);
return result;
}
Last edited by a moderator: