Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Measuring Phase Error difference for emonLibCM

Here is a sketch that will enable a precise measurement of the difference in phase errors of the a.c. adapter and current transformer. This is the value for phaseCal that is used by emonLibCM to compensate for the combined effect of the phase errors of the two transformers.

It works in a completely different way to the standard sketch, so unfortunately there is no realistic possibility of combining the two sketches, not least because of memory constraints.

Using the sketch

You must be prepared to compile and upload this sketch (ideally using the Arduino IDE – I cannot support platformio) to test and record the values that the “working” sketch needs, and afterwards to download from Github the “default” or working sketch that was in your emonTx when you received it, compile and upload that and then calibrate it using the values you have measured.

The zip file contains the sketch and documentation. Unzip the contents into your Arduino sketchbook directory, then configure the sketch according to the documentation.
The User Documentation PDF file can be moved or copied to a convenient location of your choosing.

emonTx_Phase_Calibrator.zip (83.0 KB)

MD5 hashes:

File Hash
emonTx_Phase_Calibrator.zip: 36088a5ac5801d95b3b64e6295a87e2c
emonTx_Phase_Calibrator.ino: b96537438a7aea01d54922822776173b
emonTx_Phase_Calibrator_config.ino: 4cf30bb01997f49341dbcbd46d6c4405
emonTx Phase Calibrator User Doc.pdf: 078d2fd0c25d3ade24fe7162e692aad1

Any future updates will be published here.

3 Likes

Cheers Robert (can’t believe no one has commented on this!) - I’ll take a look over the weekend

I guess many (most?) users these days don’t have a programmer to be able to do it.

I had a quick go - it was really straightforward. If you recall, I’ve got an arduino / raspberry pi 3 setup running emonLibCM / emonCMS (emonSD build). When I installed emonCMS, I also also installed the arduino IDE on to the PI so that I could remote on to the arduino to tinker so it was really staightforward.

Without any additional voltage / current calibration steps (I was a little short on time), I used your sketch to determine that my phase calibration was closer to 2 than the 4.2 it had been set at.

I’ve left it running a week with the modified phase calibration and the percentage difference between the calculated Wh and the pulse count is less than 0.3% at present. I’m off this week so will tinker a little more and perform a full calibration using this sketch.

Thanks

1 Like

That doesn’t surprise me. The phase error values aren’t specified in any data sheets, and they change - over time with different batches of materials, manufacturing changes, and in response to the actual current or voltage they are working at. So any preset value isn’t guaranteed to be accurate for the previous or the next batch, even when measured at the same voltage/current.

And of course, the value you measured is the difference between the v.t. and the c.t., so it’s influenced by both.