Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
rol-rider
Normal user
Posts: 33
Joined: 02 Oct 2016, 12:36

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#121 Post by rol-rider » 30 Jul 2017, 23:48

Hi,
I think I have found my problem!

I calibrated with the "bulb" values:
xxx.xxx.x.xx / control? cmd = hlwcalibrate, 234,0.25,60

Calibration values in the plugin
Current Multiplier = 1849.00
Voltage Multiplier = 442689.56
Power Multiplier = 12168954.98

Reading with the espeasy bulb P = 59W U = 226V I = 0.25A PF = 100

More read (relay on/off/on/off) always ok.

Now if I disconnect the Sonoff

After recovery on my network:

Calibration values in the plugin (not changed)
Current Multiplier = 1849.00
Voltage Multiplier = 442689.56
Power Multiplier = 12168954.98


Reading with the espeasy bulb P = 50W U = 209V I = 1.92A PF = 12


Conclusion: the calibration does not remain in memory. Is this normal?


rol-rider
Normal user
Posts: 33
Joined: 02 Oct 2016, 12:36

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#123 Post by rol-rider » 31 Jul 2017, 19:10

Ok for this bug!
That I had not understood. (Google translate... or me!)

Rest The I current!

With these two measures
Image
Bulb, correct value.

Image
toaster ? Only the Current (A) is NOK!
How active power can be good and not Current ?


papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#125 Post by papperone » 05 Aug 2017, 11:34

HI, I will be back home tomorrow and I'll look into the plugin based on your comments to fix bugs (like the one that calibration is nor surviving a reset/power down).
About the "Active Power" of course if you calibrate with a resistive load then you try to measure a reactive load the values are wrong!
The units is not meant to be used like this, and the chipset is an economic one so I doubt this can be managed differently.
This is not a multi-purpouse power measure unit nor a home monitor, Sonoff POW (better, chipset HLW8012) is designed to monitor one single device thus you must calibrate it vs, that specific defice.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Little Bug: forgets the calibration

#126 Post by papperone » 11 Aug 2017, 17:48

BerndJ wrote:
27 Jul 2017, 12:28
Hi,

when the device lost the power and it came back then we found the "old" settings and the measure values are wrong.

Go to Devices --> Click Edit (the HLW8012) --> Click Submit --> Click Close

and he uses the calibration values.

Could the developer correct?

best wishes

BerndJ
Thanks for spotting it, just submitted pull-up request with this bug fixed!! (just waiting to be merged with master branch)
About the ActivePower calculation this is done by the chip and as I wrote it's based on how you calibrate it, so if you change load type you need to calibrate it again to take this into consideration...
I am expecting this is standard behaviour of this chip, but wouldbe interesting to know how other firmware behaves on the POW (like the original ones or the Espurna) as they are supposed to work exactly the same way!
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

User avatar
ManS-H
Normal user
Posts: 233
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#127 Post by ManS-H » 24 Aug 2017, 20:27

papperone en LisaM, Thanks for the work your both did for community so that we can work with the Itead, Sonoff Pow. It works fine.

I have only one question, papperone in a earlier message you mentioned this:
I will explore your suggestion about the possibility to RESET/CALIBRATE via web interface, not a bad idea at all! ;)
Is this command allready in the software? and yes, how do i used it.

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#128 Post by LisaM » 25 Aug 2017, 00:16

ManS-H wrote:
24 Aug 2017, 20:27
papperone en LisaM, Thanks for the work your both did for community so that we can work with the Itead, Sonoff Pow. It works fine.

I have only one question, papperone in a earlier message you mentioned this:
I will explore your suggestion about the possibility to RESET/CALIBRATE via web interface, not a bad idea at all! ;)
Is this command allready in the software? and yes, how do i used it.
Thx, but it was papperone who did the build work. i just tested it.
As far as i know, the calibrate option isn't there yet but shouldn't be to difficult to make.
The current calibrate function uses http:

Code: Select all

xxx.xxx.xxx.xxx/control?cmd=hlwcalibrate,VVV,AAA,WWW
Where VVV = Voltage (230 here in continental europe)
AAA = ampere (current)
WWW = Watts (like 60 for a light bulb).

@Papperone:
PLUGIN_WRITE, PLUGIN_WEBFORM_SAVE and PLUGIN_WEBFORM_LOAD (add function selector) need some rewriting, so that write and save can call the calibrate function.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#129 Post by papperone » 25 Aug 2017, 09:23

LisaM wrote:
25 Aug 2017, 00:16
@Papperone:
PLUGIN_WRITE, PLUGIN_WEBFORM_SAVE and PLUGIN_WEBFORM_LOAD (add function selector) need some rewriting, so that write and save can call the calibrate function.
indeed, that's the idea in order to implement the calibration via WEB interface and not only issueing command...
honestly I had put this in lower priority as I do have the calibration in my home automation gui via MQTT but it's definitely an improvement that shoudl be done in the GUI of this plugin :)
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#130 Post by papperone » 17 Sep 2017, 11:32

All current bugfixes have been merged in the Playground repository...
About the calibration via WEB I'm not sure is a good place as we cannot have buttons and the previous calibration values are not stored anywhere.
I don't think it makes sense to add this complexity in storage as this will anyhow run the calibration process any time the device page is submitted.
I still believe the right way if to use the already available command and to create (if you wish like I did) a possibility of remote calibration in your GUI.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

homeautomator24
Normal user
Posts: 4
Joined: 17 Sep 2017, 12:10

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#131 Post by homeautomator24 » 17 Sep 2017, 12:13

Dear Papperone,

Would you mind to provide a link to the .bin file with the firmware you merged your updates into?
This would it make it easier to test and to provide further feedback.

Thank you for your great contribution to this topic.

Best
Homeautomator24

phoenix_e
Normal user
Posts: 2
Joined: 17 Sep 2017, 19:58

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#132 Post by phoenix_e » 17 Sep 2017, 20:06

Dear Papperone,

I second that request from Homeautomator24.
Spend the last couple of hours trying to compile the bin file.
But on two different systems using both the latest Arduino software and the older version 1.6.12 it kept throwing errors.

If you could make the bin available for a 4mb esp I would greatly appreciate it.

With kind regards,
E


homeautomator24
Normal user
Posts: 4
Joined: 17 Sep 2017, 12:10

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#134 Post by homeautomator24 » 20 Sep 2017, 18:43

Thank you, Rol-rider.
After flashing, I get errors with looping reset during boot: see below.
Any idea why this happens? Anybody can reconfirm? Using a 4M Sonoff Pow.

UART Messages:
ets Jan 8 2013,rst cause:1, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09826c6d
~ld
⸮U


INIT : Booting version: (custom)
INIT : Warm boot #29
FS : Mounting...
FS : Mount successful, used 72288 bytes of 113201
INIT : Free RAM:26568
INIT : I2C
INIT : SPI not enabled

Exception (29):
epc1=0x4000e1c3 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000018 depc=0x00000000

ctx: cont
sp: 3fff3900 end: 3fff3da0 offset: 01a0

phoenix_e
Normal user
Posts: 2
Joined: 17 Sep 2017, 19:58

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#135 Post by phoenix_e » 20 Sep 2017, 23:00

Hi Rol-Rider,

I also tried it on a Sonoff POW 4M.
For me it works fine.

It took a couple of tries before the flashing completed succesfully.
But that was the same case with the standard ESPEasy bin files.
Might be the cheap USB serial adapter.

You really helped me out. :D

Merci Beaucoup

rol-rider
Normal user
Posts: 33
Joined: 02 Oct 2016, 12:36

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#136 Post by rol-rider » 21 Sep 2017, 00:32

@ homeautomator24,

sonoff pow is 1M not 4M.

I had the same thing through OTA.

I have (with USB serial adapter)
--flash R120 V1(file ESPEasy_R120_1024.bin)
(wait erase sector)
--and flash the file in V2.0.0
after it's good.

sorry for my English (google translate)

homeautomator24
Normal user
Posts: 4
Joined: 17 Sep 2017, 12:10

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#137 Post by homeautomator24 » 21 Sep 2017, 18:16

Merci Beaucoup, Will try again :-) A bientot

homeautomator24
Normal user
Posts: 4
Joined: 17 Sep 2017, 12:10

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#138 Post by homeautomator24 » 22 Sep 2017, 17:47

Dear, rol-rider, All,

I took the recent .bin file provided by rol-rider, configured HLW8012 with GPIO-5/-13-14 as described many times above. Needed to free up I2C GPIOs now to GPIO-1/-3.
Power Factor and Power works fine after calibration.
However, Voltage and Current remain in 0.

Anybody any idea why this happens?
Would anybody like to post the assignment of GPIO pins in a working Sonoff Pow environment?

Thank you.
Homeautomator24

BerndJ
Normal user
Posts: 84
Joined: 28 Sep 2015, 06:57

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#139 Post by BerndJ » 22 Sep 2017, 20:36

rol-rider wrote:
21 Sep 2017, 00:32
....sonoff pow is 1M not 4M......
Hi,

meanwhile i had 15 pcs of the pows and all have 4M.

best wishes

BerndJ

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#140 Post by sm0k0 » 21 Nov 2017, 16:41

Hi around there.
maybe somebody could help me with compiling P170_HLW8012.

I have installed Atom (1.22.1 / 64) and PlatformIO at version Home 0.3.2·Core 3.5.0b3. following the entire HowTo`s and use the latest Mega-branch on an Win10 x64.
I have installed all required deps and libraries.
Compiling for normal/test/dev at 4096 is working fine with the current GIT sources but as soon as i try to compile with _P170_HLW8012.ino i run into an error :
Linking .pioenvs\test_4096\firmware.elf
c:/users/sm0k0/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pioenvs\test_4096\firmware.el
f section `.text' will not fit in region `iram1_0_seg'
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\test_4096\firmware.elf] Error 1
I have already searched around Google and checked for the given hints on this issue (like heap.c and umm_malloc.c changes) deleted a lot of other plugins but no way........... :?

Any ideas to get that sorted would be much appreciated.

regards
sm0k0

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#141 Post by sm0k0 » 22 Nov 2017, 15:35

Hi again,

looks like the issue is the poor memory on the ESP .....

i have used workaround in the meantime :
  • remove all unwanted plugins by excluding them from compiling, add at the very beginning of each plugin
#ifdef PLUGIN_BUILD_DISABLED

and as a last line in desired plugin to exclude
#endif
  • remove all unwanted libraries from the lib folder
in my case that gives me a image size of 426204 text and 7900 data (without _P170 @ 421440 text and 7860 data) with the minimum core plugins and which seems to run properly.

Btw: plugins like those for Oled, Wifigateway and RGBW and this Candle thing are eating a lot of the memory so you should get rid of them first.

best regards
sm0k0

NealXu
Normal user
Posts: 1
Joined: 22 Dec 2017, 16:27

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#142 Post by NealXu » 22 Dec 2017, 16:34

Hi...i am a new user here. As per my knowledge many ESPEasy users would like to see support for the SonoffPOW in their favorite software, until 2 weeks ago I was one of them, until I received my SonoffPOW from china by the mail.I was willing to give Espurna a chance, installed PlatformIO, learned to work with the basic commands and flashed my SonoffPOW.The webinterface looks indeed much different than the webinterface of ESPEasy but it works very intuitive. You have to use MQTT as protocol with a server. No other protocol is supported in Espurna. Domoticz can work with MQTT and communicates perfectly together with Espurna/SonoffPOW.

blind vias pcb

Irtimid_NL
Normal user
Posts: 1
Joined: 05 Mar 2018, 21:01

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#143 Post by Irtimid_NL » 05 Mar 2018, 21:14

Hello you all,

A newbie to Sonoff here and new to this forum too :)
First of all let me thank all of you who are looking into this Sonoff POW to get it to work with ESPEasy, it's much appreciated !

If been reading this thread a few times, looking on the Internet/YouTube and visited some other sites in order to get the POW to work with ESPEasy. However no luck so far :(
I've seen that a few of you people managed to get it to work, but unfortunately I don't understand how to get there.
So far I have tried different versions of ESPEasy but I don't get the "Voltage & Current" Selection in the Devices tab.
Reading this thread I noticed that some people build a .bin file to be used, but how do I transfer it to the POW and add it properly so the device will understand what to do with it ?

All I want to do with this POW I have is to switch on/off my small kitchensink boiler (which should work just fine as it is now, I just have to add it to Domoticz), but if I am able to read out the time it takes to heat up I can tweak the time to switch it on (&off). And hey, as I bought a POW I might aswell use the features it supports, right ?

Thanks in advance if you take time to help me out on this one. I really want to learn more about these devices and how they can help me to automate my house.

Irtimid

xury
Normal user
Posts: 44
Joined: 02 Apr 2018, 12:54

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#144 Post by xury » 24 Apr 2018, 21:40

Please help me.
How to set PLUGIN_SET_SONOFF_POW to compile in Arduino?

TD-er
Core team member
Posts: 1615
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#145 Post by TD-er » 24 Apr 2018, 22:00

xury wrote:
24 Apr 2018, 21:40
Please help me.
How to set PLUGIN_SET_SONOFF_POW to compile in Arduino?
By far the easiest is to write on the first line of ESPEasy.ino:

Code: Select all

#define PLUGIN_SET_SONOFF_POW
Please note that it is not yet tested, so please test with care and please report any issues.

xury
Normal user
Posts: 44
Joined: 02 Apr 2018, 12:54

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#146 Post by xury » 25 Apr 2018, 00:36

Thank You TD-er. I think at least I understood the define system.
Only one question:
I would like not touch too much in main files as I far away from code developing. So I read some info And prepare Custom.h file.
So can I put my custom definitions on custom.h ?
For eq

Code: Select all

#undef PLUGIN_BUILD_NORMAL
#define PLUGIN_BUILD_CUSTOM
#define PLUGIN_SET_SONOFF_POW // I don't know is the rigt place here (bottom) or on top?
#define <PLUGIN_WHAT_I_NEED>  // 
etc

kostett
Normal user
Posts: 2
Joined: 17 May 2018, 08:43
Contact:

Re: Support for "Sonoff Pow" (from ITead) with Power Consumption Measurement via HLW8012 (HLW 8012) IC?

#147 Post by kostett » 07 Aug 2018, 12:39

How to calibrate HLW8012 device in ESPEasy mega web interface?
Why does I receive only Voltage and no other values?

Added:
Check that you're not using GPIO-14 elsewhere in settings explicit HLW8012 device.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests