Hi
you are using 1480 samples for calculation .for correct calculation samples period should be multiple of 16.66' milliseconds for 60Hz countries and multiple of 20 milliseconds for 50Hz countries .i want to know what time period 1480 samples corresponds to and reason for selecting 1480 samples in your code.
// calculate energy
double Irms = calcIrms(1480, mainsPin); // Calculate current
Hi you are using 1480 samples for calculation .for correct calculation samples period should be multiple of 16.66' milliseconds for 60Hz countries and multiple of 20 milliseconds for 50Hz countries .i want to know what time period 1480 samples corresponds to and reason for selecting 1480 samples in your code.
// calculate energy double Irms = calcIrms(1480, mainsPin); // Calculate current