DIY: SDM630 Smart Meter Interface

smartmeter
diy
modbus
Tags: #<Tag:0x00007f014b3b5558> #<Tag:0x00007f014b3b53c8> #<Tag:0x00007f014b3b5238>

(Mathias Dalheimer) #1

When I moved into my new appartment wanted to record my power usage. I managed to install a rather cheap three-phase power meter into the distribution box:

This is an EASTRON SDM630-Modbus (German distributor). It is a three-phase power meter that allows you to query voltages, currents, power, power factor, thd etc. over a Modbus RTU connection. You can buy these in Germany for about 90 Euro - make sure to get the Modbus version, there are other versions around!

I wrote a simple Modbus-to-JSON-Adapter in Go. Now I have the most relevant values exported into my OpenHAB installation:

The “Strombezug” graph shows the power on three different phases. My software, along with hardware and software documentation, is available on github:

github.com/gonium/gosdm630

Let me know what you think.

-Mathias


How to get data from a C Programm to OpenHAB?
(seppdog) #2

Hi!

I have the same powermeter but I read the data directly via jython through the digitus USB-RS485 converter.
This powermeter is realy cool.
I also use it for my “house standby” function:
When between 9 pm and 7 am all Lights, Cinema, Squeezeboxes are off AND the power consumption is below 200W, the house goes into standby (switch off internet, Wifi, cooking plate,…)
When the power consumption goes above 500W (microwave in the morning) or something is switched on, the house goes back to normal mode.

Also I see you have a refrigerator on the Phase L1 !? :wink:

kind regards
Martin


(Mathias Dalheimer) #3

Hi,

you’re right. It is not an efficient model :wink: You can also see the circulation pump of my heating system on L1 and my water kettle. Since I consider this data to be rather private in nature I want to be in full control over it. An internet-connected smart meter (i.e. Yello Strom or something similar) would not be my thing…

-Mathias


(Michael Andresen) #4

Pretty cool meter! I was thinking about making my own, but with the price of this, and all the calibration and such done, it is just not worth making your own. :smiley: All I then need to do, is to make a wifi bridge to relay the readings from the meter, over mqtt, to openhab. :smiley:


(Hallo Ween) #5

@gonium
I want to buy the same power meter for my new house to get a cheap smart meter with real time power consumtion on openhab.

But i don´t know much (better say nothing) about compiling software for raspi or something like this.

Is there an easy way to get your software to a raspi (or another linux mini computer like this - i use an odroid u3 as openhab server - maybe there it will work to?)?

Can i get real time power consumption? I want to see changing the power when putting a smartphone-power-cord in for example.

@seppdog
Maybe your way is easier for me? Can you explain me how to get the data to openhab with your installation?

@Mikey
How about your way to get the data from the power meter? Can you explain a little bit more?


(Andrew) #6

I have an SDM120 (single-phase) recently integrated with OpenHUB using Modbus RTU.


(Hallo Ween) #7

@AndrewZ
Can you tell me how you can exactly read out your power meter? Modbus-USB-Converter? And what do you need to bring the data to openhab?


(Andrew) #8

Yes, at the moment I’m using USB-to-RS485 Converter like this one:
http://www.aliexpress.com/item/USB-to-RS485-TTL-Serial-Converter-Adapter-FTDI-interface-FT232RL-75176-Module-Ne/32285139690.html
Modbus binding is used in OH, information from the meter is obtained by reading input registers.

Meter reports the following information in separate registers :
Voltage, Current, Active power, Apparent power, Reactive power, Power factor, Frequency, Import active energy, Export active energy, Total active energy.


(Hallo Ween) #9

But how can i read out the registers, so that openhab binding could read it? If i only put the usb-converter to the raspi this would not be enough - i need another software on raspi which is reading out the power meter?

Or can i directly read out the power meter with openhab binding?

Which update time is available? Can i use 1 second - so i have nearly real-time rate?


(Andrew) #10

Yes, you can. No additional software required.
Frequency of polling Modbus slaves can be configured, this is optional and default is 200 milliseconds.


(Hallo Ween) #11

I think sdm630 only gives new data every second. If you set higher frequency, it will give the same value until like before. This was written in another forum.

And it´s is realy simple like this? Only connecting usb-rs485-converter with power meter and raspi and it is working out of the box?

(ok, looking which name the usb device got from raspi and then change the openhab-config-file…)


(Hallo Ween) #12

I saw the rs485 to usb converter from the link in first post, it has 4 pins to connect to the power meter.

Will this rs485-usb-converter work as well? It only has 2 pins:


http://de.aliexpress.com/item/Free-Shipping-USB-to-RS485-485-Converter-Adapter-Support-Win7-XP-Vista-Linux-Mac-OS-WinCE5/1817797099.html?ws_ab_test=searchweb201556_0,searchweb201602_3_10017_10005_10006_10034_10021_507_10022_10020_10018_10019,searchweb201603_8&btsid=ee7ac457-aa5d-4a0c-9521-4f227b13e547


(Hallo Ween) #13

@AndrewZ
Which rs485-usb-converter do you use?

Is the cheap one with only two pins working as well? Cheap one is under 1$/1€ - digitus expensive one is about 13€.


(Andrew) #14

Please see the link in my earlier message.


(Daniel Walters) #15

It doesn’t work.


(Hallo Ween) #16

@AndrewZ
Do you use any additional resistors like explained in the first post?

Or is it working with only the usb-converter without additional resistors?


(Andrew) #17

@halloween
No resistors, just a pair of wires between converter and meter.


(Sir Leone) #18

Hi,
I have followed instructions provided by Mathias and communication seems to work, but after some time(2- 25 minutes) it seems that it lost connection with energy meter and process stops. I don’t have idea where should i start to look for source of the problem. Is there any need to configure energy meter to work with script from Mathias ?
My SDM630 is connected via popular USBtoRS485 dongle from ali, i used pair of cable (about 3m length) without resistors. Each time when process stops, i can start it and connection is performed correctly, data from energy meter is shown.
Here is info from my console :

root@Santiago:~/gosdm630# ./bin/sdm630_httpd -d /dev/ttyUSB0 -u 192.168.2.100:90
2016/05/10 11:28:32 Starting API httpd.
2016/05/10 11:53:36 Closing broken handler, reconnecting attempt 0
2016/05/10 11:53:37 Closing broken handler, reconnecting attempt 1
2016/05/10 11:53:38 Closing broken handler, reconnecting attempt 2
2016/05/10 11:53:39 Cannot query the sensor, reached maximum retry count.
root@Santiago:~/gosdm630#


(Mathias Dalheimer) #19

I’d recommend that you install the resistors - I was observing a similar behavior without them. Don’t forget the resistor at the SDM630 pins!

-Mathias


(Sir Leone) #20

Thank for your reply :slight_smile: i will check as soon as i get 120ohm value resistors.