Modbus RTU Drexel & Weiss <> openHAB

Hello Everyone!
i would like to implement my Drexel & Weiss heating installation (?) in my openHAB installation.
They’ve got a Modbus Adapter and i also got a huge pdf with tons of parameters for the Modbus RTU.

How can i implement these things now into openHAB? i’m running OH on a Raspberry, and that’s it…
I would be happy to get some input because atm i have absolutely no idea =)

Greetings!

Have a look at other threads featuring Modbus.

As your heating system provides a serial (RTU) interface, you’ll need to sort out a physical interface for your Raspberry. Probably a USB RS485 adaptor and some twisted pair wire.

You will need to add the Modbus binding to Openhab. For serial work, strongly recommend version 1.9 (or 1.10) even if you are running OH2.

That will need config parameters set by you to tell it about the serial interface and heating system. See the bindings docs.

Then you create OH Items to suit the parts of your heatings ‘Modbus Map’ that you are interested in. Start small, just read one temperature or suchlike.

Then you can Rules to control it, Sitemaps to display it, etc.

Thanks for the information!
The Drexel & Weiss Adapter is a RS232 Adapter, so i should probably get a USB RS232 Adapter, right?
Is there any way to make this wireless? Raspberry and heating system are not in the same room :frowning:

Wired is simpler to get working. RS232 is limited cable length, 5m or so with good screened cable. You could get a couple more metres by putting the USB/RS232 dongle on a USB extension lead.

You can do RS232 over wireless using two serial/WiFi gateway adaptors, paired to each other. This kind of thing -


There are several types of these available.
Obviously you need WiFi coverage.

Or, one of the same device is capable of converting Modbus-TCP (carried over ethernet/Wifi from your Raspberry and home network) into Modbus-RTU at the heating system.
Not all gateway types can do this.
Assuming your Raspberry is already wired/WiFi into a home network, this is probably simplest.

oh boy =)
let me begin with your last phrase! the raspberry is wired into home network and there is wifi-coverage at the heating system.
so which solutions would probably simplest? simple is very important, because as you can see i’m struggleing already!

Simplest is wired RS232 as I said, but I guess you want wireless?

The serial/WiFi gateway with Modbus capability. From Openhab, you use the heating controller as though it were Modbus-TCP. The gateway translates to Modbus-RTU for the heating. You need a gateway with WiFi, RS232, and Modbus.

It will need setting up of course, refer to manufacturers instructions for whichever one you choose.
For example you will need to find out about fixed IP address for the gateway (so that openhab knows where to find it). You can give the gateway a fixed IP, or you can tell your Router’s DHCP to always assign the gateway the same IP.
The gateway will also need to know the parameters (baud etc.) for the serial side.

You’ve got a lot to read upon - Openhab install 1.X binding, Modbus binding configuration, gateway TCP/IP setup, your networks addressing and router, gateway serial setup, heating serial setup. There will be quite a bit to all this, but you only have to do it once.

yes, simplest with wifi!
the USR-WIFI232-602 is a gateway with wifi, rs232 and modbus, right?
network parameters shouldn’t be a problem, i have also a tecnical sheet for serial parameters.

but i’ll probably have some (a lot?) of trouble configuring the modbus part on the gateway and with bindings.
if you tell me you’ll be by my side i’ll give the USR-WIFI232-602 a chance =)

narf!

Yes, manual section 5.2.4 shows the Modbus-TCP<>Modbus-RTU mode you want use, and it has a physical RS232 interface.

Hi there!
I got the gateway and was able to get it in my existing network.
But what should the “Network A Setting” look like?

And what should the Modbus binding conf in OH2 look like?

Greetings,
Peter

I don’t have one, mine are wired. Look under Mode for Modbus TCP<>RTU

You have a decision to make about how to give the gateway a fixed IP address, or have your router do it.

I don’t use OH2
I think you need to set legacy mode or something in OH2
You need to install Modbus binding add-on 1.9
You need to set up a slave in a file modbus.cfg
Then you add some {modbus:xxxx} configuration to your Items

there’s no Modbus-TCP<>Modbus-RTU mode :rage:
i don’t really get how i should configure this gateway.

maybe i’ll just move my raspberry/openhab to the heating device.
how would i connect the raspberry with that option?

hmm, bad feeling here. The product I originally pointed to was model 630. What did you get, a model 602? I do not think that supports Modbus. Messed up between us I think.

All is not lost. If you were running a Windows host, manufacturer USR provide a virtual serial port driver to link to a remote USR 602 so that it looks like a local COM serial port. You’d set that VCOM up, then setup Openhab as though it were using an RTU serial port, hiding all the TCP/WiiFi stuff.

However, i have absolutely no idea if/how you can set up virtual serial port from a Raspberry. You could ask the manufacturer? Or ask in Raspberry forums?

i’m not running a windows host, so the 602 will not help :frowning:
setting up a virtual serial port would be even more complicated as it is.

i’ll look for a wired solution heating control <> raspberry. no ideas on this?

[quote=“rossko57, post:4, topic:22379”] RS232 is limited cable length, 5m or so with good screened cable. You could get a couple more metres by putting the USB/RS232 dongle on a USB extension lead.
[/quote]

As an alternative for range, you could fit an RS232/RS485 adapter at the heating end (these are cheap dumb devices), and use a USB/RS485 at the Raspberry (these are cheap devices requiring a little setup and/or drivers on the host, same as any USB/serial)
The RS485 physical link can use cheap Cat5 cable and be up to a km long. Might be more convenient than moving the Raspberry to the woodshed or whatever.

moving the raspi is no big deal.
i can connect via wifi there, it’s almost in the same room…
but would i connect? just put on of these things on it?

I do not have a Pi and do not know what you would use to connect any particular Pi model to RS232. I can’t imagine it’s very demanding or unusual though.

ordered a rs232 shield for the raspi.
i’ll keep you posted!

Alright!
Got my serial pi plus and installed it according to this: https://www.abelectronics.co.uk/kb/article/1035/raspberry-pi-3-and-zero-w-serial-port-usage

i activated the 1.9 Modbus Binding in OH2 and now i’m wondering what to do next…
first (and only) thing i did with the Modbus Binding was setting:

#       (slave name)      (host or IP)
#       |                 |          (baud)
#       |                 |          |     (dataBits)
#       |                 |          |     | (parity)
#       |                 |          |     | |    (stopBits)
#       |                 |          |     | |    | (encoding)
#       |                 |          |     | |    | |   (interTransactionDelayMillis)
#       |                 |          |     | |    | |   |  (receiveTimeoutMillis)
#       |                 |          |     | |    | |   |  |    (flowControlIn)
#       |                 |          |     | |    | |   |  |    |    (flowControlOut)
#       |                 |          |     | |    | |   |  |    |    |
#       |                 |          |     | |    | |   |  |    |    |
#serial.slave1.connection=/dev/ttyS0:38400:8:none:1:rtu:35:1500:none:none
serial.slave1.connection/dev/tty1:9600:8:none:1:rtu:35:1500:none:none

host according to the tutorial ob abelectronics
baud, databits, parity, stopbits according to manufacturer manual
rtu because it’s called “Modbus RTU”

interTransactionDelayMillis, receiveTimeoutMillis, flowControlIn, flowControlOut like example?

what’s net next step?
how can i test the setup?

there’s tons of information in manual and in a “parameters” file (german)

http://gasserenergy.ch/wp-content/uploads/2015/09/900.6660_01_TI_Modbus_RTU_DE.pdf
http://filter.drexel-weiss.at/HP/Upload/Dateien/900.6667_00_TI_Modbus_Parameter_V4.01_DE.pdf

Start simple
You need to cable Pi wires TX to heating RX, Pi RX to heating TX, Pi 0v to heating 0v

I think I see in the docs that the heating responds to Modbus commands x04 (FC4 read input reg) and x10 (FC16 write multiple regs) - so will need to set writemultipleregisters = true for later, if you are going to alter settings in the heater

You’ll need to complete your modus.cfg set up for slave1
You need to find the Modbus slave ID for your heater, still at default perhaps.
Choose a simple register to read, register 202 looks promising - air temperature is that?
Find out the format of that register - I guess it might be 32-bit signed
All that should allow you to set id, start, length, type parameters

When slave1 is configured in modbus.cfg, you can set up an Item in your .items file to hold the data.
It’ll need to be a Number type, and you configure it in the curly bracket {} to look at the first register you defined for slave1

rpi - heating is wired like you mentioned (0v =gnd?)

ID for my heater is 2.
Register 202 is air temperature!
now - how do i found out the format of that register? as i understand parameter goes from -28000 to 10000 with a divisor of 100, 1 comma and unit °C.

On page 10/16 of the first pdf there is an example of how to make a request (“Register lesen”) for register 1184.
On page 13/16 it says that all values are “signed int” and there’s also an explanation of how to convert the register 202 value: Register 202 --> Wert (value) 22500 / 100 = 225 --> Darstellung mit 1 Kommastelle = 22,5 °C

could you please explain / show me how i could set the parameters in modbus.cfg?
this is all to new for me :confused: