reading digital meter P1 port

66 views
Skip to first unread message

Filip De Smedt

unread,
Nov 9, 2024, 11:19:43 AM11/9/24
to jallist

Hello,

I have been occasionally programming microcontrollers in JAL for some time now (16 years). I have already consulted, read, ... Bert Van Dam's books on this subject several times.

However, I am now busy reading the digital meter (Belgium) which was installed this year with a PIC. I would like to activate a relay if there is a surplus of injected current.

 However, it is not very clear to me to read the value of the current injected current (1-0:2.7.0). So that I use " if .... end if " to program a relay to be energized upon current injection. I use a 16f877a, where the RXD of the RJ12 connector is inverted by a 74LS04 and is thus connected to the RX input of the PIC. The RTS of the RJ12 connector is connected to the GND. RJ12 connector is connected to the smart meter, and this smart meter is also already activated to enable reading. The serial_SW_baudrate is set to 9600 and serial_SW_invert = true. The 16f877a is connected with a crystal.

I would like the current injected stream in a byte (8 bit unsigned value 0 to 255). The injected power is passed on by the meter in Kwh.

 Can someone help me to read this value?

Thanks a lot

 

Rob CJ

unread,
Nov 9, 2024, 11:30:39 AM11/9/24
to jallist
Hello Filip,

It is not yet clear the me what you are looking for.

Is the meter connected via the serial interface to the PIC and is it sending a byte (I do not understand what you mean by 1-0:2.7.0)?

And if so do you want to activate a relay when this byte reaches a certain value?

A drawing of the schematic diagram would help.

Thanks.

Kind regards,

Rob




Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Filip De Smedt <filipde...@gmail.com>
Verzonden: zaterdag 9 november 2024 15:22
Aan: jallist <jal...@googlegroups.com>
Onderwerp: [jallist] reading digital meter P1 port
 
--
You received this message because you are subscribed to the Google Groups "jallist" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallist+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jallist/462bdcdc-3f6c-4e64-a555-fc98d4054cfcn%40googlegroups.com.

Rob CJ

unread,
Nov 9, 2024, 1:35:12 PM11/9/24
to jallist
Hi Filip,

A reply from Hans van Veldhuizen. He has some issues with posting the message on Google Groups.

Hi Filip,


It looks like you are trying to decode a (what we call) "smart meter". Looking at your mail it is a meter that conforms to the DSMR (Dutch Smart Meter Requirements). If so, I think a PIC is not directly the best choise. DSMR is rather complex, and timing is critical. Reading your mail I think it might be too complex for you.


I suggest you start your decoding efforts with a thorough study of the requirements (https://www.netbeheernederland.nl/publicatie/dsmr-502-p1-companion-standard) and when you want to decode them I suggest you use more capable hardware like a Raspberry Pi.


A RPi 1A will suffice, even that is way more powerfull than a PIC and far easier to debug.

RPi examples can be found on the internet. I have never seen anyone using a PIC for this.


regards,


JH.


ps. I don't know what DSMR version your meter is running, but current versions (>=4.0) run at 115200 baud.


jh.




Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Rob CJ <rob...@hotmail.com>
Verzonden: zaterdag 9 november 2024 17:30
Aan: jallist <jal...@googlegroups.com>
Onderwerp: Re: [jallist] reading digital meter P1 port
 

Filip De Smedt

unread,
Nov 10, 2024, 8:33:37 AM11/10/24
to jallist
Hallo,

Enkele jaren geleden had iemand dit al gedaan met een PIC. Aangezien ik nog niet wil overschakelen op andere systemen zou ik toch eerst graag dit zo te doen.


In bovenstaand project stuurt hij de data, welke hij uit de digitale meter haalt, naar een display. Echter wil ik gewoon maar 1 data eruit filteren om een relais aan te sturen.
Zijn JAL bestanden, welke je kan downloaden op zijn website, heb ik al meermaals bekeken, maar ik geraak er niet uit.

De p1 poort van de digitale meter is via een RJ11 connecter en kabel verbonden naar de 74ls04 inverter. Deze dient om het signaal van de RXD te inverteren. Daarna is de uitgang van de  74ls04  verbonden met de RX26 van de pic16f877. Dan is er nog juist 1 uitgang van de PIC verbonden om een relais aan te sturen. Buiten een kristal is er ook niet meer dan dat verbonden. M.a.w. geen display, batterij,.... welke gebruikt werd op de site.

Ik heb juist hulp nodig om de waarde van 1-0:2.7.0 (huidige productie zonne-energie) uit te lezen en in een byte of word te zetten zodat ik hiermee verder kan om een relais aan te sturen.

Alvast bedankt,

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hello

A few years ago, someone had already done this with a PIC. Since I don't want to switch to other systems yet, I would like to do this first.

http://fabien.galerio.org/pp/2013-07-slimmemeterdisplay.html

In the above project, he sends the data, which he retrieves from the digital meter, to a display. However, I just want to filter out 1 data to control a relay.
I've looked at his JAL files, which you can download from his website, several times, but I can't figure it out.

The p1 port of the digital meter is connected to the 74ls04 inverter via an RJ11 connecter and cable. This is used to invert the signal from the RXD. After that, the output of the 74ls04 is connected to the RX26 of the pic16f877. Then there is just 1 output of the PIC connected to control a relay. Outside of a crystal, there is no more than that connected. In other words, no display, battery,.... which was used on the site.

I just need help to read the value of 1-0:2.7.0 (current production solar energy) and put it in a byte or word so that I can continue to control a relay.

Thanks in advance,


Op zaterdag 9 november 2024 om 17:30:39 UTC+1 schreef Rob CJ:

Hans van Veldhuizen

unread,
Nov 10, 2024, 10:14:46 AM11/10/24
to jallist
More than 10 years ago I made something like this. If you leave out all the display stuff and only look at the LEES procedure and the forever loop you see the KW in and out. But the OUT is always the difference between solar panels and own use.

Op zondag 10 november 2024 om 14:33:37 UTC+1 schreef Filip De Smedt:
smart_20.jal

Hans van Veldhuizen

unread,
Nov 10, 2024, 10:58:06 AM11/10/24
to jallist
ISKRA version 

Op zondag 10 november 2024 om 16:14:46 UTC+1 schreef Hans van Veldhuizen:
smart_meter_Iskra.jal
ZELFBOUW UITLEZER_2.doc.pdf

David VB

unread,
Nov 10, 2024, 3:10:44 PM11/10/24
to jallist
I'm interested to join this project, but I cannot access the webpage
http://fabien.galerio.org/pp/2013-07-slimmemeterdisplay.html

It apperently contains dangerous URL's.....

Could it be possible to share those ressources on a Google Drive or in Github ?

Hans van Veldhuizen

unread,
Nov 11, 2024, 2:16:10 AM11/11/24
to jallist
I am curious about the implementation of this idea
If the relay pulls and another user switches on, the value of the meter will immediately drop and the relay will switch off again
For this purpose, I have placed a current sensor on the solar panel cable and experimentally determined the value at which my boiler switches on. It is not affected by a cloud in front of the sun

Op zondag 10 november 2024 om 21:10:44 UTC+1 schreef David VB:

Filip De Smedt

unread,
Nov 11, 2024, 5:36:06 PM11/11/24
to jallist
I would like to control a heating unit/boiler. This may or may not be done via PWM control, so that the output is controlled depending on the input. This not constantly, but e.g. every 5 minutes.

Op maandag 11 november 2024 om 08:16:10 UTC+1 schreef Hans van Veldhuizen:

Filip De Smedt

unread,
Nov 11, 2024, 5:36:49 PM11/11/24
to jallist
Great, thank you.
I'm going to look into this further.

Op zondag 10 november 2024 om 16:58:06 UTC+1 schreef Hans van Veldhuizen:

Filip De Smedt

unread,
Nov 11, 2024, 5:37:22 PM11/11/24
to jallist
Great, thank you.


Filip De Smedt

unread,
Nov 11, 2024, 5:40:43 PM11/11/24
to jallist
Op zondag 10 november 2024 om 21:10:44 UTC+1 schreef David VB:
I'm interested to join this project, but I cannot access the webpage
Display voor de slimme energiemeter.pdf

Filip De Smedt

unread,
Nov 11, 2024, 5:41:39 PM11/11/24
to jallist
no problem, Hans has already helped me further

Op zaterdag 9 november 2024 om 17:30:39 UTC+1 schreef Rob CJ:
Hello Filip,

J. Herriot

unread,
Nov 12, 2024, 12:45:23 PM11/12/24
to jal...@googlegroups.com

Hi Filip,


It looks like you are trying to decode a (what we call) "smart meter". Looking at your mail it is a meter that conforms to the DSMR (Dutch Smart Meter Requirements). If so, I think a PIC is not directly the best choise. DSMR is rather complex, and timing is critical. Reading your mail I think it might be too complex for you.


I suggest you start your decoding efforts with a thorough study of the requirements (https://www.netbeheernederland.nl/publicatie/dsmr-502-p1-companion-standard) and when you want to decode them I suggest you use more capable hardware like a Raspberry Pi.


A RPi 1A will suffice, even that is way more powerfull than a PIC and far easier to debug.

RPi examples can be found on the internet. I have never seen anyone using a PIC for this.


regards,


JH.


ps. I don't know what DSMR version your meter is running, but current versions (>=4.0) run at 115200 baud.


jh.



Hans van Veldhuizen

unread,
Nov 12, 2024, 1:01:09 PM11/12/24
to jallist
Hi JH, if a simple tinkerer like me was able to make this with a PIC more than 10 years ago, it should be no problem for a more experienced JAL builder. See my response of 10 Nov 2024, 16:58:06
Hans

Op dinsdag 12 november 2024 om 18:45:23 UTC+1 schreef J. Herriot:

Hans van Veldhuizen

unread,
Nov 14, 2024, 9:09:58 AM11/14/24
to jallist
This adjustment is not shown in the diagrams.

Op dinsdag 12 november 2024 om 19:01:09 UTC+1 schreef Hans van Veldhuizen:
wijziging slimme meter.jpg

Hans van Veldhuizen

unread,
Jan 26, 2025, 9:01:45 AMJan 26
to jallist
Hello everyone,
It has been quiet on this topic for a while. I am now preparing for a battery-tuc-tuc that I want to charge when I have surplus solar panels. The smart meter reading gives me the difference between (solar panel yield and own use). For a good approximation I need the yield of the solar panels. Unfortunately I have not succeeded in getting those values ​​from the inverters.
I have now put an ampere meter around a solar panel cable and when there is a little sun I can see the relationship between the amperage and the generated Watts.
aaaaa.jpg
Because the charging connection, the ampere meter and the smart meter are not close to each other I initially planned to connect the thing with RS485. Fortunately, with the help of Rob I now have the smart meter values ​​wirelessly. I can bring the thing together more easily.
I am not finished yet but I would like it if more JALLERS do something like that.
Greetings
Hans
PS. In attachment the wireless thing for my ISKRA meter.

Op donderdag 14 november 2024 om 15:09:58 UTC+1 schreef Hans van Veldhuizen:

Rob CJ

unread,
Jan 28, 2025, 12:28:39 PMJan 28
to jal...@googlegroups.com
Hi Hans,

I have build the same thing, that is a Transmitter that reads the P1 port of a smart meter and sends the power consumed or power deliverd values to  a receiver - using an nRF24L01 - that shows if I am using power from the mains or delivering power to the mains. It is still a prototype since my meter is not yet smart 😀.

In order to see if your inverter is delivering power to the mains why not use an AC current meter to measure the current deliverd by the inverter? There must be a mains cable going to your inverter.

I was also thinking of the following. Most inverters support the sunspec specification which would mean that you could read out the values of the inverter using an RS485 interface. I first wanted to do that but my SolarEdge inverter is too old and the firmware cannot be upgraded to support this.

Good luck with your project.

Kind regards,

Rob


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Hans van Veldhuizen <hanz...@zeelandnet.nl>
Verzonden: zondag 26 januari 2025 15:01
Aan: jallist <jal...@googlegroups.com>
Onderwerp: Re: [jallist] reading digital meter P1 port
 

Hans van Veldhuizen

unread,
Jan 28, 2025, 1:47:06 PMJan 28
to jallist
Hello Rob,
I assume that we are working on a hobby.
 Solar panels quickly work with 400 V= and only tinker in the meter cupboard if there is really no other option.

Clamping a sensor around one of the panel cables is safe and 
as far as I have measured now, the relationship between the analog value that the thing gives and the Watts that the inverter delivers is almost linear.

 Quite different is placing a AC current sensor in the output of the power  inverter.

Then the inverter that you need for the P1 port.
 In my case, a transistor with three resistors is sufficient.
 I have also tried the RS485 and that also works, just like the 74LS04 but I experience my creation as simpler and smaller.

I also use the nRF2401. (thanks to your help and patience!!!) with a 16F15325 for transmitter and receiver. 
 On the receiver I then have an AD port free for the current measurement and one to control a relay
. Of course my “IF-THEN” approach does not deserve a beauty prize but it works.

Finally: A Home Wizard Dongle and an Energy socket together cost less than €60. You then have everything ready on your phone.

Still, tinkering yourself is much more fun.
Greetings
Hans

Op dinsdag 28 januari 2025 om 18:28:39 UTC+1 schreef Rob CJ:

Hans van Veldhuizen

unread,
Jan 29, 2025, 3:39:21 PMJan 29
to jallist
Oops, sorry, but I am withdrawing my HomeWizard  purchase advice
. I have been working on that so-called smart plug with which I could use my surplus of solar energy for my tuf-tuf.

It appears to use a ‘Flintstone algorithm’
.If it detects a certain return value from the P1 meter before a certain time, it switches on the output for a certain time before it starts looking again

. If I make coffee in the meantime, it is usually with energy from outside.
I will happily continue with my construction.
Greetings
Hans

Op dinsdag 28 januari 2025 om 19:47:06 UTC+1 schreef Hans van Veldhuizen:
Reply all
Reply to author
Forward
0 new messages