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: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Tuesday 07 March 2017 16:50

wvries wrote:Hi SweetPants

Would you be so kind to also send me a mesage with your code ?

Got all stuff in and ready to do some work on it.
send you a PM
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Tuesday 07 March 2017 16:51

josbo12 wrote:Hi SweetPants,


I am working on the same project, but it does not work very well, you could publish the code?

Thanks
send you a PM
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

Ningaloo
Posts: 1
Joined: Monday 27 March 2017 20:52
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by Ningaloo » Monday 27 March 2017 21:00

Hi SweetPants,

guess what. I like to receive your code too.
I use this power meter on a solar microinverter. It seems to measure power in both directions.
It would be nice to send the data to domoticz

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Sunday 09 April 2017 11:44

Ningaloo wrote:guess what. I like to receive your code too.
send you a PM
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

Kapee
Posts: 14
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 09 April 2017 21:15

I also want to make this power meter wireless.
The ESP8266 version that I want to use is the Wemos D1 mini.
Hope I also can get the code.
I will send a pm to Sweetpants (edit: not succeeded)

Kapee
Posts: 14
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 02 May 2017 13:14

Still no reaction from Sweetpants, hope he will come back to this topic once more.
Not possible to send a pm to Sweetpants by myself . . .
edit: after this post reply, I can :D

Kapee
Posts: 14
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 » Friday 12 May 2017 10:54

Unfortunately I am not familiar with the C compiler for the software, so I could not use the software from Sweetpants, sorry for that.
Normally I work with Arduino ide and the last couple of month I use the wemos D1 mini.
I wanted this wemos D1 mini build in in the cheap Chinese power meter and flashed with the Arduino ide.
As level shifter for the signals from the power meter print to the wemos, I used two resistors as a devider (5V -> 3.3V)
So back to the Blogspot of Kalle Hagström and make use of his routines for the power meter.
I succeededd and after all it was not a hugh problem to implement the routines.
A big advantage the solution with the wemos is 'Over The Air' (OTA) flashing and no push button(s) for flashing.
As I said before I don't use Domoticz, but I make a dashboard with Node-red.
20170512 nodered.JPG
20170512 nodered.JPG (34.69 KiB) Viewed 3611 times
20170512 pwrmtr.JPG
20170512 pwrmtr.JPG (36.29 KiB) Viewed 3611 times

pj-r
Posts: 256
Joined: Wednesday 17 December 2014 18:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by pj-r » Friday 12 May 2017 14:13

How accurate this is with inductive loads like motors?
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Friday 12 May 2017 14:17

pj-r wrote:How accurate this is with inductive loads like motors?
Don't know, but what do you expect from a 11 euro device :mrgreen: :mrgreen:
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

littlewouter
Posts: 4
Joined: Monday 15 May 2017 11:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by littlewouter » Wednesday 17 May 2017 14:57

I got exited by this threat and ordered this KWH meter. However, the model I received is different inside:
IMG_20170515_175131.jpg
IMG_20170515_175131.jpg (207.33 KiB) Viewed 3546 times
IMG_20170515_175107.jpg
IMG_20170515_175107.jpg (143.34 KiB) Viewed 3546 times
As the pictures show, the pins SGND, VCC and FREQ still exist, however now there is TX, RX and an unlabeled pin. I measured the pins and the FREQ pin still outputs a 50Hz frequency, TX does outputs something and the unlabeled pin outputs 12V when the socket is connected to the grid.
The TX and RX pins indicate that it's a serial connection and therefore I connected it to a serial program. However, no commonly known baudrate outputted something useful unfortunately. I will now order a logic analyzer to understand the signal.
The PCB seems different than the older KWH-meters. I'm not sure if the IC is changed, my IC was somehow damaged so I couldn't read the text on it.

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Wednesday 17 May 2017 18:40

Rx/Tx are not regular serial ports using a specific baudrate, you have to sample the data against the clock (see original articles http://www.domoticz.com/forum/viewtopic ... 325#p49060)
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

littlewouter
Posts: 4
Joined: Monday 15 May 2017 11:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by littlewouter » Thursday 18 May 2017 9:25

Yeah I read the other posts about this KWH meter, but the thing is that my KWH meter does not seem to have a clock pin. If there is no clock pin, the only other possibility to communicate data is with a set baudrate. In this way both communicating devices know at which times the 0's and 1's are valid data on the Tx and Rx lines.

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Saturday 20 May 2017 9:53

What model did you order?
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

Kapee
Posts: 14
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 21 May 2017 12:25

I ordered a second power meter, because I wanted to do some more tests.
I received the same as littlewouter.
It looks like that there is a redesign of the pcb of the power meter. The pcb is much more simple.
But for me it is unclear which chip is used.
Tomorrow I get a separation transformer and will do some measerements on Tx end Rx

Kapee
Posts: 14
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 » Thursday 08 June 2017 12:12

Well, after a couple of days working on this second power meter, I have it working.
The first thing I did, was to find out which chip was used.
With the help from circuitsonline https://www.circuitsonline.net/forum/vi ... 40#1914040 it turned out that it was a V9261F chip from Vango.
After that I found a soft serial library on Github that could be used https://github.com/plerup/espsoftwareserial
Then I did some measurements with a separation transformer and a logic analyzer.
Pwrmtr2 LA.JPG
Pwrmtr2 LA.JPG (19.96 KiB) Viewed 3272 times
What you see is the RX and TX signal every second. TX is the signal from the V9261F chip. The second burst contains the value for volt and watt.

Then I made the software with Arduino ide including mqtt for the Node-Red dashboard.
Pwrmtr2 (Small).jpg
Pwrmtr2 (Small).jpg (36.05 KiB) Viewed 3272 times
Pwrmtr2 nodered.jpg
Pwrmtr2 nodered.jpg (37.23 KiB) Viewed 3272 times
As a bonus I also made code for the frequency, but here in the Netherlands it is always 50.0 Hz.

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Friday 09 June 2017 8:41

Great job, well done. Are you sharing the code somewhere?
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

Kapee
Posts: 14
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 » Friday 09 June 2017 9:36

Thanks, it was nice to do.
I will share the code here.
Attachments
powermeter.zip
(28.57 KiB) Downloaded 195 times

MaxwellHatcher
Posts: 1
Joined: Monday 12 June 2017 0:30
Target OS: Windows
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by MaxwellHatcher » Monday 12 June 2017 0:34

Kapee wrote:...I will share the code here.
Hi. Wanted to thank you all for this post. Just got a couple more of these and they are the new design. You saved me a lot of work!

I have a dumb question though. Why don't you take power directly off VCC of the PCB?

SweetPants
Posts: 2350
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10196
Location: The Netherlands
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by SweetPants » Tuesday 13 June 2017 12:53

MaxwellHatcher wrote:I have a dumb question though. Why don't you take power directly off VCC of the PCB?
As said in teh first post, the on-board PSU does not deliver enough power. When transmitting, the ESP can use 200mA, way too much for this PSU
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

littlewouter
Posts: 4
Joined: Monday 15 May 2017 11:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Cheap Chinese Power Meter made wireless

Post by littlewouter » Wednesday 05 July 2017 19:14

Great work! Thank you.
I got it working and via node-red I translate the MQTT to a domoticz electricity meter.
I understand that the V9261F chip only measures watt and volts and that these are communicated to the LCD unit which keeps track of the kwh's.
So unfortunately it is probably not possible to read-out the stored kwh's in the meter. However, there must be a way to calculate this from the obtained watt measurements, just as the meter itself is doing.
This can be done in the arduino/ESP8266 or domoticz itself. In my opinion it is more useful to do this in domoticz, since then this can keep track of the total, daily and monthly kwh-values. There are probably some scripts already available for this, any suggestions?
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.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests