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

Support for ZMPT101B AC Single Phase Voltage Sensor Module #2537

Open
amarendrapramanik opened this issue Sep 20, 2022 · 3 comments
Open

Support for ZMPT101B AC Single Phase Voltage Sensor Module #2537

amarendrapramanik opened this issue Sep 20, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@amarendrapramanik
Copy link

Description

Hay there,

Kindly extend support for ZMPT101B AC Single Phase Voltage Sensor Module.

Solution

No response

Alternatives

No response

Additional context

No response

@amarendrapramanik amarendrapramanik added the enhancement New feature or request label Sep 20, 2022
@mcspr
Copy link
Collaborator

mcspr commented Sep 20, 2022

Judging by these two documents, don't we already support it as EmonAnalogSensor? We calculate R for the input, and simply read A0 aka ADC voltage
ZMPT101B specification.pdf
ZMPT101B innovatorsguru.pdf

@amarendrapramanik
Copy link
Author

You are correct but some significant modification needs to be done to calibrate the sensor with the actual reading.

This portion of the code preventing creating sinusoidal wave at the output

unsigned int analogRead() override {
  auto now = TimeSource::now();
  if (now - _last > _interval) {
    _last = now;
    _value = ::analogRead(A0);
  }
  return _value;
}

Instead we need to hit A0 with minimal time gap.
Also could you please explain more about EMON_CURRENT_RATIO
Current ratio in the clamp (30A/1V)

What is the context of using here?

@mcspr
Copy link
Collaborator

mcspr commented Sep 24, 2022

Interval is there based on the SDK docs and some feedback at the esp8266/Arduino repo. We can't continuously read ADC, WiFi driver will lose its mind and break since we load the system too much.

afaik ESP8266 ADC has two ways of reading it

re. ratio code. It was pretty much the same since originally introduced, working as a simple multiplier of the raw readings. Note that I am neither the original author or actually use the sensor in question

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

No branches or pull requests

2 participants