Energy (AC) - HLW8012/BL0937
Moderators: grovkillen, Stuntteam, TD-er
Energy (AC) - HLW8012/BL0937
Hya,
i got 2 HLW8012 boards, and had an esp8266-12 flashed with the ESP_Easy_mega_20201227_hard_SONOFF_POW_4M1M
wired all, and ijected 127V AC to the input of the HLW8012 board.
by devices, voltage, current, power and powerfactor, all remained 0.00.
any how to in have it testing?
TIA.
i got 2 HLW8012 boards, and had an esp8266-12 flashed with the ESP_Easy_mega_20201227_hard_SONOFF_POW_4M1M
wired all, and ijected 127V AC to the input of the HLW8012 board.
by devices, voltage, current, power and powerfactor, all remained 0.00.
any how to in have it testing?
TIA.
Re: Energy (AC) - HLW8012/BL0937
Here the setting I used on my Sonoff POW R1.
Do you have similar settings?
Especialy the device type (which is mentioned to be set first), you have to set it, save it and then see if the factors are read from the sensor.
Do you have similar settings?
Especialy the device type (which is mentioned to be set first), you have to set it, save it and then see if the factors are read from the sensor.
- Attachments
-
- 2021-02-09 15_32_55-Sonoff POW R1.png (73.92 KiB) Viewed 17857 times
Re: Energy (AC) - HLW8012/BL0937
that's the board
by device i have CUSTOM.
by device i have CUSTOM.
- Attachments
-
- HLW8012_High-Precision_Energy_Metering_Module_Arduino_Energy_Monitoring.png (203.72 KiB) Viewed 17852 times
Re: Energy (AC) - HLW8012/BL0937
Have you some calibration values shown like on my screenshot?
Re: Energy (AC) - HLW8012/BL0937
used the calbrition shown your screenshot, but reading are not good.. voltage is showing 1.00 when MM shows 128
i will try to calibrate using the example found in the hlw8012 library.
i will try to calibrate using the example found in the hlw8012 library.
Re: Energy (AC) - HLW8012/BL0937
Those calibration values were read from the chip itself and probably stored in there by Sonoff.
They are based on the used shunt resistor and voltage divider resistors, so if you're using another set you may need to adjust the factors.
As first step I suggest to multiply the voltage factor by 128
They are based on the used shunt resistor and voltage divider resistors, so if you're using another set you may need to adjust the factors.
As first step I suggest to multiply the voltage factor by 128
Re: Energy (AC) - HLW8012/BL0937
did not work. i used the sketch from xoseperez, but no luck.
any hint?
any hint?
Re: Energy (AC) - HLW8012/BL0937
There are quite a lot of possibilities with the configuration of SEL / CF1 / CF int edge parameters.
Re: Energy (AC) - HLW8012/BL0937
I would suggest to dive into the datasheet/schematics and compare it to the known units that are already listed in the ESPEasy plugin.
This is what is set in the source code:
This is what is set in the source code:
Code: Select all
bool p076_getDeviceString(int device, String& name) {
switch(device) {
case P076_Custom : name = F("Custom"); break;
case P076_Sonoff : name = F("Sonoff Pow (r1)"); break;
case P076_Huafan : name = F("Huafan SS"); break;
case P076_KMC : name = F("KMC 70011"); break;
case P076_Aplic : name = F("Aplic WDP303075"); break;
case P076_SK03 : name = F("SK03 Outdoor"); break;
case P076_BlitzWolf: name = F("BlitzWolf SHP"); break;
case P076_Teckin : name = F("Teckin"); break;
case P076_TeckinUS : name = F("Teckin US"); break;
case P076_Gosund : name = F("Gosund SP1 v23"); break;
case P076_Shelly_PLUG_S : name = F("Shelly PLUG-S"); break;
default:
return false;
}
return true;
}
bool p076_getDeviceParameters(int device, byte &SEL_Pin, byte &CF_Pin, byte &CF1_Pin, byte &Cur_read, byte &CF_Trigger, byte &CF1_Trigger) {
switch(device) {
case P076_Custom : SEL_Pin = 0; CF_Pin = 0; CF1_Pin = 0; Cur_read = LOW; CF_Trigger = LOW; CF1_Trigger = LOW; break;
case P076_Sonoff : SEL_Pin = 5; CF_Pin = 14; CF1_Pin = 13; Cur_read = HIGH; CF_Trigger = CHANGE; CF1_Trigger = CHANGE; break;
case P076_Huafan : SEL_Pin = 13; CF_Pin = 14; CF1_Pin = 12; Cur_read = HIGH; CF_Trigger = CHANGE; CF1_Trigger = CHANGE; break;
case P076_KMC : SEL_Pin = 12; CF_Pin = 4; CF1_Pin = 5; Cur_read = HIGH; CF_Trigger = CHANGE; CF1_Trigger = CHANGE; break;
case P076_Aplic : SEL_Pin = 12; CF_Pin = 4; CF1_Pin = 5; Cur_read = LOW; CF_Trigger = CHANGE; CF1_Trigger = CHANGE; break;
case P076_SK03 : SEL_Pin = 12; CF_Pin = 4; CF1_Pin = 5; Cur_read = LOW; CF_Trigger = CHANGE; CF1_Trigger = CHANGE; break;
case P076_BlitzWolf : SEL_Pin = 12; CF_Pin = 5; CF1_Pin = 14; Cur_read = LOW; CF_Trigger = FALLING; CF1_Trigger = CHANGE; break;
case P076_Teckin : SEL_Pin = 12; CF_Pin = 4; CF1_Pin = 5; Cur_read = LOW; CF_Trigger = FALLING; CF1_Trigger = CHANGE; break;
case P076_TeckinUS : SEL_Pin = 12; CF_Pin = 5; CF1_Pin = 14; Cur_read = LOW; CF_Trigger = FALLING; CF1_Trigger = CHANGE; break;
case P076_Gosund : SEL_Pin = 12; CF_Pin = 4; CF1_Pin = 5; Cur_read = LOW; CF_Trigger = FALLING; CF1_Trigger = CHANGE; break;
case P076_Shelly_PLUG_S : SEL_Pin = 12; CF_Pin = 5; CF1_Pin = 14; Cur_read = LOW; CF_Trigger = FALLING; CF1_Trigger = CHANGE; break;
default:
return false;
}
return true;
}
Re: Energy (AC) - HLW8012/BL0937
ok, i purchased a SONOFF POWR2.
How to flash ESPeasy on it. Any good guide?
How to flash ESPeasy on it. Any good guide?
Re: Energy (AC) - HLW8012/BL0937
First a big warning.
Don't ever connect the unit to your PC when the Sonoff is connected to mains power !!!
You should use a USB to serial adapter and connect it to the pins on the Sonoff board.
Keep the button of the Sonoff pressed when powering on the Sonoff and keep it pressed till you started the flashing procedure.
Don't forget to connect the RX of the USB to serial adapter to TX of the Sonoff and vice verse.
Tasmota also has quite a lot of information about this: https://tasmota.github.io/docs/Getting-Started/
For the POW there is a special build.
Don't ever connect the unit to your PC when the Sonoff is connected to mains power !!!
You should use a USB to serial adapter and connect it to the pins on the Sonoff board.
Keep the button of the Sonoff pressed when powering on the Sonoff and keep it pressed till you started the flashing procedure.
Don't forget to connect the RX of the USB to serial adapter to TX of the Sonoff and vice verse.
Tasmota also has quite a lot of information about this: https://tasmota.github.io/docs/Getting-Started/
For the POW there is a special build.
Re: Energy (AC) - HLW8012/BL0937
no vcc and gnd from the usb to serial?
Re: Energy (AC) - HLW8012/BL0937
Yep otherwise your ESP will not work as you cannot (!!!!) use mains power to power the Sonoff while programming it.
But I didn't want to write down the obvious, just that you should make sure to swap RX and TX as that may not be obvious to anyone.
But I didn't want to write down the obvious, just that you should make sure to swap RX and TX as that may not be obvious to anyone.
Re: Energy (AC) - HLW8012/BL0937
Yeah, got some confusion, but is flashed with ESPEasy.
Not, some questions:
Device leds (blue and red) - to which gpio's?
Relay?
The device is a SONOFF POW R2, so, there are some differences with the POW R1.
And is the setup the same?
Not, some questions:
Device leds (blue and red) - to which gpio's?
Relay?
The device is a SONOFF POW R2, so, there are some differences with the POW R1.
And is the setup the same?
- Attachments
-
- IMG_20210219_120749.jpg (2.85 MiB) Viewed 17527 times
-
- IMG_20210219_120714.jpg (3.29 MiB) Viewed 17527 times
Re: Energy (AC) - HLW8012/BL0937
Data from my SONOFF POW R2, Board V2.0:
Relais GPIO12
Push-Button GPIO0
Wifi-Status-Led (D5, blue) GPIO13 (inversed)
Status-Led (D6, red) internal connected to Relais or GPIO12
Relais GPIO12
Push-Button GPIO0
Wifi-Status-Led (D5, blue) GPIO13 (inversed)
Status-Led (D6, red) internal connected to Relais or GPIO12
Re: Energy (AC) - HLW8012/BL0937
thx.. can you share your setup (hardware and devices), and rules, if any?
what's the relay for?
what's the relay for?
Re: Energy (AC) - HLW8012/BL0937
Code: Select all
on System#Boot do
AsyncEvent,Schalten=0
endon
on MQTT#Connected do
AsyncEvent,HoleStatus
endon
on Taster#Status=1 do
AsyncEvent,Schalten
endon
on Schalten do
if %eventvalue%=1
if [Relais#Status]=0
GPIO,12,1
endif
else
if %eventvalue%=0
if [Relais#Status]=1
GPIO,12,0
endif
else
if %eventvalue%>1 or %eventvalue%<0
// nichts machen
else
// umschalten
GPIO,12,[Relais#Status#!Z]
endif
endif
endif
endon
on HoleStatus do
publish,%sysname%/status/CON,Connected
publish,%sysname%/Relais/Status,[Relais#Status]
endon
Re: Energy (AC) - HLW8012/BL0937
Danke!
how is the device messdaten defined?
Vielen dank nochmal.
how is the device messdaten defined?
Vielen dank nochmal.
Re: Energy (AC) - HLW8012/BL0937
You can use the hlwcalibrate-command to calibrate your device.
Re: Energy (AC) - HLW8012/BL0937
and where do i find hlwcalibrate-command?
Re: Energy (AC) - HLW8012/BL0937
Look here https://espeasy.readthedocs.io/en/lates ... /P076.html
and execute it in your ESP under /Tools/Command.
and execute it in your ESP under /Tools/Command.
Re: Energy (AC) - HLW8012/BL0937
Just FYI, if you go to Tools->Factory reset, you'll find a number of "Pre-defined config" settings.
One of them (on a POW build) is for the POW and one for the POW2.
If you reset it to such a pre-defined config, almost all is already configured for you.
One of them (on a POW build) is for the POW and one for the POW2.
If you reset it to such a pre-defined config, almost all is already configured for you.
Re: Energy (AC) - HLW8012/BL0937
thanks for all.
i'm just not getting the relay to work.
i'm just not getting the relay to work.
Re: Energy (AC) - HLW8012/BL0937
Have you tried the "factory reset" I mentioned?
Code: Select all
on Button1#switch do
if [Button1#switch]=1
gpio,12,1
else
gpio,12,0
endif
endon
Re: Energy (AC) - HLW8012/BL0937
worked perfectly with the sonoff pow r2.
now i have to struggle ith the hlw8012.
now i have to struggle ith the hlw8012.
Re: Energy (AC) - HLW8012/BL0937
Couldn't find much in the documentation. But what is the maximum refresh rate of these HLW8012/BLE0937 devices?
Re: Energy (AC) - HLW8012/BL0937
refresh rate as in how often the task may give a new value?
I guess the lowest value for the "Interval" is 1 second, but to be honest I don't know how often the internal values in the measurement chip are updated.
I guess the lowest value for the "Interval" is 1 second, but to be honest I don't know how often the internal values in the measurement chip are updated.
Re: Energy (AC) - HLW8012/BL0937
i did not change the refresh rates..... acepted as is. and it's working, for the sonoff pow r2.
Re: Energy (AC) - HLW8012/BL0937
I've bought an NX-SM400 Wallplug with HLW8012/BL0937 Chip. Configured it. But seems like sometimes i get Errors that Voltage gets reportet waaaay to high and Current and Powerfactor get reported as 0. Only Power is shown correctly.
The Configuration of the NX-Sm400 was done in this thread. But now it seems to be some isses with the hardware of the chip.
P.S
I'v set 1 Second as Interval and that worked the same.
The Configuration of the NX-Sm400 was done in this thread. But now it seems to be some isses with the hardware of the chip.
P.S
I'v set 1 Second as Interval and that worked the same.
Who is online
Users browsing this forum: No registered users and 145 guests