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.

Moderator: leecollings

SweetPants

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants »

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: 13
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee »

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: 52
Joined: Sunday 27 December 2015 19:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo »

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: 18
Joined: Wednesday 15 March 2017 9:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by bilbolodz »

Kapee wrote: Thursday 08 June 2017 12:12The 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: 13
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee »

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: 18
Joined: Wednesday 15 March 2017 9:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by bilbolodz »

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

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants »

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 what I read :mrgreen: :mrgreen: :mrgreen:
Last edited by SweetPants on Tuesday 23 January 2018 20:24, edited 1 time in total.
Kapee
Posts: 13
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee »

Indeed, that's what I meant.
Rolo
Posts: 52
Joined: Sunday 27 December 2015 19:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo »

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 15:21
Target OS: Linux
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by xose »

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: 52
Joined: Sunday 27 December 2015 19:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo »

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: 13
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee »

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 10765 times
xose
Posts: 3
Joined: Saturday 31 December 2016 15:21
Target OS: Linux
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by xose »

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: 52
Joined: Sunday 27 December 2015 19:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Rolo »

Nice article. You took the time to gather all the info.
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Raspberry Piet »

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: 13
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee »

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.
bilbolodz
Posts: 18
Joined: Wednesday 15 March 2017 9:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by bilbolodz »

I've some problems with ESPurna V9261F version of power meter: almost all values are wrong displayed at web page and some values in mqtt are also wrong. Measure conditions (read from LCD screen): 23,7W, 0.014 KWh, 245.9V, 0.174A power factor: 0.55, 50Hz

At the status web page the only "non zero value" is voltage: 245 V (rest are 0), in mqtt message I can see:
miernik_mocy_1/data {"current":"0.18","apparent":"24","energy_delta":"1486.067","energy_total":"51032.548","power":"24","reactive":"0","voltage":"246","factor":"100.00","time":"2017/11/25 15:46:29","host":"miernik_mocy_1","ip":"192.168.105.236"}
miernik_mocy_1/data {"app":"ESPURNA","version":"1.9.9","host":"miernik_mocy_1","ip":"192.168.105.236","mac":"60:01:94:37:8C:91","rssi":"-56","uptime":"3000","freeheap":"19928","vcc":"3018","time":"2017/11/25 15:51:29"}
I've tried to calibrate but not quite how to do it.
bilbolodz
Posts: 18
Joined: Wednesday 15 March 2017 9:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by bilbolodz »

I've made a "config reset". Now not correct are only
- "Reactive Power": 0 "VAR"
- Power Factor: 100%
Arek84
Posts: 3
Joined: Friday 12 January 2018 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Arek84 »

I have a similar cheap energy meter with SPI, it looks like ECH1650
miernik1.jpg
miernik1.jpg (273.36 KiB) Viewed 9325 times
but unfortunately it does not work with espurna-1.12.1-esp01-ech1560.
connected ESP07 GND => GND, CLK => GPIO04, SDO => GPIO05
[THINGSPEAK] Async ENABLED, SSL DISABLED
[SENSOR] ECH1560 @ GPIO(4,5)
[SENSOR] -> current:0
[SENSOR] -> voltage:0
[SENSOR] -> apparent:0
From the description on the board it is CS5460.
Is it possible to make an espurna working with cs5460?
Kapee
Posts: 13
Joined: Sunday 09 April 2017 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Kapee »

I made an adaptation to my 3rd powermeter.
The used wemos D1 mini has several unused ports, so I added a transistor + relay to switch the output power.
Now I can switch on or off the output power by Node-Red.
Pwrmtr3 .jpg
Pwrmtr3 .jpg (78.88 KiB) Viewed 8291 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest