sparkfun / sparkfun/SparkFun_ADE7953_Arduino_Library

Example 08 zero calibration does not affect displayed Amps value

未关闭 适合新手
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C++
星标
1
派生
0
平均合并
1 分钟
30 天内合并 PR
1

描述

uint32_t corrected =
    (rawIrms > zeroOffset) ? (rawIrms - zeroOffset) : 0;

In Example 08 (`Example08_DiagnosticTool`), the `z` command calculates a local
`zeroOffset` from raw IRMS readings. That offset is applied to the displayed
`Corrected` and `Averaged` raw values as above.

However, the displayed current in amps is obtained independently using:

mySensor.getCurrentA(amps);

Consequently, zero calibration does not affect the Amps field. For example,
after zeroing, Corrected may be near zero while Amps continues to show the
original no-load value.

Also, linear subtraction of two RMS magnitudes is not generally the correct
noise-floor correction. The library already provides autoCalibrateA(), which
performs the correction in the squared/RMS domain.

Would you consider changing the z command to use the library calibration?

For example:
void doZeroCalibration()
{
    const uint16_t NUM_SAMPLES = 50;

    Serial.println(
        F("\nZero calibration - keep the CT connected with no current flowing."));

    if (mySensor.autoCalibrateA(NUM_SAMPLES) != ksfTkErrOk)
    {
        Serial.println(F("Zero calibration failed!"));
        return;
    }

    resetBuffer();
    Serial.println(F("Channel A zero calibration complete.\n"));
}

The r command could correspondingly call:

mySensor.clearCalibration();

This would make the zero operation affect getCurrentA(amps) directly and
would avoid having two independent calibration paths in the example.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Example08_DiagnosticTool 中的 doZeroCalibration 和 z/r 命令处理程序开始;将本地 zeroOffset 路径与 mySensor.getCurrentA(amps) 进行比较。确认库的校准 API 使用一致,并确认归零或重置后,显示的 Amps 和 raw 字段反映了校准结果。

由索引模型根据 Issue 内容生成。

评估

技术栈
arduino, cpp
领域
embedded-iot
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
活跃
描述清晰度
描述清楚
新手友好度
78/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。