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 摘要。