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.06k stars 4.78k forks source link

Precision of measurement Sonoff POW if power is low #749

Closed andreasloe closed 6 years ago

andreasloe commented 7 years ago

I am using Sonoff POW to measure a power that is mostly constant at about 3.5Watt (from a descaler). If it goes in a particular mode then power increases from 3.5Watt to 6-7 Watt. I would like to identify those moments/modes.

I suspect that Sonoff is not capable of measuring this power increase and this seems to be a hardware issue. I calibrated first power (using another instrument that I trust saying power is 3.5Watt), then I calibrated voltage (using a digital multimeter) and then I calibrated current. After that I measured the power of the descaler such that my other instrument (called DECT) measure Sonoff+Descaler and Sonoff measures descaler alone:

Mains => DECT measurement => Sonoff measurement => descaler

Hence, it should be power(measured by DECT) > power (measured by Sonoff). At least once this is not the case and this must be an error. Also, DECT measures constant power (except when the descaler got into second mode, clearly visible at about 22:30) whereas Sonoff has volatile power results. Also sometimes power drops to zero, something I do not believe.

I think that the Sonoff hardware is not capable of measuring such low power precisely. Is there any way using the software to solve this problem?

comparedectandsonoff
arendst commented 7 years ago

As you correctly stated the hardware is just not able to measure these low power values. In that case the software will not be able to guess correct values either.

PeteBa commented 7 years ago

I think there are a few things going on here (note I am using the firmware on a huafan switch not sonoff so have different shunt resistor/voltage dividers but same hlw chip):

  1. zero power: I see zero power readings occur when current falls below 30mA and the firmware or hlw chip cuts-out. At this point it reports zero power and zero current. I assume this is some lower limit on the device.
  2. volatile results: sonoff-tasmota firmware uses precision of 1 watt so it could be that your descaler is using near 2.5 watts with reported value stuttering between 2 and 3 watts (i.e. your14:30-16:30 period).
  3. dect/decscaler difference: the firmware uses integer math to convert the chip frequency to power which results in "floor" style rounding. Your descaler may be showing 1/2 watt lower due to rounding errors than actual.

huafan resolution

Attached is a graph with a bunch of differnt loads attached to the switch. The data is from the switch mqtt messages with my annotations in red coming from a separate power meter. I think it shows a pretty stable output and well better than 1 watt precision. But it also confirms the drop-out when you go below around a 30mA in the case of the Huafan Switch. To get this graph I made some mods to the firmware to do floating point math to minimise rounding errors and to output with one decimal point for power.

Curious to hear others views.

agsochi commented 7 years ago

Hi @andreasloe, i already got it here

andreasloe commented 7 years ago

That looks interesting. You increased EnergyRes, that is something I noticed. Can you explain how you implemented Teleperiod? Is this in the device or in your software that gets the results? And how did you program it?

agsochi commented 7 years ago

Look here - openHAB community .

andreasloe commented 7 years ago

I was not so successful. I "installed" your code (even Teleperiod 30! and averaging over 5 minutes) but the results are contradictory. The green line has to be below the red one. Red is Fritz-DECT which is very precise, green is Sonoff and because red measures green AND the device together it should always be red>green.

bildschirmfoto 2017-09-08 um 22 56 05
agsochi commented 7 years ago

Increase energyres to 5, save totalpower value, wait 60 s, and take difference between current totalpower and saved value.

andreasloe commented 7 years ago

The main issues seems to be using (increases of) "Total" instead of "Power". This now gives me far more accurate numbers. I will look at this, thanks!

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.

eazuka commented 6 years ago

Is Sonoff Pow R2 or Sonoff S31 having same low power values issue? I will appreciate any feedbacks

juancgalvez commented 5 years ago

Yes. it does have the same issue. Recently my daughter connected a Christmas tree with lights consuming 4.2 watts. Sonoff S31 with stock firmware read 0 watts.