Browse Source

New power modules tested with V9261F

fastled
Xose Pérez 7 years ago
parent
commit
6f5c627625
11 changed files with 3738 additions and 3729 deletions
  1. +19
    -15
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +83
    -78
      code/espurna/power.ino
  4. +12
    -15
      code/espurna/power_emon.ino
  5. +6
    -8
      code/espurna/power_hlw8012.ino
  6. +13
    -10
      code/espurna/power_v9261f.ino
  7. +3543
    -3544
      code/espurna/static/index.html.gz.h
  8. +6
    -0
      code/espurna/utils.ino
  9. +20
    -13
      code/espurna/web.ino
  10. +2
    -2
      code/html/custom.js
  11. +34
    -44
      code/html/index.html

+ 19
- 15
code/espurna/config/general.h View File

@ -528,33 +528,36 @@ PROGMEM const char* const custom_reset_string[] = {
#define POWER_CURRENT_PRECISION 3 #define POWER_CURRENT_PRECISION 3
#define POWER_VOLTAGE 230 #define POWER_VOLTAGE 230
#define POWER_CURRENT_RATIO 30
#define POWER_SAMPLES 1000
#define POWER_READ_INTERVAL 10000 #define POWER_READ_INTERVAL 10000
#define POWER_REPORT_INTERVAL 60000 #define POWER_REPORT_INTERVAL 60000
#define POWER_REPORT_BUFFER 10
#define POWER_ENERGY_FACTOR (POWER_REPORT_INTERVAL / 1000.0 / 3600.0) #define POWER_ENERGY_FACTOR (POWER_REPORT_INTERVAL / 1000.0 / 3600.0)
#define POWER_CURRENT_DECIMALS 2
#define POWER_VOLTAGE_DECIMALS 0
#define POWER_POWER_DECIMALS 0
#if POWER_PROVIDER == POWER_PROVIDER_EMON_ANALOG #if POWER_PROVIDER == POWER_PROVIDER_EMON_ANALOG
#define POWER_REPORT_BUFFER 10
#define POWER_ADC_BITS 10
#define POWER_REFERENCE_VOLTAGE 1.0
#define POWER_CURRENT_OFFSET 0.25
#define EMON_CURRENT_RATIO 30
#define EMON_SAMPLES 1000
#define EMON_ADC_BITS 10
#define EMON_REFERENCE_VOLTAGE 1.0
#define EMON_CURRENT_OFFSET 0.25
#undef ADC_VCC_ENABLED #undef ADC_VCC_ENABLED
#define ADC_VCC_ENABLED 0 #define ADC_VCC_ENABLED 0
#endif #endif
#if POWER_PROVIDER == POWER_PROVIDER_EMON_ADC121 #if POWER_PROVIDER == POWER_PROVIDER_EMON_ADC121
#define POWER_REPORT_BUFFER 10
#define POWER_I2C_ADDRESS 0x50
#define POWER_ADC_BITS 12
#define POWER_REFERENCE_VOLTAGE 3.3
#define POWER_CURRENT_OFFSET 0.10
#define EMON_CURRENT_RATIO 30
#define EMON_SAMPLES 1000
#define EMON_ADC_BITS 12
#define EMON_REFERENCE_VOLTAGE 3.3
#define EMON_CURRENT_OFFSET 0.10
#define ADC121_I2C_ADDRESS 0x50
#undef I2C_SUPPORT #undef I2C_SUPPORT
#define I2C_SUPPORT 1 #define I2C_SUPPORT 1
#endif #endif
#if POWER_PROVIDER == POWER_PROVIDER_HLW8012 #if POWER_PROVIDER == POWER_PROVIDER_HLW8012
#define POWER_REPORT_BUFFER 10
#define HLW8012_USE_INTERRUPTS 1 #define HLW8012_USE_INTERRUPTS 1
#define HLW8012_SEL_CURRENT HIGH #define HLW8012_SEL_CURRENT HIGH
#define HLW8012_CURRENT_R 0.001 #define HLW8012_CURRENT_R 0.001
@ -563,12 +566,13 @@ PROGMEM const char* const custom_reset_string[] = {
#endif #endif
#if POWER_PROVIDER == POWER_PROVIDER_V9261F #if POWER_PROVIDER == POWER_PROVIDER_V9261F
#undef POWER_REPORT_BUFFER
#define POWER_REPORT_BUFFER 60 #define POWER_REPORT_BUFFER 60
#define V9261F_SYNC_INTERVAL 600 #define V9261F_SYNC_INTERVAL 600
#define V9261F_BAUDRATE 4800 #define V9261F_BAUDRATE 4800
#define V9261F_CURRENT_FACTOR 81156358
#define V9261F_VOLTAGE_FACTOR 4178508
#define V9261F_POWER_FACTOR 157859
#define V9261F_CURRENT_FACTOR 79371434.0
#define V9261F_VOLTAGE_FACTOR 4160651.0
#define V9261F_POWER_FACTOR 153699.0
#define V9261F_RPOWER_FACTOR V9261F_CURRENT_FACTOR #define V9261F_RPOWER_FACTOR V9261F_CURRENT_FACTOR
#endif #endif


BIN
code/espurna/data/index.html.gz View File


+ 83
- 78
code/espurna/power.ino View File

@ -89,57 +89,7 @@ void _powerReset() {
#endif #endif
} }
// -----------------------------------------------------------------------------
// MAGNITUDE API
// -----------------------------------------------------------------------------
bool hasActivePower() {
return POWER_HAS_ACTIVE;
}
double getCurrent() {
return _power_current;
}
double getVoltage() {
return _power_voltage;
}
double getApparentPower() {
return _power_apparent;
}
double getActivePower() {
return _power_active;
}
double getReactivePower() {
return _power_reactive;
}
double getPowerFactor() {
return _power_factor;
}
// -----------------------------------------------------------------------------
// PUBLIC API
// -----------------------------------------------------------------------------
bool powerEnabled() {
return _power_enabled;
}
void powerEnabled(bool enabled) {
if (enabled & !_power_enabled) _powerReset();
_power_enabled = enabled;
powerEnabledProvider();
}
void powerConfigure() {
powerConfigureProvider();
}
void powerRead() {
void _powerRead() {
// Get instantaneous values from HAL // Get instantaneous values from HAL
double current = _powerCurrent(); double current = _powerCurrent();
@ -147,6 +97,8 @@ void powerRead() {
double apparent = _powerApparentPower(); double apparent = _powerApparentPower();
#if POWER_HAS_ACTIVE #if POWER_HAS_ACTIVE
double active = _powerActivePower(); double active = _powerActivePower();
double reactive = (apparent > active) ? sqrt(apparent * apparent - active * active) : 0;
double factor = (apparent > 0) ? active / apparent : 1;
#endif #endif
// Filters // Filters
@ -157,40 +109,43 @@ void powerRead() {
_filter_active.add(active); _filter_active.add(active);
#endif #endif
/* THERE IS A BUG HERE SOMEWHERE :)
char current_buffer[10]; char current_buffer[10];
dtostrf(current, sizeof(current_buffer)-1, POWER_CURRENT_PRECISION, current_buffer); dtostrf(current, sizeof(current_buffer)-1, POWER_CURRENT_PRECISION, current_buffer);
DEBUG_MSG_P(PSTR("[POWER] Current: %sA\n"), current_buffer); DEBUG_MSG_P(PSTR("[POWER] Current: %sA\n"), current_buffer);
DEBUG_MSG_P(PSTR("[POWER] Voltage: %sA\n"), voltage);
DEBUG_MSG_P(PSTR("[POWER] Apparent Power: %dW\n"), apparent);
DEBUG_MSG_P(PSTR("[POWER] Voltage: %sA\n"), int(voltage));
DEBUG_MSG_P(PSTR("[POWER] Apparent Power: %dW\n"), int(apparent));
#if POWER_HAS_ACTIVE #if POWER_HAS_ACTIVE
DEBUG_MSG_P(PSTR("[POWER] Active Power: %dW\n"), active);
DEBUG_MSG_P(PSTR("[POWER] Reactive Power: %dW\n"), getReactivePower());
DEBUG_MSG_P(PSTR("[POWER] Power Factor: %d%%\n"), 100 * getPowerFactor());
DEBUG_MSG_P(PSTR("[POWER] Active Power: %dW\n"), int(active));
DEBUG_MSG_P(PSTR("[POWER] Reactive Power: %dW\n"), int(reactive));
DEBUG_MSG_P(PSTR("[POWER] Power Factor: %d%%\n"), int(100 * factor));
#endif #endif
*/
// Update websocket clients // Update websocket clients
#if WEB_SUPPORT #if WEB_SUPPORT
{
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["powerVisible"] = 1;
root["powerCurrent"] = String(current_buffer);
root["powerVoltage"] = voltage;
root["powerApparentPower"] = apparent;
#if POWER_HAS_ACTIVE
root["powerActivePower"] = active;
root["powerReactivePower"] = getReactivePower();
root["powerPowerfactor"] = int(100 * getPowerFactor());
#endif
String output;
root.printTo(output);
wsSend(output.c_str());
}
if (wsConnected()) {
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["pwrVisible"] = 1;
root["pwrCurrent"] = roundTo(current, POWER_CURRENT_DECIMALS);
root["pwrVoltage"] = roundTo(voltage, POWER_VOLTAGE_DECIMALS);
root["pwrApparent"] = roundTo(apparent, POWER_POWER_DECIMALS);
#if POWER_HAS_ACTIVE
root["pwrFullVisible"] = 1;
root["pwrActive"] = roundTo(active, POWER_POWER_DECIMALS);
root["pwrReactive"] = roundTo(reactive, POWER_POWER_DECIMALS);
root["pwrFactor"] = int(100 * factor);
#endif
String output;
root.printTo(output);
wsSend(output.c_str());
}
#endif #endif
} }
void powerReport() {
void _powerReport() {
// Get the fitered values // Get the fitered values
_power_current = _filter_current.average(true); _power_current = _filter_current.average(true);
@ -255,6 +210,56 @@ void powerReport() {
} }
// -----------------------------------------------------------------------------
// MAGNITUDE API
// -----------------------------------------------------------------------------
bool hasActivePower() {
return POWER_HAS_ACTIVE;
}
double getCurrent() {
return roundTo(_power_current, POWER_CURRENT_DECIMALS);
}
double getVoltage() {
return roundTo(_power_voltage, POWER_VOLTAGE_DECIMALS);
}
double getApparentPower() {
return roundTo(_power_apparent, POWER_POWER_DECIMALS);
}
double getActivePower() {
return roundTo(_power_active, POWER_POWER_DECIMALS);
}
double getReactivePower() {
return roundTo(_power_reactive, POWER_POWER_DECIMALS);
}
double getPowerFactor() {
return roundTo(_power_factor, 2);
}
// -----------------------------------------------------------------------------
// PUBLIC API
// -----------------------------------------------------------------------------
bool powerEnabled() {
return _power_enabled;
}
void powerEnabled(bool enabled) {
if (enabled & !_power_enabled) _powerReset();
_power_enabled = enabled;
_powerEnabledProvider();
}
void powerConfigure() {
_powerConfigureProvider();
}
void powerSetup() { void powerSetup() {
// backwards compatibility // backwards compatibility
@ -267,7 +272,7 @@ void powerSetup() {
moveSetting("powCurrentMult", "powerRatioC"); moveSetting("powCurrentMult", "powerRatioC");
moveSetting("powVoltageMult", "powerRatioV"); moveSetting("powVoltageMult", "powerRatioV");
powerSetupProvider();
_powerSetupProvider();
// API // API
#if WEB_SUPPORT #if WEB_SUPPORT
@ -280,20 +285,20 @@ void powerSetup() {
void powerLoop() { void powerLoop() {
powerLoopProvider(true);
_powerLoopProvider(true);
if (_power_newdata) { if (_power_newdata) {
_power_newdata = false; _power_newdata = false;
powerRead();
_powerRead();
} }
static unsigned long last = 0; static unsigned long last = 0;
if (millis() - last > POWER_REPORT_INTERVAL) { if (millis() - last > POWER_REPORT_INTERVAL) {
last = millis(); last = millis();
powerReport();
_powerReport();
} }
powerLoopProvider(false);
_powerLoopProvider(false);
} }


+ 12
- 15
code/espurna/power_emon.ino View File

@ -46,7 +46,7 @@ unsigned int currentCallback() {
#if POWER_PROVIDER == POWER_PROVIDER_EMON_ADC121 #if POWER_PROVIDER == POWER_PROVIDER_EMON_ADC121
uint8_t buffer[2]; uint8_t buffer[2];
brzo_i2c_start_transaction(POWER_I2C_ADDRESS, I2C_SCL_FREQUENCY);
brzo_i2c_start_transaction(ADC121_I2C_ADDRESS, I2C_SCL_FREQUENCY);
buffer[0] = ADC121_REG_RESULT; buffer[0] = ADC121_REG_RESULT;
brzo_i2c_write(buffer, 1, false); brzo_i2c_write(buffer, 1, false);
brzo_i2c_read(buffer, 2, false); brzo_i2c_read(buffer, 2, false);
@ -60,6 +60,8 @@ unsigned int currentCallback() {
} }
// -----------------------------------------------------------------------------
// POWER API
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
double _powerCurrent() { double _powerCurrent() {
@ -67,8 +69,8 @@ double _powerCurrent() {
static double current = 0; static double current = 0;
if (millis() - last > 1000) { if (millis() - last > 1000) {
last = millis(); last = millis();
current = _emon.getCurrent(POWER_SAMPLES);
current -= POWER_CURRENT_OFFSET;
current = _emon.getCurrent(EMON_SAMPLES);
current -= EMON_CURRENT_OFFSET;
if (current < 0) current = 0; if (current < 0) current = 0;
} }
return current; return current;
@ -94,29 +96,24 @@ double _powerPowerFactor() {
return 1; return 1;
} }
// -----------------------------------------------------------------------------
// PUBLIC API
// -----------------------------------------------------------------------------
void powerEnabledProvider() {
void _powerEnabledProvider() {
// Nothing to do // Nothing to do
} }
void powerConfigureProvider() {
_emon.setCurrentRatio(getSetting("powerRatioC", POWER_CURRENT_RATIO).toFloat());
void _powerConfigureProvider() {
_emon.setCurrentRatio(getSetting("powerRatioC", EMON_CURRENT_RATIO).toFloat());
_power_voltage = getSetting("powerVoltage", POWER_VOLTAGE).toFloat(); _power_voltage = getSetting("powerVoltage", POWER_VOLTAGE).toFloat();
} }
void powerSetupProvider() {
void _powerSetupProvider() {
_emon.initCurrent(currentCallback, POWER_ADC_BITS, POWER_REFERENCE_VOLTAGE, POWER_CURRENT_RATIO);
_emon.initCurrent(currentCallback, EMON_ADC_BITS, EMON_REFERENCE_VOLTAGE, EMON_CURRENT_RATIO);
#if POWER_PROVIDER == POWER_PROVIDER_EMON_ADC121 #if POWER_PROVIDER == POWER_PROVIDER_EMON_ADC121
uint8_t buffer[2]; uint8_t buffer[2];
buffer[0] = ADC121_REG_CONFIG; buffer[0] = ADC121_REG_CONFIG;
buffer[1] = 0x00; buffer[1] = 0x00;
brzo_i2c_start_transaction(POWER_I2C_ADDRESS, I2C_SCL_FREQUENCY);
brzo_i2c_start_transaction(ADC121_I2C_ADDRESS, I2C_SCL_FREQUENCY);
brzo_i2c_write(buffer, 2, false); brzo_i2c_write(buffer, 2, false);
brzo_i2c_end_transaction(); brzo_i2c_end_transaction();
#endif #endif
@ -127,7 +124,7 @@ void powerSetupProvider() {
} }
void powerLoopProvider(bool before) {
void _powerLoopProvider(bool before) {
if (before) { if (before) {


+ 6
- 8
code/espurna/power_hlw8012.ino View File

@ -73,6 +73,8 @@ void _hlwExpectedVoltage(unsigned int voltage) {
} }
} }
// -----------------------------------------------------------------------------
// POWER API
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
double _powerCurrent() { double _powerCurrent() {
@ -104,11 +106,7 @@ double _powerPowerFactor() {
return 1; return 1;
} }
// -----------------------------------------------------------------------------
// PUBLIC API
// -----------------------------------------------------------------------------
void powerEnabledProvider() {
void _powerEnabledProvider() {
if (_power_enabled) { if (_power_enabled) {
attachInterrupt(HLW8012_CF1_PIN, _hlw_cf1_isr, CHANGE); attachInterrupt(HLW8012_CF1_PIN, _hlw_cf1_isr, CHANGE);
attachInterrupt(HLW8012_CF_PIN, _hlw_cf_isr, CHANGE); attachInterrupt(HLW8012_CF_PIN, _hlw_cf_isr, CHANGE);
@ -118,12 +116,12 @@ void powerEnabledProvider() {
} }
} }
void powerConfigureProvider() {
void _powerConfigureProvider() {
_hlwSetCalibration(); _hlwSetCalibration();
_hlwGetCalibration(); _hlwGetCalibration();
} }
void powerSetupProvider() {
void _powerSetupProvider() {
// Initialize HLW8012 // Initialize HLW8012
// void begin(unsigned char cf_pin, unsigned char cf1_pin, unsigned char sel_pin, unsigned char currentWhen = HIGH, bool use_interrupts = false, unsigned long pulse_timeout = PULSE_TIMEOUT); // void begin(unsigned char cf_pin, unsigned char cf1_pin, unsigned char sel_pin, unsigned char currentWhen = HIGH, bool use_interrupts = false, unsigned long pulse_timeout = PULSE_TIMEOUT);
@ -155,7 +153,7 @@ void powerSetupProvider() {
} }
void powerLoopProvider(bool before) {
void _powerLoopProvider(bool before) {
if (before) { if (before) {


+ 13
- 10
code/espurna/power_v9261f.ino View File

@ -70,7 +70,7 @@ void _v9261fRead() {
} else if (state == 3) { } else if (state == 3) {
if (checksumOK()) {
if (_v9261fChecksum()) {
_v9261f_active = (double) ( _v9261f_active = (double) (
(_v9261f_data[3]) + (_v9261f_data[3]) +
@ -100,6 +100,11 @@ void _v9261fRead() {
(_v9261f_data[18] << 24) (_v9261f_data[18] << 24)
) / V9261F_CURRENT_FACTOR; ) / V9261F_CURRENT_FACTOR;
if (_v9261f_active < 0) _v9261f_active = 0;
if (_v9261f_reactive < 0) _v9261f_reactive = 0;
if (_v9261f_voltage < 0) _v9261f_voltage = 0;
if (_v9261f_current < 0) _v9261f_current = 0;
_power_newdata = true; _power_newdata = true;
} }
@ -123,7 +128,7 @@ void _v9261fRead() {
} }
boolean checksumOK() {
bool _v9261fChecksum() {
unsigned char checksum = 0; unsigned char checksum = 0;
for (unsigned char i = 0; i < 19; i++) { for (unsigned char i = 0; i < 19; i++) {
checksum = checksum + _v9261f_data[i]; checksum = checksum + _v9261f_data[i];
@ -132,6 +137,8 @@ boolean checksumOK() {
return checksum == _v9261f_data[19]; return checksum == _v9261f_data[19];
} }
// -----------------------------------------------------------------------------
// POWER API
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
double _powerCurrent() { double _powerCurrent() {
@ -160,24 +167,20 @@ double _powerPowerFactor() {
return 1; return 1;
} }
// -----------------------------------------------------------------------------
// PUBLIC API
// -----------------------------------------------------------------------------
void powerEnabledProvider() {
void _powerEnabledProvider() {
// Nothing to do // Nothing to do
} }
void powerConfigureProvider() {
void _powerConfigureProvider() {
// Nothing to do // Nothing to do
} }
void powerSetupProvider() {
void _powerSetupProvider() {
_v9261f_uart = new SoftwareSerial(V9261F_PIN, SW_SERIAL_UNUSED_PIN, V9261F_PIN_INVERSE, 256); _v9261f_uart = new SoftwareSerial(V9261F_PIN, SW_SERIAL_UNUSED_PIN, V9261F_PIN_INVERSE, 256);
_v9261f_uart->begin(V9261F_BAUDRATE); _v9261f_uart->begin(V9261F_BAUDRATE);
} }
void powerLoopProvider(bool before) {
void _powerLoopProvider(bool before) {
if (before) { if (before) {
_v9261fRead(); _v9261fRead();


+ 3543
- 3544
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 6
- 0
code/espurna/utils.ino View File

@ -177,3 +177,9 @@ char * ltrim(char * s) {
while ((unsigned char) *p == ' ') ++p; while ((unsigned char) *p == ' ') ++p;
return p; return p;
} }
double roundTo(double num, unsigned char positions) {
double multiplier = 1;
while (positions-- > 0) multiplier *= 10;
return round(num * multiplier) / multiplier;
}

+ 20
- 13
code/espurna/web.ino View File

@ -231,29 +231,29 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
#if POWER_PROVIDER == POWER_PROVIDER_HLW8012 #if POWER_PROVIDER == POWER_PROVIDER_HLW8012
if (key == "powExpectedPower") {
if (key == "hlwExpectedPower") {
_hlwExpectedPower(value.toInt()); _hlwExpectedPower(value.toInt());
changed = true; changed = true;
} }
if (key == "powExpectedVoltage") {
if (key == "hlwExpectedVoltage") {
_hlwExpectedVoltage(value.toInt()); _hlwExpectedVoltage(value.toInt());
changed = true; changed = true;
} }
if (key == "powExpectedCurrent") {
if (key == "hlwExpectedCurrent") {
_hlwExpectedCurrent(value.toFloat()); _hlwExpectedCurrent(value.toFloat());
changed = true; changed = true;
} }
if (key == "powExpectedReset") {
if (key == "hlwExpectedReset") {
if (value.toInt() == 1) { if (value.toInt() == 1) {
_hlwResetCalibration(); _hlwResetCalibration();
changed = true; changed = true;
} }
} }
if (key.startsWith("pow")) continue;
if (key.startsWith("hlw")) continue;
#endif #endif
@ -591,16 +591,23 @@ void _wsStart(uint32_t client_id) {
#endif #endif
#if POWER_PROVIDER != POWER_PROVIDER_NONE #if POWER_PROVIDER != POWER_PROVIDER_NONE
root["powerVisible"] = 1;
root["powerCurrent"] = getCurrent();
root["powerVoltage"] = getVoltage();
root["powerApparentPower"] = getApparentPower();
root["pwrVisible"] = 1;
root["pwrCurrent"] = getCurrent();
root["pwrVoltage"] = getVoltage();
root["pwrApparent"] = getApparentPower();
#if POWER_HAS_ACTIVE #if POWER_HAS_ACTIVE
root["powerActivePower"] = getActivePower();
root["powerReactivePower"] = getReactivePower();
root["powerPowerfactor"] = int(100 * getPowerFactor());
root["pwrFullVisible"] = 1;
root["pwrActive"] = getActivePower();
root["pwrReactive"] = getReactivePower();
root["pwrFactor"] = int(100 * getPowerFactor());
#endif
#if POWER_PROVIDER & POWER_PROVIDER_EMON
root["emonVisible"] = 1;
root["pwrRatioC"] = getSetting("pwrRatioC", EMON_CURRENT_RATIO);
#endif
#if POWER_PROVIDER == POWER_PROVIDER_HLW8012
root["hlwVisible"] = 1;
#endif #endif
root["powerRatioC"] = getSetting("powerRatioC", POWER_CURRENT_RATIO);
#endif #endif
#if NOFUSS_SUPPORT #if NOFUSS_SUPPORT


+ 2
- 2
code/html/custom.js View File

@ -66,8 +66,8 @@ function doUpdate() {
websock.send(JSON.stringify({'config': data})); websock.send(JSON.stringify({'config': data}));
$(".powExpected").val(0);
$("input[name='powExpectedReset']")
$(".hlwExpected").val(0);
$("input[name='hlwExpectedReset']")
.prop("checked", false) .prop("checked", false)
.iphoneStyle("refresh"); .iphoneStyle("refresh");


+ 34
- 44
code/html/index.html View File

@ -111,8 +111,8 @@
<a href="#" class="pure-menu-link" data="panel-idb">INFLUXDB</a> <a href="#" class="pure-menu-link" data="panel-idb">INFLUXDB</a>
</li> </li>
<li class="pure-menu-item module module-pow">
<a href="#" class="pure-menu-link" data="panel-power">POWER</a>
<li class="pure-menu-item module module-hlw">
<a href="#" class="pure-menu-link" data="panel-hlw">HLW8012</a>
</li> </li>
<li class="pure-menu-item module module-rfb"> <li class="pure-menu-item module module-rfb">
@ -190,44 +190,34 @@
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="dhtHum" readonly /> <input class="pure-u-1 pure-u-sm-3-4" type="text" name="dhtHum" readonly />
</div> </div>
<div class="pure-g module module-emon">
<label class="pure-u-1 pure-u-sm-1-4" for="emonApparentPower">Apparent Power (VA)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="emonApparentPower" readonly />
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrCurrent">Current</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrCurrent" post=" A" readonly />
</div> </div>
<div class="pure-g module module-emon">
<label class="pure-u-1 pure-u-sm-1-4" for="emonCurrent">Current (A)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="emonCurrent" readonly />
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrVoltage">Voltage</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrVoltage" post=" V" readonly />
</div> </div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powActivePower">Active Power (W)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powActivePower" readonly />
<div class="pure-g module module-pwrFull">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrActive">Active Power</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrActive" post=" W" readonly />
</div> </div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powApparentPower">Apparent Power (VA)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powApparentPower" readonly />
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrApparent">Apparent Power</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrApparent" post=" VA" readonly />
</div> </div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powReactivePower">Reactive Power (VAR)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powReactivePower" readonly />
<div class="pure-g module module-pwrFull">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrReactive">Reactive Power</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrReactive" post=" VAR" readonly />
</div> </div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powCurrent">Current (A)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powCurrent" readonly />
</div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powVoltage">Voltage (V)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powVoltage" readonly />
</div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powPowerFactor">Power Factor</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powPowerFactor" readonly />
<div class="pure-g module module-pwrFull">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrFactor">Power Factor</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrFactor" post="%" readonly />
</div> </div>
<div class="pure-u-1 state"> <div class="pure-u-1 state">
@ -700,25 +690,25 @@
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</div> </div>
<div class="pure-g module module-pow module-emon">
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="dczPowIdx">Power IDX</label> <label class="pure-u-1 pure-u-sm-1-4" for="dczPowIdx">Power IDX</label>
<div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczPowIdx" type="number" min="0" tabindex="35" data="0" /></div> <div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczPowIdx" type="number" min="0" tabindex="35" data="0" /></div>
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</div> </div>
<div class="pure-g module module-pow module-emon">
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="dczEnergyIdx">Energy increment IDX</label> <label class="pure-u-1 pure-u-sm-1-4" for="dczEnergyIdx">Energy increment IDX</label>
<div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczEnergyIdx" type="number" min="0" tabindex="36" data="0" /></div> <div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczEnergyIdx" type="number" min="0" tabindex="36" data="0" /></div>
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</div> </div>
<div class="pure-g module module-pow">
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="dczVoltIdx">Voltage IDX</label> <label class="pure-u-1 pure-u-sm-1-4" for="dczVoltIdx">Voltage IDX</label>
<div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczVoltIdx" type="number" min="0" tabindex="37" data="0" /></div> <div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczVoltIdx" type="number" min="0" tabindex="37" data="0" /></div>
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</div> </div>
<div class="pure-g module module-pow module-emon">
<div class="pure-g module module-pwr">
<label class="pure-u-1 pure-u-sm-1-4" for="dczCurrentIdx">Current IDX</label> <label class="pure-u-1 pure-u-sm-1-4" for="dczCurrentIdx">Current IDX</label>
<div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczCurrentIdx" type="number" min="0" tabindex="38" data="0" /></div> <div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczCurrentIdx" type="number" min="0" tabindex="38" data="0" /></div>
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
@ -781,10 +771,10 @@
</div> </div>
<div class="panel" id="panel-power">
<div class="panel" id="panel-hlw">
<div class="header"> <div class="header">
<h1>POWER</h1>
<h1>HLW8012 CALIBRATION</h1>
<h2> <h2>
Calibrate your power monitor device. Use a pure resistive load and introduce the expected values for active power, current and voltage. Use the nominal values or a multimeter to get the proper numbers. Set any field to 0 to leave the calibration value untouched. Calibrate your power monitor device. Use a pure resistive load and introduce the expected values for active power, current and voltage. Use the nominal values or a multimeter to get the proper numbers. Set any field to 0 to leave the calibration value untouched.
</h2> </h2>
@ -795,29 +785,29 @@
<fieldset> <fieldset>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4" for="powExpectedPower">AC RMS Active Power</label>
<input class="pure-u-1 pure-u-md-3-4 powExpected" name="powExpectedPower" type="text" size="8" tabindex="51" placeholder="0" />
<label class="pure-u-1 pure-u-md-1-4" for="hlwExpectedPower">AC RMS Active Power</label>
<input class="pure-u-1 pure-u-md-3-4 hlwExpected" name="hlwExpectedPower" type="text" size="8" tabindex="51" placeholder="0" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">In Watts (W). If you are using a pure resistive load like a bulb this will be writen on it, otherwise use a socket multimeter to get this value.</div> <div class="pure-u-1 pure-u-md-3-4 hint">In Watts (W). If you are using a pure resistive load like a bulb this will be writen on it, otherwise use a socket multimeter to get this value.</div>
</div> </div>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4" for="powExpectedVoltage">AC RMS Voltage</label>
<input class="pure-u-1 pure-u-md-3-4 powExpected" name="powExpectedVoltage" type="text" size="8" tabindex="52" placeholder="0" />
<label class="pure-u-1 pure-u-md-1-4" for="hlwExpectedVoltage">AC RMS Voltage</label>
<input class="pure-u-1 pure-u-md-3-4 hlwExpected" name="hlwExpectedVoltage" type="text" size="8" tabindex="52" placeholder="0" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">In Volts (V). Enter your the nominal AC voltage for your household or facility, or use multimeter to get this value.</div> <div class="pure-u-1 pure-u-md-3-4 hint">In Volts (V). Enter your the nominal AC voltage for your household or facility, or use multimeter to get this value.</div>
</div> </div>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4" for="powExpectedCurrent">AC RMS Current</label>
<input class="pure-u-1 pure-u-md-3-4 powExpected" name="powExpectedCurrent" type="text" size="8" tabindex="55" placeholder="0" />
<label class="pure-u-1 pure-u-md-1-4" for="hlwExpectedCurrent">AC RMS Current</label>
<input class="pure-u-1 pure-u-md-3-4 hlwExpected" name="hlwExpectedCurrent" type="text" size="8" tabindex="55" placeholder="0" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">In Ampers (A). If you are using a pure resistive load like a bulb this will the ratio between the two previous values, i.e. power / voltage. You can also use a current clamp around one fo the power wires to get this value.</div> <div class="pure-u-1 pure-u-md-3-4 hint">In Ampers (A). If you are using a pure resistive load like a bulb this will the ratio between the two previous values, i.e. power / voltage. You can also use a current clamp around one fo the power wires to get this value.</div>
</div> </div>
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-sm-1-4"><label for="powExpectedReset">Reset calibration</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="powExpectedReset" /></div>
<div class="pure-u-1 pure-u-sm-1-4"><label for="hlwExpectedReset">Reset calibration</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="hlwExpectedReset" /></div>
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">Move this switch to ON and press "Update" to revert to factory values.</div> <div class="pure-u-1 pure-u-md-3-4 hint">Move this switch to ON and press "Update" to revert to factory values.</div>
</div> </div>


Loading…
Cancel
Save