Cheap Chinese Power Meter made wireless

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
SweetPants
Posts: 1517
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8590
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Wednesday 05 July 2017 19:48

littlewouter wrote:The provided code from Kapee sends the average watt value each minutes via MQTT, this could be easily recalculated to kwh consumed in the last minute.
That is why I save the calculated Kwh every hour on the ESP module's flash. If I lose power or pull the meter I lose max. 1 hour of Kwh measurements. You can save more times and be more accurate, but that will eventually break your ESP module as the flash can only be written x number of times.

Through MQTT I can also clear the Kwh and reset the ESP if I want measurement to start over, in case of moving the meter to another device I want to monitor.

PS: I'm not using Kapee's code

Kapee
Posts: 12
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee » Wednesday 05 July 2017 22:00

You're welcome.
As I said, I am not working with domoticz, but with Node-Red.
The calculation from watt + time to kWh is done in a Node-Red function. I think in Node-Red the time is quit accurate, in wemos not.

Rolo
Posts: 55
Joined: Sunday 27 December 2015 20:19
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo » Friday 11 August 2017 15:04

Nice project, I have inspiration to build one with a MySensors node in it. Just ordered two meters, wil take some time to get here. I'm curious what board is in the meters I get, I will update this topic a soon as I have them.

bilbolodz
Posts: 7
Joined: Wednesday 15 March 2017 10:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by bilbolodz » Friday 01 September 2017 14:21

Kapee wrote:
Thursday 08 June 2017 12:12
The second burst contains the value for volt and watt.
Have you manged to figure out "which registers" are checked by MCU? As I can see from your code main CPU ask for 4 content of four registers. Because of communication protocol of it has to bee "four registers in incremental order": first is power and third is voltage how about second and fourth?
If you know "base address register" (power register) maybe 2 and 4 word will be useful too?

And second idea: I've to check PCB but maybe it's possible to cut RX/TX traces between MCU and V9261F, put ESP8266 "as a proxy" and collect more interesting reading from measuring chip?

Kapee
Posts: 12
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee » Sunday 03 September 2017 19:21

I was just interested in volt, watt an frequency. kWh will be calculated by the Node-Red system.
With the finishing of the software I stopped investigating the power meter.
But I like to hear from you if there are more possibilities with the power meter.

bilbolodz
Posts: 7
Joined: Wednesday 15 March 2017 10:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by bilbolodz » Monday 04 September 2017 11:11

As I understood you are NOT going to extend your project and I have to try myself? Am I right?

SweetPants
Posts: 1517
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8590
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Monday 04 September 2017 11:26

bilbolodz wrote:
Monday 04 September 2017 11:11
As I understood you are NOT going to extend your project and I have to try myself? Am I right?
That's whay I read :mrgreen: :mrgreen: :mrgreen:

Kapee
Posts: 12
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee » Monday 04 September 2017 14:46

Indeed, that's what I meant.

Rolo
Posts: 55
Joined: Sunday 27 December 2015 20:19
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo » Saturday 09 September 2017 9:02

I'm working on a powermeter (the model as in kapee posts) and have build a circuit get the RX data optically isolated. Using this method you can safely connect the microcontrollerboard of your choice to the USB port of your computer. No need for an isolation transformer. My prototype uses a node MCU board but it will also work with other boards. Please be careful, there is still 230V ac within the red dotted line.
<edit> The serial logic is inverted in this setup.
I will share the schematic here :
Image

Prototype in action :
Image
Last edited by Rolo on Wednesday 20 September 2017 10:41, edited 1 time in total.

xose
Posts: 3
Joined: Saturday 31 December 2016 16:21
Target OS: Linux
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by xose » Saturday 16 September 2017 13:56

Thanks @kappe and @rolo, I'm using your code and setup for my Intertek.
So far I've discovered the codes the MCU is sending the V9261F:

FE 11 80 01 00 00 00 A2 => read register 0x0180 (sysctrl)
FE 11 19 04 00 00 00 06 => read 4 registers starting at 0x0119

So the values in @kappe sketch are:

0x0119 average total active power
0x011A average total reactive power
0x011B average total voltage rms
0x011C average total current rms

What I don't know yet is how to know the calibration constants. In @kappe sketch they are hardcoded as magic numbers but I'd like to know where do they come from (experimenting?). In the 5.13 section of the datasheet talks about calibration registers and formulae but I can't figure the numbers out...

Rolo
Posts: 55
Joined: Sunday 27 December 2015 20:19
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo » Tuesday 19 September 2017 18:35

I know these calculations are done empirical, My meters needed other numbers to make the readout match with what's on the display. I did not further investigate the logic behind it. I have build two meters. I have made two virtual power sensors in Domoticz and the ESP module updates the values by posting JSON url's to domoticz.

Image

Kapee
Posts: 12
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee » Wednesday 20 September 2017 10:37

I ordered three powermeters and all three have a different printed circuit board. The 1st and the 3rd with spi interface, the 2nd with serial interface.
For the 3rd powermeter I made a pcb for the wemos and power supply, it just fitted in height.
3pwrmtrs (Small).jpg
3pwrmtrs (Small).jpg (87.19 KiB) Viewed 454 times

xose
Posts: 3
Joined: Saturday 31 December 2016 16:21
Target OS: Linux
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by xose » Monday 25 September 2017 13:48

I've been wrapping up things with these powermeters and adding support for both the V9261F and the ECH1560 in ESPurna (beta testing right now). It also provides and option to calibrate those "magic numbers" from the webUI. I only have the serial interface version and it works great. The ECH1560 has probably a few bugs but I cannot test it.
If anyone is interested in trying it you can first read this post http://tinkerman.cat/connected-power-meter/. Any feedback would be very valuable. Thank you!

Rolo
Posts: 55
Joined: Sunday 27 December 2015 20:19
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo » Monday 25 September 2017 20:28

Nice article. You took the time to gather all the info.

Raspberry Piet
Posts: 460
Joined: Saturday 11 January 2014 17:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: NL
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Raspberry Piet » Monday 02 October 2017 22:38

Nice article indeed!
Already have a Sonoff Pow with the espurna firmware, works very good. :!:

Now i flashed espurna 1.9.5 for my ECH1560 Chinese powermeter. (wemos d1-mini inside)
It is showing some values but it is a bit jumpy:
Image

Code: Select all

    #define ECH1560_CLK_PIN     5
    #define ECH1560_MISO_PIN    14
    #define ECH1560_INVERTED    0  
I don't have it wired with an optocoupler but with a levelshifter (it works! with the firmware from Sweetpants)
So i thought i should change the ECH1560_INVERTED to 1 but it keeps this same erratic behavior :|
How to debug this?
Also found another bug? Voltage IDX is gone after a reboot:
Image

And i can't find the Power Calibration menu. (not visible)
Hope this can be fixed, i really like the espurna firmware!

Kapee
Posts: 12
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee » Tuesday 03 October 2017 12:06

In the software of Karl Hagström I see the line:

if ((U > 195) && (U < 253) && (P >= 0) && (P < 4000)) // ignore spurious readings with voltage or power out of normal range
{

I adapted this line a little, in the Netherlands the voltage can be 230volt -15% +10%
Perhaps this can help you.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests