DIY: SDM630 Smart Meter Interface

@sirLeone I’ve got it working in the meantime. The only thing I still haven’t figured out is how to get reading of Total power in OH.
Regarding your issue: have you tried the latest release (0.5.1)?

Yes, i have started from updating to latest release but with no luck :confused: I will try to read and compute values using python script

Is there a way to read out the modbus with an esp8266 or arduino and send the data with wifi to the openhab-server or the raspi running the software from the first post?

I have seen some tutorials where you can build a modbus slave with an esp8266. Would this be the right thing to do this?


Or another Idea:

On amazon you can find this: USR-TCP232-410S

Can i use your software with this lan-adapter? Can i read out a sdm630 connected to this and my raspi is only reachable over lan?

1 Like

You can hook an esp8266 with a modbus adapter to the energy meter. I especially use Sonoff’s with Tasmota firmware. In the latest versions it supports all Eastron meters and also some Peacefair energy meters.

If there are more Tasmota(MQTT)/Eastron users out there maybe we should start a new topic and leave this one only for Raspberry/Eastron use cases (the RS485 adapter placed on the Raspberry itself).

2 Likes

Interesting. I am looking for alternatives for Power Metering. My electrical box setup is triphasic, I was thinking to buy the SDM630, but I do not know how to setup the RS485.

You are talking about sonoff with Tasmota. Is it possible to link the a sonoff with Tasmota to the SDM630 send data via MQTT? How is the wiring? and how you modify the firwamre?

I am Tasmota(MQTT) user and I am thinking to buy a SDM630, I am interested on this topic, but I need to make up my mind about how is everthing setup.

check these out


this is the RS485 module you must use.

this is connected between the sonoff and the Eastron meter.

check also

the basic idea is that the sonoff/Tasmota takes the readings through RS485 and then transmitts MQTT status messages.

Cool that is what I was looking for. I will have a look. Next January will arrive my Eastorn an I will start to test it.

I guess that with Sonoff Basic the conection is the same. But I do not know how is the setup when you get in in the local IP of the sonoff. How to setup sonoff basic?

here is some resource:

The Tasmota module configuration is the easiest part. It has pin configuration options for Tx/Rx on SDM120/SDM220 (single phase meters) and seperate pin options for SDM630/SDM530 (these are the 3-phase models and display more registers).

ie, this is the pin configuration for SDM120

1 Like

Hi thanks.

Today I got my SDM630. I have flashed a sonoff Basic, and I set it up like this, but I do not see any values on the main page of Sonoff-. What do I miss?

I do not find on the menu, SDM630 Rx and SDM630 Tx.

47

Thanks.

Problem solved.

The library SDM630 was commented with // as a comment.

Everything working fine.

Or you can download the ‘sensors’ Tasmota release which has it ready to play.

  • sonoff-sensors.bin = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors.

2 qustions ngalfas:

  • The TotalEnergy is possible to reset to 0? :confused:
  • How I get the ActivePower. It seems that is a String?
{"Time":"2019-01-28T14:07:08","ENERGY":{"Total":11.118,"ActivePower":[86,13,19],"ReactivePower":[-22,-25,-9],"Factor":[0.97,0.45,0.91],"Voltage":[231,229,230],"Current":[0.420,0.158,0.190]}}

just saw this…

I think there is a way to reset TotalEnergy on the SDM itself. i don’t have the manual right now…
the best way to use it is to set a database persistence and store your daily metering.
you will see that the SDM’s TotalEnergy has little use, you can do this from your data.

For your second question. This string is JSON data. You need to setup the things and items scheme for OpenHab to parse the data.
Luckily, i have my setup for both MQTTv1 and MQTTv2 bindings so here it is.

For MQTTv1 binding (“mosquitto” is the broker service name)

Number:Power 				SDM530_W1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.ActivePower.[0])]" }
Number:Power 				SDM530_W2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.ActivePower.[1])]" }
Number:Power 				SDM530_W3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.ActivePower.[2])]" }
Number:ElectricPotential	SDM530_V1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Voltage.[0])]" }
Number:ElectricPotential	SDM530_V2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Voltage.[1])]" }
Number:ElectricPotential	SDM530_V3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Voltage.[2])]" }
Number:ElectricCurrent 		SDM530_A1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Current.[0])]" }
Number:ElectricCurrent 		SDM530_A2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Current.[1])]" }
Number:ElectricCurrent 		SDM530_A3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Current.[2])]" }
Number  					SDM530_F1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Factor.[0])]" }
Number  					SDM530_F2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Factor.[1])]" }
Number  					SDM530_F3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Factor.[2])]" }
Number:Energy 				SDM530_Energy 	{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Total)]" }

For the newer MQTTv2 binding you have the two seperate files:

.things MQTTv2 file

Thing mqtt:topic:SDM530 (mqtt:broker:mosquitto) {
  Channels:
	Type number : power1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ActivePower.[0]" ]
	Type number : power2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ActivePower.[1]" ]
	Type number : power3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ActivePower.[2]" ]
	Type number : voltage1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage.[0]" ]
	Type number : voltage2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage.[1]" ]
	Type number : voltage3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage.[2]" ]
	Type number : current1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current.[0]" ]
	Type number : current2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current.[1]" ]
	Type number : current3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current.[2]" ]
	Type number : factor1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor.[0]" ]
	Type number : factor2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor.[1]" ]
	Type number : factor3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor.[2]" ]
	Type number : totalenergy	[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total" ]	
}

.items MQTTv2 file

Number:Power 				SDM530_W1 		{ channel="mqtt:topic:SDM530:power1" }
Number:Power 				SDM530_W2 		{ channel="mqtt:topic:SDM530:power2" }
Number:Power 				SDM530_W3 		{ channel="mqtt:topic:SDM530:power3" }
Number:ElectricPotential	SDM530_V1		{ channel="mqtt:topic:SDM530:voltage1" }
Number:ElectricPotential	SDM530_V2		{ channel="mqtt:topic:SDM530:voltage2" }
Number:ElectricPotential	SDM530_V3 		{ channel="mqtt:topic:SDM530:voltage3" }
Number:ElectricCurrent	 	SDM530_A1 		{ channel="mqtt:topic:SDM530:current1" }
Number:ElectricCurrent 		SDM530_A2 		{ channel="mqtt:topic:SDM530:current2" }
Number:ElectricCurrent	 	SDM530_A3 		{ channel="mqtt:topic:SDM530:current3" }
Number  					SDM530_F1		{ channel="mqtt:topic:SDM530:factor1" }
Number  					SDM530_F2 		{ channel="mqtt:topic:SDM530:factor2" }
Number  					SDM530_F3 		{ channel="mqtt:topic:SDM530:factor3" }
Number:Energy 				SDM530_Energy 	{ channel="mqtt:topic:SDM530:totalenergy" }

as you can see, i also have all the UoM set for ease of use on calculations etc.

Anybody has connected 2 powermeter on 1 modbus?

I have a sdm120 and sdm630. My sdm630 is working already with esp8266 and tasmota - sending all data to openhab.

But how can i connect a second powermeter? Which files on tasmota do i have to edit? Can i do that on my running system on the console of the esp8266 or do i have to reflash?

The whole point of Modbus-RTU is that hundreds of devices can be connected to the same bus, in daisy-chain fashion.
You do have to be careful about following the wiring rules - twisted pair, termination resistors.
Each device must be assigned a unique ID number, that’s a device setup question.

Obviously whatever is polling the devices for data now needs to poll two, and maintain a picture of registers it is reading. Which might not be the same for two different target devices.

To me this sounds like I would link the bus to openHAB and have that do the hard work directly via modbus binding. An ethernet or WiFi gateway could be used if you can’t run a physical cable.

Hi, i used the mqtt binding and a esp8266 with the solution provided in this thread. Bu now it ist not working anymore…

I have a debian server with usb to connect to the modbus. Which cable do i need to buy for reading out my modbus powermeter sdm630?

Is a ftdi usb-rs485 converter the right thing?

Do i need additional resistors like with my diy eps8266 solution or is this already included in these converters?

In this thread there is written, i need a rs485 adapter for the esp8266 with flow control? Is this also a must have for the usb-rs485 adapter?

Is it possible to have something like a slow and a fast polling of the modbus for the SDM630.
Fast polling would be every 2s and slow polling 60 minutes. I think usually it is just not required to get the values very fast and if you need it you could enable it.

I’m thinking about using the REFRESH command. So I would make something like two cron rules. One for 2s another one every 60 minute and call the REFRESH command inside.
Does anybody know if this would work out? Thanks!

Could you confirm what you are talking about? There are a bunch of different solutions mentioned in this thread - Tasmota, MQTT, python, openHAB binding

In general you can disable the modbus polling with refresh=0, then you can do it manually: