Issue in EmontxV3.4 with Continuous Firmware Calibration

I´ve update to the new Continuous Monitoring firmware in my EmontxV3.4, i enable in the firmware to show current for calibration. All 4 CT´s show the same current after calibration but P1 is always 15w higher than P2,P3 and P4 is lower 30w of P2-P3.

MSG:13,Vrms:233.17,I1:1.57,I2:1.56,I3:1.57,I4:1.57,pf1:0.7637,pf2:0.7237,pf3:0.7326,pf4:0.6592,P1:279,P2:264,P3:268,P4:241,E1:10,E2:9,E3:10,E4:9,pulse:288
MSG:14,Vrms:232.34,I1:1.57,I2:1.57,I3:1.57,I4:1.57,pf1:0.7636,pf2:0.7240,pf3:0.7329,pf4:0.6597,P1:279,P2:264,P3:268,P4:241,E1:11,E2:10,E3:10,E4:9,pulse:288
MSG:15,Vrms:231.87,I1:1.58,I2:1.58,I3:1.58,I4:1.59,pf1:0.7649,pf2:0.7254,pf3:0.7346,pf4:0.6616,P1:281,P2:266,P3:270,P4:243,E1:12,E2:11,E3:11,E4:10,pulse:309
MSG:16,Vrms:232.81,I1:1.59,I2:1.58,I3:1.59,I4:1.59,pf1:0.7655,pf2:0.7266,pf3:0.7354,pf4:0.6621,P1:283,P2:268,P3:271,P4:245,E1:12,E2:12,E3:12,E4:11,pulse:336
MSG:17,Vrms:232.74,I1:1.59,I2:1.59,I3:1.59,I4:1.60,pf1:0.7677,pf2:0.7286,pf3:0.7373,pf4:0.6646,P1:285,P2:270,P3:273,P4:247,E1:13,E2:12,E3:13,E4:11,pulse:364
MSG:18,Vrms:233.07,I1:1.58,I2:1.57,I3:1.58,I4:1.58,pf1:0.7650,pf2:0.7251,pf3:0.7337,pf4:0.6610,P1:281,P2:266,P3:270,P4:243,E1:14,E2:13,E3:13,E4:12,pulse:389

I´ve plugged in a SONOFF-POW to compare and I have values like P2-P3…

What is reading wrong to get these different values on the Power??
What is the “float i4Lead” values for in firmware??

Edit - formatted for readability. BT, Moderator

If you download emonLibCM, in the zip file you will find documentation for the library, which explains all calibration variables. You will have noticed that each channel shows a different power factor. Until you calibrate each channel for the current transformer that will be used for that channel, you should expect differences due to each c.t. having slightly different characteristics to the next one.

I have read the info in the emonLibCM but I fond that in the file EmonLibCM.cpp these options:

// --------------  general global variables -----------------
// Some of these variables are used in multiple blocks so cannot be static.
// For integer maths, many variables need to be 'long' or in extreme cases 'int64_t'

double currentCal[max_no_of_channels] = {90.91, 90.91, 90.91, 16.67, 90.91};
double  phaseCal_CT[max_no_of_channels] ={4.2, 4.2, 4.2, 1.0, 4.2}; 

double voltageCal = 268.97;

Do i have to change here values???

I have made my ICalibration as the sketch show the same current for the 4 CT´s

I1:1.58,I2:1.57,I3:1.58,I4:1.58
pf1:0.7637,pf2:0.7237,pf3:0.7326,pf4:0.6592
P1:279,P2:264,P3:268,P4:241

To adjust the PF so I can get the same power on the 4 channels I have to change the default value (4.2º) in phaseCAL???

No, you change them in your sketch. Those are the defaults that the sketch overrides.

The sketch source code is probably the safest place to make changes, as you have a record of the values you set.

You can also change them (I think, Trystan wrote the sketch) on-line using the Arduino IDE’s serial monitor. I don’t think he’s documented that. Here’s the documentation for my complete version, but I do know not everything mentioned in this is implemented in your sketch.

Config.pdf (47.9 KB)

I think the text that the sketch shows when you enter the Configuration Mode at power-up will be correct for that sketch, though.

@Robert.Wall, In that doc, you say if RFM turned off the calibration is not available.

I’m obviously missing why. Does the RFM chip do the calculations?

Thinking about my serial connected Pi. It seems reasonable to turn off the RFM chip as it is not needed, but I’d like to calibrate the emonTX.

Do you mean this sentence:

When RFM wireless data is turned off, the serial output in a format suitable for the
ESP8266 WiFi module is automatically turned on, and on-line calibration & configuration is therefore not available.

That’s because I have to turn the calibration off when the ESP8266 is used because it screws up the calibration when it sends rogue characters back into the emonTx. If you’re not using the ESP8266, you can calibrate using the serial interface. In the “latest and greatest” that nobody has seen yet, the user must turn calibration on at startup, else it defaults to off. Hopefully, that will circumvent the nuisance.

It wasn’t phrased very well.

Sounds good. I presumably need to modify the sketch to do so or is it something in the library? I was trying to keep this as standard as possible to document for others to use.

I’d say it was a little ambiguous hence the question.

I’m battling the EEPROM and RFM problems at the moment - I’ve got libraries for both that I’m working on. The “RFM transmit only” library is lightly linked to the configuration options, the EEPROM library is heavily linked.

There cannot be a standard piece of code for configuration, because it has to be tailored for each sketch - unless you/the users in general can tolerate commands that have no effect.

You can have the latest if you want, but you might need to change it depending on the sketch you’ve derived yours from. I’m not convinced it’s ready for general release yet.

1 Like

No leave it. This ‘project’ is to generate a general howto so don’t want anything that does not work with a reasonably standard setup.

Is the calibration method still the same for the CMLib?

The steps for calibration will always be more or less the same - clearly the 3-phase sketch is always going to be slightly different in detail.

What is changing is the method by which the values that the sketch uses to apply the calibration are themselves changed by the user, and the way that those values are managed in the sketch (which should be transparent to the user).

I’m trying to get to the point where there’s one ‘config.ino’ file per sketch, all based on a common template but each having minor differences as dictated by the host sketch. It will use an absolutely standard EEPROM library that also allows multiple configurations from different sketches to exist without the possibility of conflict that exists with the present implementation.

If, as Paul B has suggested elsewhere, there’s a 2-way data data channel whereby you can emulate the Arduino IDE from a distance, then “OTA” updates and calibration would be available to the user.

1 Like