Open anilx86 opened 4 years ago
I did some editing of code to find out time period of sampling added these lines to relevant section of codes
double timeT1; double timeT2;
// calculate energy timeT1 = micros(); double Irms = calcIrms(1480, mainsPin); // Calculate current timeT2 = micros(); Serial.println(cHTML); Serial.print(timeT1); Serial.print(" "); Serial.print(timeT2); Serial.print(" "); Serial.println((timeT2-timeT1)/1000);
Serial Monitor output: 14:50:55.148 -> ----Ready---- 14:50:55.861 -> 20553.38 Mains Power 14:50:55.895 -> 14:50:55.895 -> 6346632.00 6363608.00 16.98 14:50:57.202 -> 4844.44 Mains Power 14:50:57.202 -> 14:50:57.202 -> 7670165.00 7687063.00 16.90 14:50:59.156 -> 1140.90 Mains Power 14:50:59.156 -> 14:50:59.156 -> 9623591.00 9640463.00 16.87 14:51:03.162 -> 268.69 Mains Power 14:51:03.162 -> 14:51:03.162 -> 13614079.00 13630950.00 16.87 14:51:03.162 -> 63.28 Mains Power 14:51:03.162 -> 14:51:03.162 -> 13632999.00 13649893.00 16.89 14:51:05.204 -> 14.90 Mains Power 14:51:05.204 -> 14:51:05.204 -> 15665844.00 15682690.00 16.85 14:51:07.260 -> 3.51 Mains Power 14:51:07.260 -> 14:51:07.260 -> 17714793.00 17731667.00 16.87 14:51:09.379 -> 0.83 Mains Power 14:51:09.414 -> 14:51:09.414 -> 19863730.00 19880576.00 16.85
The time period i got while experimenting is very close to desired value ,but i dont understand how no. of samples value of 1480 was derived.
I did some editing of code to find out time period of sampling added these lines to relevant section of codes
double timeT1; double timeT2;
Serial Monitor output: 14:50:55.148 -> ----Ready---- 14:50:55.861 -> 20553.38 Mains Power 14:50:55.895 -> 14:50:55.895 -> 6346632.00 6363608.00 16.98 14:50:57.202 -> 4844.44 Mains Power 14:50:57.202 -> 14:50:57.202 -> 7670165.00 7687063.00 16.90 14:50:59.156 -> 1140.90 Mains Power 14:50:59.156 -> 14:50:59.156 -> 9623591.00 9640463.00 16.87 14:51:03.162 -> 268.69 Mains Power 14:51:03.162 -> 14:51:03.162 -> 13614079.00 13630950.00 16.87 14:51:03.162 -> 63.28 Mains Power 14:51:03.162 -> 14:51:03.162 -> 13632999.00 13649893.00 16.89 14:51:05.204 -> 14.90 Mains Power 14:51:05.204 -> 14:51:05.204 -> 15665844.00 15682690.00 16.85 14:51:07.260 -> 3.51 Mains Power 14:51:07.260 -> 14:51:07.260 -> 17714793.00 17731667.00 16.87 14:51:09.379 -> 0.83 Mains Power 14:51:09.414 -> 14:51:09.414 -> 19863730.00 19880576.00 16.85
The time period i got while experimenting is very close to desired value ,but i dont understand how no. of samples value of 1480 was derived.