DIY cheap USB-cable to read P1 port of Dutch smart meter

osiris
Posts: 39
Joined: Friday 08 May 2015 8:32
Target OS: Raspberry Pi
Domoticz version:
Location: Amsterdam
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby osiris » Thursday 12 May 2016 19:41

I am trying to build the "cheap p1 cable" So far with no result.

As a usb to serial converter I bought this cable: http://www.ebay.com/itm/191734723491?rmvSB=true Which is listed as an

USB to 9-Pin Serial Cable HL-340 USB To Serial Cable USB-RS232 Support Win7

What I've done so far:
  • tried both 9600 and 115200
  • tried cu and screen
  • tried a resistor of 1000 and 2200 ohm
  • tried a 2.0A and a 1.2A power adapter for the RPI
  • tried to switch green and red (according to the official wire coloring the red should be disconnected while the picture uses the red wire)

All I get is scrambled messages. Does anyone have a clue what I might do wrong?
Attachments
Screen Shot 2016-05-12 at 19.11.47.png
Screen Shot 2016-05-12 at 19.11.47.png (44.17 KiB) Viewed 1520 times

gordonb3
Posts: 329
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby gordonb3 » Thursday 12 May 2016 23:13

osiris wrote:
  • tried to switch green and red (according to the official wire coloring the red should be disconnected while the picture uses the red wire)

All I get is scrambled messages. Does anyone have a clue what I might do wrong?

I posted about this earlier. The wires on a standard 4-wire phone cable are crossed (or mirrored, which happens to be the same for this layout). Meaning that if you get no signal at all with the red wire connected you should not only use the green instead, but also exchange black and yellow. Or use the other half of the original cable you cut for this project.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.5814

osiris
Posts: 39
Joined: Friday 08 May 2015 8:32
Target OS: Raspberry Pi
Domoticz version:
Location: Amsterdam
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby osiris » Saturday 14 May 2016 14:48

gordonb3 wrote:
osiris wrote:
  • tried to switch green and red (according to the official wire coloring the red should be disconnected while the picture uses the red wire)

All I get is scrambled messages. Does anyone have a clue what I might do wrong?

I posted about this earlier. The wires on a standard 4-wire phone cable are crossed (or mirrored, which happens to be the same for this layout). Meaning that if you get no signal at all with the red wire connected you should not only use the green instead, but also exchange black and yellow. Or use the other half of the original cable you cut for this project.


Thanks! I tried switching yellow and black before without result. I decided to start all over again with new wires and now it worked. It turned out a connect worn out because of the many changes I made on the prototype board.

fibigod
Posts: 3
Joined: Thursday 23 June 2016 17:08
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby fibigod » Thursday 23 June 2016 17:16

Hey guys,

I use the same cable as osiris.
And connect it to my Synology.

I use it at 9600 baud rate. And I see in the log that the power reading is coming in every so what seconds. But the device is staying at 0.
at 115200 it gives no log entry's so I assume that's not working.

2016-06-23 16:59:39.429 (P12) P1 Smart Meter (Power)
2016-06-23 16:59:49.922 (P12) P1 Smart Meter (Power)
2016-06-23 17:00:00.429 (P12) P1 Smart Meter (Power)

When I connect the cable to my laptop and use putty, 9600,7,none,none. I can see clearly data without any errors.
I also tried using a 1K and a 2K resistor, but with no success. (data putty fine, no data in domoticz)
Also check cables for bad connections etc.

Still I think it's a setting? because putty gives clear info.
Can i use a serial monitor on the NAS trough ssh? Like CU on unix/RPI?

- Synology NAS
- Domoticz V3.4834
- Kamstrup Meter

fibigod
Posts: 3
Joined: Thursday 23 June 2016 17:08
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby fibigod » Tuesday 28 June 2016 12:23

Progress so far.

I installed minicom on my NAS. And there is a lot of gibberish coming out the first time and then every 10 seconds a square.
With Putty on my windows machine the data is perfect.

Tried external psu to kamstrup and used different resistors, but I think it's a problem on the synology. Because the windows machine has no problem with the cable.

Is there somebody with a few tips I can try?

fibigod
Posts: 3
Joined: Thursday 23 June 2016 17:08
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby fibigod » Saturday 02 July 2016 15:35

Doesn't know if somebody is alive at this board/topic.

But I update it anyway.

I've made a new setup on a raspberry Pi. And when i use the following command I get good data.

cu -l /dev/ttyUSB0 -s 9600 --parity=none
Connected.
/KMP5 KA6U001551500611

0-0:96.1.1(204B413655303031353531353030363131)
1-0:1.8.1(06086.160*kWh)
1-0:1.8.2(07634.179*kWh)
1-0:2.8.1(00000.000*kWh)
1-0:2.8.2(00000.000*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(0000.45*kW)
1-0:2.7.0(0000.00*kW)
0-0:96.13.1()
0-0:96.13.0()
0-1:24.1.0(3)
0-1:96.1.0(3238303039303031313037323537353131)
0-1:24.3.0(160702150000)(08)(60)(1)(0-1:24.2.1)(m3)
(02307.368)
!

When I use it in domoticz. I still get no readings. But the log get's data every 10 seconds.

P.S.

Minicom don't gives good data output so don't use that as a test program

niwreg
Posts: 14
Joined: Thursday 19 February 2015 12:33
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby niwreg » Tuesday 12 July 2016 21:33

I've run in the same problem. Made an cheap connector (with transistor inverter first but then i got all giberisch, so it is basic to rs232 usb converter. Added 2k resistor between rts and rx. )

When using windows 10 with putty or minicom the data works, but under domoticz nothing, i tried with several scripts and programs but all i get is blank and messed up terminal. Cu and such won't work. I'm i doing something wrong?

Edit:

I use an external USB (powered) hub to feed the rs232 converter

Bighouse
Posts: 4
Joined: Saturday 13 August 2016 14:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby Bighouse » Saturday 13 August 2016 14:58

Does anyone know whether I will need a Pull-up resistor with the Kaifa E0025?

User avatar
gizmocuz
Posts: 7730
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby gizmocuz » Saturday 13 August 2016 15:15

Quality outlives Quantity!

User avatar
Cletus
Posts: 36
Joined: Wednesday 17 August 2016 9:32
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Purmerend, Netherlands
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby Cletus » Friday 19 August 2016 20:21

So, i tried this out today for myself and i would like to share my findings with you guys!

I have a USB to RS232 Adapter unbranded with a Prolific PL-2303 chip. Looks like this:
Image

And a Kaifa smart meter (not sure about the type, don't know where to find it :P)

I did some research today about the meters, data sending etc and i saw that you need a resistor and a mosfet to invert the data. I didnt have all that stuff lying around so i just took apart the cable and soldered the 5V onto the 5V on the USB connector, Ground on the ground and the data on the RS232 connector port 2 without any resistors or anything. It immediately worked fine on 115200 BAUD! And the Rpi immediately worked fine!

Pinout on the RJ-11 plug and RS232 plug is:
Image

See attached photo of my soldering tricks :P

Image

Hope this helps people also! :)

Gr, Paul
This is our world now... the world of the electron and the switch, the beauty of the baud.

niwreg
Posts: 14
Joined: Thursday 19 February 2015 12:33
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby niwreg » Wednesday 24 August 2016 20:32

Well i found something interessting, i decided to try my home made dongle (ch341-uart) on a spare laptop with ubuntu installed on it. And i found that i also get blank data there. So it seems like a problem with the ch341 driver and linux. Not the hardware.

I'm reflashed an esp01 with esp-link so my smartmeter does get wireless uart, but i'm going to have a look into this when i have some spare time.

Well this explains a lot: https://github.com/torvalds/linux/blob/ ... 341.c#L363

gordonb3
Posts: 329
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby gordonb3 » Wednesday 31 August 2016 16:23

niwreg wrote:Well i found something interessting, i decided to try my home made dongle (ch341-uart) on a spare laptop with ubuntu installed on it. And i found that i also get blank data there. So it seems like a problem with the ch341 driver and linux. Not the hardware.

I'm reflashed an esp01 with esp-link so my smartmeter does get wireless uart, but i'm going to have a look into this when i have some spare time.

Well this explains a lot: https://github.com/torvalds/linux/blob/ ... 341.c#L363

For what it's worth, it does work on my system (Linux 4.3.0)
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.5814

niwreg
Posts: 14
Joined: Thursday 19 February 2015 12:33
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby niwreg » Wednesday 31 August 2016 22:06

gordonb3 wrote:
niwreg wrote:Well i found something interessting, i decided to try my home made dongle (ch341-uart) on a spare laptop with ubuntu installed on it. And i found that i also get blank data there. So it seems like a problem with the ch341 driver and linux. Not the hardware.

I'm reflashed an esp01 with esp-link so my smartmeter does get wireless uart, but i'm going to have a look into this when i have some spare time.

Well this explains a lot: https://github.com/torvalds/linux/blob/ ... 341.c#L363

For what it's worth, it does work on my system (Linux 4.3.0)


on 9600 baud? Or 115200? Because the 115200 should work because that uses 8bit no parity :)

gordonb3
Posts: 329
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby gordonb3 » Thursday 01 September 2016 7:51

That might explain it. My meter is DSMR 4.2, so that runs on 115200.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.5814

wmnl
Posts: 2
Joined: Thursday 28 January 2016 23:43
Target OS: Linux
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby wmnl » Tuesday 08 November 2016 20:56

Just confirming that this method still works with the brand new (at least for the Dutch Alliander) ISKRA AM550 which is on DSMR 5.0 =) It's got an inverted signal.

Image

ImageImage

User avatar
mlamie
Posts: 76
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: The Netherlands
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby mlamie » Thursday 15 December 2016 23:14

Cletus wrote:So, i tried this out today for myself and i would like to share my findings with you guys!

I have a USB to RS232 Adapter unbranded with a Prolific PL-2303 chip. Looks like this:

And a Kaifa smart meter (not sure about the type, don't know where to find it :P)

I did some research today about the meters, data sending etc and i saw that you need a resistor and a mosfet to invert the data. I didnt have all that stuff lying around so i just took apart the cable and soldered the 5V onto the 5V on the USB connector, Ground on the ground and the data on the RS232 connector port 2 without any resistors or anything. It immediately worked fine on 115200 BAUD! And the Rpi immediately worked fine!

Pinout on the RJ-11 plug and RS232 plug is:

See attached photo of my soldering tricks :P

Hope this helps people also! :)

Gr, Paul


Hi Paul,

Great explanation. I have the same setup "PL-2302 cable" and "Kaifa smart meter" and it works without any extra components! :D

Lets see if the installation by Liander is for free. I requested a smart meter and they installed it 2 days ago, until now no bill have been seen or send.

Gr, Michel
Gateway: Raspberry Pi 3, RaZberry, RFXtrx433
Parts: Vision ZD 2102, Vision ZM 1601, Greenwave Smart plug 6, KlikAanKlikUit ACDB-7000BC, APIR-2150, AWMR-230, ESP8266 NodeMCU and a Essent E-thermostaat
IP camera: Dahua 4MP IPC-HDBW4421R-AS, Vivotek FD8134V

hendrik6073
Posts: 16
Joined: Wednesday 28 January 2015 13:01
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby hendrik6073 » Sunday 18 December 2016 20:34

wmnl wrote:Just confirming that this method still works with the brand new (at least for the Dutch Alliander) ISKRA AM550 which is on DSMR 5.0 =) It's got an inverted signal.

Image

ImageImage


what of the above mensioned approaches are you confirming ? I also have the ISKRAM AM550. Apporoach that Cletus uses (only pin 2 and 5v and ground direct to USB cables) gives me no data. not at 9600 nor 112500. using the CH340 bases cable

D'rMorris
Posts: 262
Joined: Thursday 01 May 2014 9:01
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands - Sittard
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby D'rMorris » Wednesday 04 January 2017 14:54

I can also confirm that a simple USB to DB9 convertor works in combination with the Landis & Gyr E350 meter.

At first, I had a lot of trouble getting it to work with a simple FT232RL USB to serial adapter. I was using this one, which I normally use to program Arduinos / ESPEasy modules. I only got jibberish out of Putty. I then realized that this chip needs to invert the RxD data coming in, so I tried using the FTprog program to invert the data. This seemed to work at first, but I then noticed that the chip was never programmed to invert RxD. FTprog recognized the module, I could set the data to invert, I could program the chip (or so it seemed) and FTprog even notified me: Programming succeeded! However, when I refreshed the display, the RxD invert was disabled again.

After googling a bit, I found a site that described my problem. Apparently I bought a fake FTDI chip, which is only accessible in read mode (determined by the Windows driver). I checked the serial number of my module and indeed...it carried serial A50285BI. Although there seem to be ways of programming fake FTDI chips (check here and here), I had a look in my electronics box and found an old USB to RS232 serial module.

This USB to DB9 (RS232) contains the HL-340 chip (hurray: no more inverting the data either via transistor or via FTprog) and that meant I could use it straight away! So, removed the outer casing (it just slides out), soldered the +5V and GND directly to the USB connector (exactly like Cletus did) and soldered the RD to pin2 of the DB9 connector (also exactly like Cletus did). Put a 5K resistor between +5V and RD and then used Terminal to check the incoming data. Reason why I used Terminal is because it has a nice bar on top where you can set the serial properties. I find that too cumbersome in Putty sometimes. Playing around with different settings is much easier in Terminal.

As soon as I clicked "connect" in Serial, the data started flowing in immediately! Took the module out, plugged it into the Pi3, created P1 hardware in Domoticz (do not forget to click "allow hardware for 5 minutes") and I immediately got the devices :-). It's working very stable I must say! Time for a smart water meter as well :-).

renerene
Posts: 27
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby renerene » Monday 09 January 2017 23:51

Hello
I've made a cable using a HL-340 chip for my Kaifa MA105C, but no success yet:

1) after adding hardware "P1 smart meter USB", baudrate "115200, port /dev/ttyAMA0, no devices are added in the Device section of Domoticz. Also, the meter does not show under 'utility'

2) putty output:

Code: Select all

[email protected]:~ $ cu -l /dev/ttyAMA0 -s 9600 --parity=none
cu: open (/dev/ttyAMA0): Permission denied
cu: /dev/ttyAMA0: Line in use


Tips?

renerene
Posts: 27
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: DIY cheap USB-cable to read P1 port of Dutch smart meter

Postby renerene » Wednesday 11 January 2017 14:12

I have managed to solve the permisseon denied issue on ttyAMA0 with help from this post

The cable is succesfully tested, using my Windows10 laptop, after fidling with some settings (baudrate, stop bits, etc) in the terminal program.
However: still no smart meter devices show up in Domoticz after clicking 'enable hardware for 5 minutes'
Also, in putty i can not get correct screendumps.

Two questions:
- which port to choose? (ttyAMA0, ttyUSB0, ttyUSB1 or ttyACM0)
- what is the correct CU command line for a Kaifa MA105C?


Return to “Meters”

Who is online

Users browsing this forum: No registered users and 1 guest