arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.09k stars 4.78k forks source link

Wrong energy calculation on NEO Coolcam 16A #5945

Closed localhost61 closed 5 years ago

localhost61 commented 5 years ago

I just received my new NEO CoolCam 16A, flashed it using Tuya-convert method. I applied blakadder's template of this page to initialize GPIOs. The voltage readout was wrong, I got 750V instead of about 220V. So, I calibrated it with a 40W resistive load and confirmed with a 2kW load, using an Eastron SDM230 (class 1.0) as reference.

voltageset 228.5
-> {"VoltageSetCal":599}

currentset 174
-> {"CurrentSetCal":2589}

I didn't use PowerSet command, the readout was consistent and thought it would alter the result of the previous ones.

BUG DESCRIPTION

The issue concerns Energy calculation, it seems about 10 times too high. It becomes obvious with a 2kW load. If I power a 2kW load during 2mn (0.0333h) it consumes 2*0.0333=0.067kWh but I get 0.6kWh This is what I realize with the next Backlog command:

16:20:54 CMD: Backlog energyreset1 0; power on;delay 20;status 10;delay 1180;power off;energyreset
16:20:54 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.000,"Yesterday":0.000,"Today":0.000}}
16:20:55 MQT: stat/Spare/RESULT = {"POWER":"ON"}
16:20:55 MQT: stat/Spare/POWER = ON
16:20:55 MQT: stat/Spare/RESULT = {"Delay":20}
16:20:57 MQT: stat/Spare/STATUS10 = {"StatusSNS":{"Time":"2019-06-11T16:20:57","ENERGY":{"TotalStartTime":"2019-06-11T16:20:54","Total":0.007,"Yesterday":0.000,"Today":0.007,"Power":1995,"ApparentPower":1995,"ReactivePower":0,"Factor":1.00,"Voltage":220,"Current":9.054}}}
16:20:57 MQT: stat/Spare/RESULT = {"Delay":1180}
16:22:55 MQT: stat/Spare/RESULT = {"POWER":"OFF"}
16:22:55 MQT: stat/Spare/POWER = OFF
16:22:56 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.598,"Yesterday":0.000,"Today":0.598}}

2019-06-11 16_36_47-Neo Coolcam 16A - Menu principal

REQUESTED INFORMATION

I did several other tests measuring 40W during 6mn (delay 50+3550) and always got about 33Wh instead of 4Wh.

20:41:01 CMD: Backlog energyreset1 0; power on;delay 50;status 10;delay 3550;status 10;power off;energyreset
20:41:01 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.033,"Yesterday":0.000,"Today":0.000}}
20:41:01 MQT: stat/Spare/RESULT = {"POWER":"ON"}
20:41:01 MQT: stat/Spare/POWER = ON
20:41:01 MQT: stat/Spare/RESULT = {"Delay":50}
20:41:06 MQT: stat/Spare/STATUS10 = {"StatusSNS":{"Time":"2019-06-11T20:41:06","ENERGY":{"TotalStartTime":"2019-06-11T20:41:01","Total":0.000,"Yesterday":0.000,"Today":0.000,"Power":39,"ApparentPower":39,"ReactivePower":0,"Factor":1.00,"Voltage":230,"Current":0.170}}}
20:41:07 MQT: stat/Spare/RESULT = {"Delay":3550}
20:43:31 MQT: tele/Spare/STATE = {"Time":"2019-06-11T20:43:31","Uptime":"0T04:39:38","Vcc":3.486,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"Tarentule","BSSId":"E8:65:D4:84:EF:DF","Channel":11,"RSSI":100,"LinkCount":23,"Downtime":"0T00:02:15"}}
20:43:31 MQT: tele/Spare/SENSOR = {"Time":"2019-06-11T20:43:31","ENERGY":{"TotalStartTime":"2019-06-11T20:41:01","Total":0.014,"Yesterday":0.000,"Today":0.014,"Period":0,"Power":39,"ApparentPower":39,"ReactivePower":0,"Factor":1.00,"Voltage":230,"Current":0.170}}
20:47:02 MQT: stat/Spare/STATUS10 = {"StatusSNS":{"Time":"2019-06-11T20:47:02","ENERGY":{"TotalStartTime":"2019-06-11T20:41:01","Total":0.034,"Yesterday":0.000,"Today":0.034,"Power":40,"ApparentPower":40,"ReactivePower":0,"Factor":1.00,"Voltage":231,"Current":0.171}}}
20:47:02 MQT: stat/Spare/RESULT = {"POWER":"OFF"}
20:47:02 MQT: stat/Spare/POWER = OFF
20:47:02 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.034,"Yesterday":0.000,"Today":0.034}}

As a side remark, one can see on 2nd line that Total Energy is not directly affected by command energyreset1 0, but later on, as seen on last line, the process will copy Today Energy in Total Energy and erase the volatile counter too.

TO REPRODUCE

Issue that should affect Sonoff POW too, it shares same energy meter chip HLW8012

arendst commented 5 years ago

Just did a test on a BlitzWolf SHP6 using this template:

{"NAME":"BlitzWolf SHP5","GPIO":[56,255,158,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}

Using a 150W bulb it correctly reports 5W over two minutes.

19:33:30 CMD: backlog status 8;power 1;delay 1200;power 0;status 8
19:33:30 MQT: stat/shp6/STATUS8 = {"StatusSNS":{"Time":"2019-06-12T19:33:30","ENERGY":{"TotalStartTime":"2018-11-25T17:57:09","Total":2.392,"Yesterday":0.004,"Today":0.010,"Power":0.40,"ApparentPower":21.43,"ReactivePower":21.40,"Factor":0.02,"Voltage":225.6,"Current":0.095}}}
19:33:30 MQT: stat/shp6/RESULT = {"POWER":"ON"}
19:33:30 MQT: stat/shp6/POWER = ON
19:33:31 MQT: stat/shp6/RESULT = {"Delay":1200}
19:35:31 MQT: stat/shp6/RESULT = {"POWER":"OFF"}
19:35:31 MQT: stat/shp6/POWER = OFF
19:35:31 MQT: stat/shp6/STATUS8 = {"StatusSNS":{"Time":"2019-06-12T19:35:31","ENERGY":{"TotalStartTime":"2018-11-25T17:57:09","Total":2.397,"Yesterday":0.004,"Today":0.015,"Power":68.20,"ApparentPower":152.71,"ReactivePower":136.60,"Factor":0.45,"Voltage":224.9,"Current":0.679}}}

It uses the same driver as your Neo Coolcam.

I'll do some further tests on different hardware.

arendst commented 5 years ago

As the Neo is configured for HLW8012 I would suggest you change it's config to BL0937 by changing GPIO04 from 133 to 134.

I haven't seen any HLW8012 lately in new devices. It's mostly BL0937.

You may need to recalibrate.

localhost61 commented 5 years ago

My latest readings tended to confirm what you tell me now. HLW8012 was for POW R1 and my further tests on LED lamps show no active power :-/ I'll check right now.

localhost61 commented 5 years ago

@arendst you got it right! Many thanks! I changed GPIO4 to 134 as you said and calibrated again with the 2kW kettle and the SDM230 I get a Total Energy of 82Wh instead of 67Wh now, the measure is not especially accurate but it's consistent. FYI here is the console log

20:12:45 CMD: voltageset 230
20:12:45 MQT: stat/Spare/RESULT = {"VoltageSetCal":1608}

20:14:38 CMD: Currentset 8940
20:14:38 MQT: stat/Spare/RESULT = {"CurrentSetCal":3489}

20:20:15 CMD: Backlog energyreset1 0; power on;delay 20;status 10;delay 1180;power off;energyreset
20:20:15 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.083,"Yesterday":0.000,"Today":0.000}}
20:20:15 MQT: stat/Spare/RESULT = {"POWER":"ON"}
20:20:15 MQT: stat/Spare/POWER = ON
20:20:15 MQT: stat/Spare/RESULT = {"Delay":20}
20:20:18 MQT: stat/Spare/STATUS10 = {"StatusSNS":{"Time":"2019-06-12T20:20:18","ENERGY":{"TotalStartTime":"2019-06-12T20:20:15","Total":0.001,"Yesterday":0.000,"Today":0.001,"Power":1988,"ApparentPower":1988,"ReactivePower":0,"Factor":1.00,"Voltage":220,"Current":9.030}}}
20:20:18 MQT: stat/Spare/RESULT = {"Delay":1180}
20:22:16 MQT: stat/Spare/RESULT = {"POWER":"OFF"}
20:22:16 MQT: stat/Spare/POWER = OFF
20:22:16 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.082,"Yesterday":0.000,"Today":0.082}}

20:26:33 CMD: Backlog power on;delay 20;status 10;delay 580;power off;energyreset
20:26:33 MQT: stat/Spare/RESULT = {"POWER":"ON"}
20:26:33 MQT: stat/Spare/POWER = ON
20:26:34 MQT: stat/Spare/RESULT = {"Delay":20}
20:26:36 MQT: stat/Spare/STATUS10 = {"StatusSNS":{"Time":"2019-06-12T20:26:36","ENERGY":{"TotalStartTime":"2019-06-12T20:20:15","Total":0.083,"Yesterday":0.000,"Today":0.083,"Power":2033,"ApparentPower":2033,"ReactivePower":0,"Factor":1.00,"Voltage":223,"Current":9.123}}}
20:26:36 MQT: stat/Spare/RESULT = {"Delay":580}
20:27:34 MQT: stat/Spare/RESULT = {"POWER":"OFF"}
20:27:34 MQT: stat/Spare/POWER = OFF
20:27:34 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.123,"Yesterday":0.000,"Today":0.123}}

21:45:00 CMD: Backlog energyreset1 0; power on;delay 20;status 10;delay 3580;power off;energyreset
21:45:00 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.143,"Yesterday":0.000,"Today":0.000}}
21:45:00 MQT: stat/Spare/RESULT = {"POWER":"ON"}
21:45:00 MQT: stat/Spare/POWER = ON
21:45:00 MQT: stat/Spare/RESULT = {"Delay":20}
21:45:03 MQT: stat/Spare/STATUS10 = {"StatusSNS":{"Time":"2019-06-12T21:45:03","ENERGY":{"TotalStartTime":"2019-06-12T21:45:00","Total":0.000,"Yesterday":0.000,"Today":0.000,"Power":23,"ApparentPower":34,"ReactivePower":25,"Factor":0.68,"Voltage":229,"Current":0.149}}}
21:45:03 MQT: stat/Spare/RESULT = {"Delay":3580}
21:51:01 MQT: stat/Spare/RESULT = {"POWER":"OFF"}
21:51:01 MQT: stat/Spare/POWER = OFF
21:51:01 MQT: stat/Spare/RESULT = {"EnergyReset":{"Total":0.002,"Yesterday":0.000,"Today":0.002}}

(I use an initial 2" delay in the command to hide the first lower values (due to averageing, I guess).

I close the post, the issue was located between the chair and my keyboard :-D

localhost61 commented 5 years ago

After removing the inner sticker, and the plastic safety cover with a 2mm Hex Allen key, the digital PCB appears and I can confirm there is a Belling BL0937 chip in this device as U5.

IMAG1939

IMAG1945

RezzZ commented 5 years ago

@localhost61 I noticed the same issues as you with my new 16a wifi switches so I switched gpio4 to 134 and it looks better but not great. Voltage hangs around 280...., and Watt usage is around 15 to 20 watts higher that actual

localhost61 commented 5 years ago

Yes, it absolutely needs calibration. For me that was quite easy, I own everything needed for the operation.