Question about emonTx V3 sampling method


Just to understand the way samples are made on emonTx V3.

I can understand from the code that if there is a power source the cycle does the following:

1) CT1 calculation of the real power on 20 half_wavelengths (so is 1/5 of a second if we have 50hz of AC frequency)

2) CT2 the same after CT1

3) CT3 the same after CT2

4) CT4 the same

So we measure the power only on... let's say 1/5 of a second on each different phase and than we assume that this power remains the same during the rest of the second.

If the device is powered with battery instead it does calculate Irms on 1480 samples for each CT and then goes to sleep.

Is it right?

Where I can find (if there is one) an explanation of the logic that underlines the firmware?

Thanks in advance

Robert Wall's picture

Re: Question about emonTx V3 sampling method

That is all correct - except that it is 10 s between sets of readings. The logic is - as far as I know - not written down in one place anywhere. However, the comments to the code and the various Building Blocks articles explain particular points.

piertoni's picture

Re: Question about emonTx V3 sampling method

Thanks for the explanation, please two more answers :)

1) When the device is battery powered, why 1480 samples? It corresponds to 20 half_wavelengths?

2) Finally we have one sample every 10 seconds, I suppose this is considered a good compromise between accuracy and device energy consumption; in fact we could miss energy peaks. Is this right?

Thanks in advance.


Robert Wall's picture

Re: Question about emonTx V3 sampling method

1480 samples is the number that has always been used. It is a compromise (maybe not the best) because you are aiming for the smallest "end-effect" so that the error arising from sampling only part of a full cycle is small and averaged out of as many cycles as reasonably possible. (But of course on battery power you want to keep it alive for the minimum period of time.) Feel free to change the number if you wish. The best way to approach that is to time how many samples you actually get per second (using millis( )), and calculate how many samples you get in an integral number of cycles over about 0.2 s.

Yes, you are right, you will miss some peaks. But you will also miss troughs so hopefully over time these will average out.

Be aware that if you do have battery power, you can only measure current, and you assume a voltage and load power factor in order to estimate power and energy.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.