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

Moderator: leecollings

fibigod
Posts: 4
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

Post by fibigod »

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: 25
Joined: Thursday 19 February 2015 11:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by niwreg »

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: 9
Joined: Saturday 13 August 2016 14:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Bighouse »

Does anyone know whether I will need a Pull-up resistor with the Kaifa E0025?
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

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

Post by gizmocuz »

Quality outlives Quantity!
Cletus
Posts: 54
Joined: Wednesday 17 August 2016 9:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Purmerend, Netherlands
Contact:

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

Post by Cletus »

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: 25
Joined: Thursday 19 February 2015 11:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by niwreg »

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
niwreg
Posts: 25
Joined: Thursday 19 February 2015 11:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by niwreg »

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 :)
wmnl
Posts: 2
Joined: Thursday 28 January 2016 22:43
Target OS: Linux
Domoticz version:
Contact:

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

Post by wmnl »

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: 122
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: The Netherlands
Contact:

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

Post by mlamie »

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
Raspberry Pi 3, RaZberry, RFXtrx433
Various Z-Wave devices, KlikAanKlikUit devices, ESP8266 NodeMCU, Sonoff POW and a Essent E-thermostaat
IP camera: Dahua 4MP IPC-HDBW4421R-AS, Vivotek FD8134V
hendrik6073
Posts: 9
Joined: Wednesday 28 January 2015 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by hendrik6073 »

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: 138
Joined: Thursday 01 May 2014 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands - Sittard
Contact:

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

Post by D'rMorris »

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: 316
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

Post by renerene »

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

pi@raspberrypi:~ $ cu -l /dev/ttyAMA0 -s 9600 --parity=none
cu: open (/dev/ttyAMA0): Permission denied
cu: /dev/ttyAMA0: Line in use
Tips?
renerene
Posts: 316
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

Post by renerene »

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?
User avatar
mlamie
Posts: 122
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: The Netherlands
Contact:

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

Post by mlamie »

renerene wrote: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?
A small tip, look at the following wiki page: https://www.domoticz.com/wiki/PersistentUSBDevices

Use the lsusb command to see all the devices connected on your Raspberry Pi.
Raspberry Pi 3, RaZberry, RFXtrx433
Various Z-Wave devices, KlikAanKlikUit devices, ESP8266 NodeMCU, Sonoff POW and a Essent E-thermostaat
IP camera: Dahua 4MP IPC-HDBW4421R-AS, Vivotek FD8134V
renerene
Posts: 316
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

Post by renerene »

A small tip, look at the following wiki page: https://www.domoticz.com/wiki/PersistentUSBDevices
Use the lsusb command to see all the devices connected on your Raspberry Pi.
1) Sorry, I don't get it. On which USB port is device 012?
Image

2) With help from my laptop I found out that handshake type is critical: it should be RTS/CTS. In the command line CU and in Domoticz there is no handshake parameter, that can be set. How to set the correct handshake type?
Image
pkessels
Posts: 5
Joined: Wednesday 22 February 2017 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by pkessels »

Nobody a clue regarding the issue with the handshake, I have exactly the same issue.
On my laptop with a terminal I got data, on the raspberry pi I got a message connected and then the screen starts scrolling but no text on the screen.
In Domoticz I see in the logging that the device get opened, but also closed.
Help!
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

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

Post by bbqkees »

Did you try a resistor between pin 2 and 5?

What you can also try is to connect pin 1 and 2.
This will drive RTS high all the time. This will force the meter to generate the datagram every 10 seconds.
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
User avatar
mlamie
Posts: 122
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: The Netherlands
Contact:

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

Post by mlamie »

renerene wrote:
A small tip, look at the following wiki page: https://www.domoticz.com/wiki/PersistentUSBDevices
Use the lsusb command to see all the devices connected on your Raspberry Pi.
1) Sorry, I don't get it. On which USB port is device 012?
The idea is that you will create a rule in the udev folder. That rule will contain the {idVendoridVendor}, {idProduct} and the {serial} of your USB device. Based on those device details you can plug the USB device in any of the RPI USB ports and will automatically be matched with the SYMLINK which you have given in the rule. That SYMLINK should be selected in Domoticz Hardware setup page.
Raspberry Pi 3, RaZberry, RFXtrx433
Various Z-Wave devices, KlikAanKlikUit devices, ESP8266 NodeMCU, Sonoff POW and a Essent E-thermostaat
IP camera: Dahua 4MP IPC-HDBW4421R-AS, Vivotek FD8134V
Jeff
Posts: 22
Joined: Monday 15 December 2014 23:39
Target OS: Windows
Domoticz version: 2.3674
Location: Weert, Netherlands
Contact:

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

Post by Jeff »

I've had a new gas+electricity meter installed (landys+gyr E350 DSMR 5) and hade to make a new cable for it,
While doing the initial testing with the 115200 7N1 parameters and inverted RXD i noticed that the data is not being displayed properly with this cable.

The board is correctly soldered since it worked fine with another FTDI 232 TLL232 5V cable, so i got a replacement cable and completely remade the board with a 1.5kohm resistor. Unfortunately still no proper telegram.

Could this be meaning that the p1 port is bogus? or does anyone have another solution for this?

The only data that is coming trough is the following:
Image
Image
Last edited by Jeff on Saturday 01 July 2017 16:09, edited 1 time in total.
snottt
Posts: 1
Joined: Sunday 21 May 2017 19:26
Target OS: -
Domoticz version:
Contact:

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

Post by snottt »

I have built a P1 cable with a Winchiphead HL-340 chip in a serial to usb cable like posted earlier on this forum. For some reason I get empty readings from it on my Raspberry Pi with cu. Every ten seconds I see the cursor moving forward, but without showing any data. In an attempt to check if my cable is faulty, I installed Domoticz on my windows computer and here Domoticz shows the information from my smart meter every ten seconds. Does anyone have an idea what could be the problem? I used 115200 baudrate. A power adapter 5V 2.0A for the RPI gives the same blank result every 10s.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest