emontx3 icon indicating copy to clipboard operation
emontx3 copied to clipboard

Apparent bug in calibration channels

Open montgomeryb opened this issue 7 months ago • 0 comments

I pulled the latest code and had difficulty in calibrating my tx3 for my US system. On investigating the various libraries I believe the calibration code is using the wrong channels. I changed it locally and it seems to be working now as I expected it to.

In emonTx34_CM.ino it has:

    EmonLibCM_SetADC_IChannel(1, EEProm.i1Cal, EEProm.i1Lead);           // ADC Input channel, current calibration, phase calibration
    EmonLibCM_SetADC_IChannel(2, EEProm.i2Cal, EEProm.i2Lead);           // The current channels will be read in this order
    EmonLibCM_SetADC_IChannel(3, EEProm.i3Cal, EEProm.i3Lead);           // 90.91 for 100 A : 50 mA c.t. with 22R burden - v.t. leads c.t by ~4.2 degrees
    EmonLibCM_SetADC_IChannel(4, EEProm.i4Cal, EEProm.i4Lead);           // 16.67 for 100 A : 50 mA c.t. with 120R burden - v.t. leads c.t by ~1 degree

In emonTx34_CM_config.ino though it has:

    case 1 : EmonLibCM_ReCalibrate_IChannel(3, k2, k3);
      EEProm.i1Cal = k2;
      EEProm.i1Lead = k3;
      break;

    case 2 : EmonLibCM_ReCalibrate_IChannel(4, k2, k3);
      EEProm.i2Cal = k2;
      EEProm.i2Lead = k3;
      break;

    case 3 : EmonLibCM_ReCalibrate_IChannel(5, k2, k3);
      EEProm.i3Cal = k2;
      EEProm.i3Lead = k3;
      break;

    case 4 : EmonLibCM_ReCalibrate_IChannel(6, k2, k3);
      EEProm.i4Cal = k2;
      EEProm.i4Lead = k3;
      break;

I changed the first parameters in the switch to 1 through 4.

montgomeryb avatar Jul 31 '24 18:07 montgomeryb