Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apparent bug in calibration channels #19

Open
montgomeryb opened this issue Jul 31, 2024 · 0 comments
Open

Apparent bug in calibration channels #19

montgomeryb opened this issue Jul 31, 2024 · 0 comments

Comments

@montgomeryb
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant