Good evening people, so I own this ct sensor and I will be using part of the code here from @Fleischtorte .
My question comes from my lack of knowledge about electric current and eçetricity in general. So in most cases, we see people taking Power (current * voltage) readings every minute and then sum and average those powers once it reaches the 1 hour mark (60 minutes).
My question is this:
Seeing as a ct sensor will give different current and therefore Power values every SECOND, why shouldn't we take readings of Power values each second and then sum those values every second until it reaches 1 minutes mark (60 times) and then repeat this 60 times (to make an hour) and finally sum and average those values?
Basically something like this:
if (seconds < 60) {
double Irms = emon.calcIrms(1480)
double watt = Irms * 230.0
total_watt_per_minute = total_watt_per_minute + watt
} else {
seconds = 0
total_watt_per_hour = total_watt_per_hour + total_watt_per_minute
total_watt_per_minute = 0
minutes++
}
if (minutes >= 60) {
wh = wh + total_watt_per_hour/60
kwh = wh/1000;
total_watt_per_hour = 0
minutes = 0
}