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.


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


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