question

thomasw-1 avatar image

Eastron SDM630/SDM230 Modbus Energy Meter - community edition

======================================================================

Update history

version 1.2

  • Support of legacy meter SDM630v1
    meter is only supported, if configured with baudrate >= 9600

version 1.1:

  • Support of SDM230
    (limited support - requires manual adaptation since device id is not supported on that device type - details see below)
    Thanks to Sergio for allowing access to his environment
  • Addition of supported product ID > shown properly in VRM

======================================================================

Hi All,

I like to share an implementation for support of the Eastron SDM630-Modbus and SDM230-Modbus v2 energy meters.
For any usage a donation to seashepherd.org with an amount of 5 USD/EUR/GBP or equivalent is expected.

Installation

  • copy Eastron SDM meters v1.2.zip -file into directory /opt/victronenergy/dbus-modbus-client and unzip it.
  • Add following bold-marked line into file /opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py
    import carlo_gavazzi
    import Eastron_SDM630v2 (in case you use another meter version apply alternatively expression "Eastron_SDM230" or "Eastron_SDM630v1" instead of "Eastron_SDM630v2 ")
    import ev_charger
    import smappee
  • rename file /opt/victronenergy/dbus-modbus-client/dbus-modbus-client.pyc into /opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py.orig
  • Since that file is not automatically compiled by VenusOS execute following bold marked commands in directory /opt/victronenergy/dbus-modbus-client
    python
    Python 2.7.18 (default, Apr 15 2021, 10:46:30)
    [GCC 9.2.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import py_compile
    >>> py_compile.compile ('dbus-modbus-client.py')
    >>> exit()
  • reboot VenusOS

  • SDM230 specific:
    Since SDM230 does not support device id, the device must be identified by serial id.
    In order to do so:
    • Read serial ID with holding register FC00 (unsigned int32) from SDM device
      result e.g. 20084317 (using a tool like e.g. modbus poll, iobroker or node red)
    • convert id into hex: 20084317 >> 0132 765D
    • take first 2 hex-bytes (0132) and convert it back into int (here 306)
    • configure that number in file Eastron_SDM230.py
      1627119618938.png
    • in case you use more meters in parallel multiply setting like in this exampe ID "84".

  • Go to "Settings" > "Modbus TCP devices" and perform a "Scan for Devices" or directy add a device via "Devices" > "Add" using relevant IP and ModBus ID and port. Last option is much quicker and also supports non-default unit-IDs.
    A few seconds later the meter should appear in your main menu:
    1618745796225.png
  • Select in submenu "Setup" the usage as grid, pvinverter or generator meter
    1618745887195.png

Main page screenshot

1618745382616.png

Device screenshot1618745459392.png
Comments:

  • Firmware register is not filled by devices (so no modul issue).
  • In above screenshots don't be misled by empty phases 2 and 3. In test environment I had only phase 1 connected. Phase config is dependent of device configuration.
    As soon as meter is configured with 1 phase support only, driver detects circumstance and excludes remaining phases.
    1618748013891.png

Important: The installation is not resistent for VenusOS updates. After an update to another release installation has to be repeated.

Exclusion of liability: Although the module has been tested in depth, I don't take any liabilty for any potential damage on your installation

Thanks to Victron for their open platform and especially for the support of Matthijs Vader.

Energy MeterModbus TCP
4 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Hi nice! One thing, I dont think its necessary to compile any file. Just replacing/modifying any .py file will automatically cause its pyc equivalent to be removed/replaxed by a freshly recompiled one. Thats just within Python to do that.

thomasw-1 avatar image

thomasw-1 beantwortet · vor 2 Sekunden


Indeed, all other modules get recompiled automatically, that however not. I am not a python expert. Therefore I habe no clue why not. Only difference to other files are the access rights.

1618763696628.png

1618763696628.png (5.3 KiB)

Hi @ThomasW.

Thanks for sharing your work.

I have the same job to do, however, for a KS-3000 meter.

Could you tell me from where you got this value:

productid = 0xB023 # id assigned by Victron Support

Is it a Victron default value? Should I use the same value for a different meter?


Would the id on my meter be 242?

id-slave-li.jpgimagem1.png

captura-de-tela-2021-09-13-203949.png


I changed the addresses for voltage, current, etc.

imagem2.png

captura-de-tela-2021-09-13-204123.png


But I didn't find in the manual, information about phase config, hardware. The firmware is bundled with the id, and I have no idea how to separate them.


But at first I need the Venus GX to recognize the KS-3000.

Hi @stanhausc ,

the ID was assigned by Victron-Support. In case you publish your meter as well, you could raise a request for that. In the moment the id would not prevent your adaptation to work. Only in VRM another meter type would be shown.

In terms of meter identification you would have to study the supplier documentation, if there is a register that describes the meter type and makes id unique. A serial number is worst case, because it has to be changed for any individual implementation.
With my limited Spanish skills I reviewed briefly the documentation, however I could not identify a relevant register.

8 Answers
albertslund avatar image
albertslund answered ·

Hi im looking into using the sdm630 with a multiplus ii.

One thing i dont get, The SDM630 is modbus RTU(Serial), how can i then select the ip on the multiplus ?

Do i need rs485 to tcpmodule ?

In essense im actually trying to split the sdm630 between a multiplus and a hybrid inverter. The last is working, there is a rj45 cable going to it, and it does have an rj45 (rs485) secondary port. I assume it may be used for daisy chaining, but if so then where do i put the rj45 from hybrid inverter. I have a colorgx, is exposes several ports, ehternet, canbus and vebus + usb (host).

SDM630 offers two mounting points and i have the secondary "working" when using an rs485 to serial converter and a laptop. (i see some sort of organised data trafic on the port).

i thought i could add the (chinese) rs485 to the usb(host) on the color gx, but i cant get it to react on it nor find it anywhere in the colorgx.

Any advice ?

7 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Hi @Albertslund ,

yes, you require necessarily a modbus to TCP converter in order to communicate with the SDM630 device.

Hi Thomas,

I am having issues connecting the SDM630 to Venus OS running on a Raspberry via a Waveshare RS485 to Ethernet converter. While the Waveshare converter is telling me that it's connected to Venus OS (as a TCP Client), the meter does not appear in Venos OS. See attached my configuration. I'm trying to read data from the SDM630 that has ID 2 on the modbus network. Any Ideas?screenshot-2021-07-13-at-064902.pngscreenshot-2021-07-13-at-064203.png

screenshot-2021-07-13-at-065127.png

screenshot-2021-07-13-at-065136.png

Hi @Stoeff99 ,

could you please check following configs:

  • did you configure the same baud rate (9600) on the meter?
    It's mandatory that you have same config on meter and converter! For quicker replies I would recommend a baud rate 38400, however this is not mandatory.
  • in my setup I must configure the interface as TCP server and not as a TCP client. I assume that it should be also the case for you.
    1626167516882.png

Could you please check, if with modbus poll tool you get valid responses on following reqisters?
For register documentation please refer to that document.
I attached also a config file that you can use for the first query:

1626165798416.png

1626165816304.png


1626165798416.png (1.8 KiB)
1626165816304.png (8.9 KiB)
1626167516882.png (26.1 KiB)
apoll1.zip (337 B)

It's odd, I can access one SDM630, but the other one does not appear. I'm assuming a daisy chain issue, which I need to fix first, since I keep receiving "not connected". The power is only shown shortly and drops off again to "not connected" (see below).

screenshot-2021-07-13-at-173852.png

@Stoeff99 ,

Please check following items:

  • each meter has a different modbus id
  • in case your bus is longer than 1m, it should be closed by an resistor
  • your converter is set up as a modbus server

In addition I strongly recommend to use iobroker (with activated modbus adapter) or "modbus poll" checking proper connectivity and communication with meters.

@Stoeff99 ,

any progress with your issues?
Would be of course be interested that it work also for you.

Hi Thomas,

Yes I have managed to get the communication going. I however have an issue with the daisy chain set up of the 4 modbus slaves that I can't really change. As a result the Venus OS keeps loosing the connection with the two SDM630... Funny enough my Loxone modbus extension, does not have that problem... Any thoughts as to why that may be?

In a couple of weeks we'll get a new electrical distribution board where all 4 modbus slaves will be near to each other and I'll be able to set them up nicely in series. Right now I've had to set it up in a start typology, which of course is really not good. B

seriusrod avatar image
seriusrod answered ·

Thanks @ThomasW. for sharing.
I have two sdm230 in my installation, that it's the same device, but for single phase. I'm trying to implement your mod without success, and I don't know if it's something with the converter (a protoss pw21) or the fact that it's a different model device.
Should it work anyways?

4 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Hi @seriusrod ,

The module reads the device typ and does only create an instance in VenusOS, if identified as SDM630.
The support of a SDM230 should be quite analogue (assuming same modbus addresses), however certain tests would be required before. I could spend some time in adapting the adapter, however I would require device access for a limited time. Are you familiar and willing to configure a VPN access?


Hi @ThomasW.

That would be nice. I would be glad to chat with you about it.

I have two sdm wired to a protoss pw21, all currently integrated with node-red. I'm software architect, perhaps i could grab and send you the product id for the 230.

Hi @seriusrod ,

Please leave a phone number or email address, where we can speek.


I've emailed you.
koche avatar image
koche answered ·
Hello @ThomasW.


Good work

Unfortunately it dosn´t work for me yet, but unfortunately I don`t know where the problem is either because I don`t my way around that well, maybe you can help me

I have the following configuration:

VenusOS on pi

EM24-Ethernet>>> EVU

SDM630 >>> PV inverter

SDM630 modbus >> USR-TCP232-410S

I only get the connection to the EM24 which is found (192.168.178.122) EM24 and unfortunately not to the SDM630. How can I isolate the error?


2021-09-09-09-49-19-20210907-181334jpg-fotos.png


2021-09-09-09-40-44.png

2021-09-09-09-53-36-192168178149-putty.png


2021-09-09-09-50-17-teslaakku-vrm-portal.png


2021-09-09-09-54-20-verfassen-kein-betreff-thunder.png



6 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Hi @Koche ,

Currently I am quite busy. But on Sunday we could have a phone call.
Would you have some time?
Cheers,
Thomas

hello @ThomasW.

sorry i have only read it now. I would like to talk to you on the phone but my english is not good. can you maybe german?

@Koche,

Could you please post, what result ModbusPoll returns for registers FC00 (unsigned int32 BE) and FC02 (hex)?

Thanks
Thomas

Hi @Koche ,

Please call me on the number that I show below. I will delete the number tomorrow evening again. German is no issue.
I think we can islolate your issue much quicker by having a brief teamviewer session.

Hi @Koche ,
I uploaded an enhanced version, which should support your SDM630v1 meter.
Please test and call me for feedback.

koche avatar image
koche answered ·

@ThomasW.

unfortunately I still have no success Question can it be due to the version of the SDM630? I have version1?

1 comment
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Hi @Koche ,

Please see thread above.

Anselm Karl avatar image
Anselm Karl answered ·

Thanks a lot!

I got a SDM630 and a SDM230 working. I did everthing as above. I am using a raspi with two seperate RS485 to USB converters and mbusd ( https://github.com/3cky/mbusd.git) as a rtu to tcp converter. SDM630 is on port 503 / sdm230 on 503. I had to read the serial # of the sdm230 as described above. Also baud rate of the sdm230 defaults to 2400 (mbusd setting!).

2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

yvl avatar image
yvl answered ·

Hello,


i tust try to add a SD230Modbus (no V2 ??) but i have no success.



The SDM630 is already in System and working very well, just use a Modbus TCP Converter (USR-W630) for the SDM630.


The SDM230 should be used as PV-Inverter Meter, it is also connected with a Modbus TCP Converter (USR-W610, same settings, Modbus Poll is working, and also Eastron Device Config)


The device appears … and goes away … and so on …



Any succession for me ?


2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

yvl avatar image
yvl answered ·

gerte-liste2.png

gerte-liste3.png


gerte-liste1.png

SDM630:


bildschirmfoto-2021-10-10-um-134535.png


Serial Number of SDM230:

produktkennung.png


now i fond the error in /var/log/dbus-modbus-client/current:

1633850444133.png

but have no idea what to do ... hmmm


4 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Hi @yvl ,

Could you please check, if your version responds on following registers reasonable results?

Holding Registers:

  • 0xfc02
  • 0xfc03
  • 0xfc00

Input Registers:

  • 0x0000
  • 0x0006
  • 0x000c
  • 0x0046
  • 0x0048
  • 0x004a

Apropos you remove 4 pictures from your previous post. Can you please add them again?

Hello Thomas,


thank you for response ... today ..

Input Register:

1633864140043.png

Holding Register:

Register:

1633864322565.png


1633864426272.png

with this tool i was able to read all:

1633864577528.png

It is a Test environment without high load on the SDM230:

1633864712006.jpeg


1633864140043.png (681.4 KiB)
1633864322565.png (114.3 KiB)
1633864426272.png (582.1 KiB)
1633864577528.png (668.4 KiB)
1633864712006.jpeg (3.5 MiB)

Hello,


Errors from /var/log/dbus-modbus-client/current


@400000006162cee823788b24 INFO Found SDM230Modbus at tcp:192.168.44.224:8899:1

@400000006162cee8303ea794 INFO registered ourselves on D-Bus as com.victronenergy.grid.cg_20153630

@400000006162cee91190e514 ERROR Unable to decode response Modbus Error: Unknown response 0

@400000006162cee915df3864 ERROR Unable to decode response Modbus Error: Unknown response 0

@400000006162cee91ad4e774 ERROR Unable to decode response Modbus Error: Unknown response 0

@400000006162cee91aebf1e4 ERROR Error reading registers 0x00-0x0d: Modbus Error: [Input/Output] Modbus Error: [Input/Output] Unable to decode request

@400000006162cee92a0462c4 ERROR Error reading registers 0x46-0x4b: Modbus Error: [Input/Output] No Response received from the remote unit

@400000006162cee938f9e63c ERROR Error reading registers 0x46-0x4b: Modbus Error: [Input/Output] No Response received from the remote unit


on the remote console (MultiPlus II-GX):

for 1 second i can see this:

1633865671110.png


and for may 5-10 seconds this:

1633865724537.png


1633865671110.png (27.0 KiB)
1633865724537.png (23.5 KiB)
Hello,


i give up with the SDM230, after changing some Code to prevent reading more than 8 registers at once, it is working a little bit ... with mystic errors in log file and after a while it quits working.

I switched now to the SDM630 .. and this is working out of the Box ... without any errors in log file.

Thank you for tips and help, this brings me to the right direction ....

yvl avatar image
yvl answered ·

Hi,

i just made a test and switch the USR-W630 with the USR-W610 connected to the SDM630. and the SDM630 appears in Remote Console without doing anything ... what crazy ...

So the USR-W610 is working as expected ....

The next thing i just tested, wars the reading with Windows "Modbus Poll" don't know what this does different, but with Modbus Poll i was only able to read up to 8 register with 1 command without an error. When i try to read 10 register, i receive an error ...

Log from Communication:

>>>>>>>>>>>>>>>>>>>>

Tx:000070-15:47:43.896-00 54 00 00 00 06 01 04 00 00 00 08

Rx:000071-15:47:43.973-00 54 00 00 00 13 01 04 10 43 65 D5 00 00 00 00 00 00 00 00 00 3C AE 1D BF

Tx:000072-15:47:44.985-00 55 00 00 00 06 01 04 00 00 00 0A

Rx:000073-15:47:45.053-00 55 00 00 00 0E 01 04 14 43 65 C1 93 00 00 00 00 00 00 00

<<<<<<<<<<<<<<<<<<<

this is corresponding to the GX log file:

Error reading registers 0x00-0x0d: Modbus Error: [Input/Output] Modbus Error: [Input/Output] Unable to decode request


But how can i change the number of registers to read at once ?

(without killing the SDM630, because this is used as grid meter, an the fast reading is needed for the ESS System)..

meanwhile i made a test with the baud rate switching from 9600 to 2400 results in reading only 6 register at once (using Modbus Poll) ...

2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.