tribp / DSMR-Fluvius-S1-port-simulator

Simulator of DSMR Fluvius S1 interface of smart meter - usefull when debugging S1 applications
GNU Lesser General Public License v2.1
13 stars 3 forks source link

examples of S1 Receiver #2

Closed Cuball0 closed 3 years ago

Cuball0 commented 3 years ago

Hello,

Do you have an example of a S1 Receiver? And maybe some ideas on what fun stuff we could do with it ?

MaxVandenbussche commented 3 years ago

It was quite trivial to get the P1 port working to log the counters and some power consumption. This makes for a neat energy monitor. It can be used to turn on/off some simple appliances.

I think the S1 port is meant to more precisely control inverters or loads on a line cycle by cycle basis.

Cuball0 commented 3 years ago

Yes, P1 port monitoring works fine (a lot of examples from our dutch friends).

But I was looking for maybe some ideas like the product smappee is doing. Detecting appliances based on the electrical characteristics...

Do you think there are useful uses-cases for home use ?

rfaelens commented 3 years ago

If the S1 receiver code is not shared, I guess this is intentional.

You can build a small Python script to get the hex data from the S1 port. It should be trivial to parse the 45-byte telegrams into something useable. Unfortunately, it is difficult to find an USB-RS485 transciever capable of 2Mbps baud rate.

Code posted below if you want to try:

import serial
from serial import Serial

#• 1 start bit
#• 8 data bits
#• No parity bit
#• 1 stop bit

#
#52 samples per 50Hz cycle.
#Sampling rate = 2600 Hz.
#Telegram = 45 bytes of info
#communication uses 8N1 = 1 start bit + 8 (info) bits + 1 stop bit = 10 bits / f                                                                                                                                                      ield
#telegram = 45 byte x 10 bits = 450 bits
#Bitrate (fixed) = 2Mbps
#1 bit = 1 / 2Mbps = 0.5 us
#telegram = 450 x 0.5us = 225 us.
#Telegram - rate:
#    Fsampling = 2600 Hz
#    1 telagram each 1/2600Hz = 384 us
#Telegram message definition (see all details pag 10 - 16)

ser = Serial('/dev/ttyUSB1', bytesize=serial.EIGHTBITS, stopbits=serial.STOPBITS_ONE, parity=serial.PARITY_NONE, baudrate=2*1000*1000, timeout=120)
msg = bytearray()
while True:
    print( "--" )
    print( ser.read(45).hex() )