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

Question Emon analog: Calibration value different from read value #876

Closed
mambagr opened this issue May 22, 2018 · 11 comments
Closed

Question Emon analog: Calibration value different from read value #876

mambagr opened this issue May 22, 2018 · 11 comments

Comments

@mambagr
Copy link

mambagr commented May 22, 2018

(corrected)
Hi
I am testing a Wemos D1 mini with an analog current sensor and the EmonAnalog input.
I am calibrating using a known load (although not a pure resistive load).
The problem is that after calibration (aprox. 1893W), the value pressented in the status page (~2300W) is way off the calibrated value for the same load. If i power the sensor through the 5v instead of 3.3v the read value is ever bigger ~3200W.
I don't think it has anything to do with the type of load as it apparenly calibrates and reads the apparent (pun intended) value.
Am i doing something wrong?
I didn't look at the source code thoroughly because i am sure it was made by more experienced people than me in this area.
The sensor i use is the 30A version of the ACS712.
(https://www.ebay.com/itm/5A-20A-30A-Range-Current-Sensor-Module-ACS712-Module-Arduino-Module-For-Arduino-/272375548296?var=&hash=item3f6ad90988)

@xoseperez
Copy link
Owner

The nominal calibration value for the 30A ACS712 is 66mV/A or 15.15A/V. That value is not visible in the web UI but you can log to the device (telnet) and query it:

get pwrRatioC

@mambagr
Copy link
Author

mambagr commented May 23, 2018

Using get pwrRatioC i get
$-1

I connect the load, calibrate and switch to status page. Shouln't it show the same Watt that i entered?

@xoseperez
Copy link
Owner

xoseperez commented May 23, 2018

It should, and the fact that pwrRatioC returns -1 means it's NOT storing the calibration values. Do you click "Save" after entering the values?

@mambagr
Copy link
Author

mambagr commented May 23, 2018

Yep. I also get the "Settings saved".

@xoseperez xoseperez added the bug label May 25, 2018
@mambagr
Copy link
Author

mambagr commented May 28, 2018

Verified with another D1 mini. 'get pwrRatioC' returns '$-1'

@xoseperez xoseperez modified the milestones: 1.12.7, 1.13.0 May 29, 2018
@xoseperez
Copy link
Owner

OK, there was a problem in the EmonSensor. It wasn't recalculating some internal variables based on the stored power ratio, so calibration was not working.

Anyway, I cannot reproduce the issue with ESPurna not storing the pwrRatioC setting. This is the code responsible for calling the sensor class to recalculate the power ratio and the store it:

if (value = getSetting("pwrExpectedP", 0).toInt()) {
sensor->expectedPower(0, value);
setSetting("pwrRatioC", sensor->getCurrentRatio(0));
}

As you can see, the only reason to avoid storing the pwrRatioC value is that the pwrExpectedP is 0.

@xoseperez
Copy link
Owner

What value do you enter in the "Expected Power" field?

@mambagr
Copy link
Author

mambagr commented Jun 18, 2018

Sorry just noticed the email.
I tried with a 1893W heater so i entered "1893W"
I am also troubled that i had to include the "W" symbol or else i could not save (no "Settings saved" popup)

@xoseperez
Copy link
Owner

No, it expects a number, no "W" at all.

@xoseperez
Copy link
Owner

1.13.0 has been released with changes in this issue. Feel free to reopen if problem persists.

@HFsi
Copy link

HFsi commented Jun 5, 2019

I'm about to start playing with current measurements.... which version should I try? I have an ESP01, an ACS712 and an ADS1115

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

No branches or pull requests

3 participants