Shelly EM energy monitor

There are actually two ways to use the Active Energy registers. One is to read it at an interval of your choosing (with auto-zeroing on read), and the other is called LINECYCLE mode,where you tell it how many line cycles to accumulate before interrupting you with the result. In both cases the device immediately goes on to accumulate the next batch - no cycle goes unmeasured no matter how slow your reads are (within reason). The fetching of the results can be quite leisurely.

I’ve used each method in different projects and they each have their pros and cons. Fundamentally you’re choosing who is timing the 10 second (say) integration period. One is timed by your processor and the other is timed by the grid frequency. A few people have posted topics about the beat effect you can get between emoncms and your front end hardware when each are timing their own 10 seconds. It generally works fine but once in a while the two clocks will “slip” past each other and you’ll get two datapoints for the one emoncms slot, and none for the next.

In general it’s better to average over the entire 10 seconds and post that result to emoncms, rather than just pick one sample out of 10. Here’s what boiling a pot of spaghetti looks like on a ceramic cooktop (I used to think induction hobs were the main culprit, but even ceramic elements can cycle pretty frequently):

Each one of those datapoints represents true average power over the last 10 seconds - or more correctly, over the last 500 line cycles since I use LINECYCLE mode in that project. Knowing that, if you extract the raw 10 second datapoints, you can actually do a bit of spreadsheet maths and work out when the element cycled:

Now if instead you take an instantaneous Real Power reading every 10 seconds, you’re either going to get back 0W or ~1840W. If you post that to emoncms you’re telling it “I just used 0W for the last 10 seconds” or “I just used 1840W for the last 10 seconds”. That’s only correct for 12 of the 28 posts. Then you’re relying on doing that for long enough (and the load cycling staying constant long enough) to eventually average your way to the correct result. That may well work, but it’s needlessly introducing a source of error.