Skip to main content

DIN-Rail Configuration

The DIN-Rail Add-On extends the Gateway V4 with 2× Ethernet, Modbus RTU/ASCII (RS-485) and Modbus TCP in a DIN-rail form factor. Wired M-Bus is supported since v0.16.0.

Compatible product: Gateway V4 + DIN-Rail

Firmware variant: hw4.dinrail since v0.15.0 (up to firmware 0.14.x: hw4.edge). Device type on the Lobaro Platform: Gateway V4 Dinrail.

All interfaces disabled by default

With the default configuration the DIN-Rail gateway reads no interface since v0.16.0: modbusCmdConf and mbusAddrList are empty and cmodeDurSec is 0. Neither Modbus (RS-485 / TCP), wired M-Bus nor wireless M-Bus works and no meter data is uploaded until you configure at least one interface.


WAN Parameter​

The DIN-Rail Add-On extends the standard WAN parameter with additional values for Ethernet-based uplink:

ValueDescription
ethernet+lteEthernet as primary uplink with automatic LTE fallback (default)
ethernetEthernet as sole uplink
lteCellular uplink (NB-IoT or LTE-M)
lorawanLoRaWAN uplink
  • ethernet+lte: Ethernet is used when available. If the Ethernet connection is unavailable, the device automatically falls back to LTE.
  • ethernet: Data is sent exclusively via Ethernet. The cellular modem is not used.

The Ethernet data upload always runs via ETH2 (WAN).


Ethernet Configuration​

KeyTypeDefaultDescription
ipAddressStringdhcp;dhcpConfiguration of both Ethernet ports, see below

The DIN-Rail gateway has two Ethernet ports, ETH1 (LAN) and ETH2 (WAN). ipAddress therefore always has two entries separated by exactly one ;: the first for ETH1, the second for ETH2.

Each entry is either:

  • dhcp for automatic address assignment, or
  • ip,netmask,gateway for a static address, optionally with a DNS server as fourth field: ip,netmask,gateway,dns

Syntax:

<ETH1-config>;<ETH2-config>

Example: ETH1 static, ETH2 DHCP:

192.168.1.91,255.255.255.0,192.168.1.1;dhcp

Example: ETH1 static with DNS server, ETH2 DHCP:

192.168.1.91,255.255.255.0,192.168.1.1,192.168.1.1;dhcp

Modbus Configuration​

KeyTypeDefaultDescription
modbusCmdConfString[not set]Modbus interfaces and list of commands (see below)
modbusInternalAddressNumber250Modbus address for internal gateway sensors
addonAccumulateNumber1Readouts to accumulate before upload (1–15)
loraFormatNumber5LoRaWAN payload format: 1 = Verbose, 4 = Compact with timestamp, 5 = Compact without timestamp

modbusCmdConf covers Modbus RTU/ASCII over RS-485 and Modbus TCP over Ethernet. Both can be mixed in one parameter.

Syntax:

<interface>/<commands>;<interface>/<commands>
  • Multiple entries are separated by ;.
  • Interface and commands are separated by /. For RS-485 entries, the older separator : is still accepted. For Modbus TCP entries only / is valid, because : separates the TCP port.
  • Commands are raw Modbus requests of 12 hex characters without CRC, e.g. 010300020002. Multiple commands are separated by ,.
Modbus Config Generator

The Modbus Config Generator builds a complete RS-485 entry, e.g. R,9600,8N1:010300020002, which can be used on the DIN-Rail gateway as is. For a Modbus TCP entry, take the generated requests and put them behind the TCP interface, e.g. 192.168.1.200/010300020002. Combine several entries with ;.

RS-485 Interface (RTU / ASCII)​

Format: <mode>,<baudrate>,<serial settings>, e.g. R,9600,8N1 or A,19200,7E1.

SettingValues
ModeR (RTU), A (ASCII)
Baudrate1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
Data bits7, 8, 9
ParityN (none), E (even), O (odd)
Stop bits1, 2

Several RS-485 entries with different UART settings can be combined, e.g. A,2400,8E1/080300000001;R,9600,8N1/080300000001.

Modbus TCP Interface​

Format: <ip>[:<tcp port>][,<ethernet port>]

PartValuesDefault
<ip>IP address of the Modbus TCP device(required)
<tcp port>TCP port502
<ethernet port>ETH1 or LAN, ETH2 or WANETH1 / LAN

Examples:

  • 192.168.1.200/010380000001: device at 192.168.1.200, TCP port 502, via ETH1
  • 192.168.1.31:1502/010300020002: TCP port 1502, via ETH1
  • 192.168.1.200:502,WAN/010380000001: TCP port 502, via ETH2

Function Codes​

01 Read Coils · 02 Read Discrete Inputs · 03 Read Holding Registers · 04 Read Input Registers. Write commands are not supported.

Examples​

RS-485 (RTU, 9600 baud, 8N1, two requests to device address 1, one to the internal address FA = 250):

R,9600,8N1:010300020002,010300060002,FA0400050001

RS-485 and Modbus TCP combined:

R,9600,8N1/010300000003;192.168.1.200/010380000001

The address FA (= modbusInternalAddress 250) reads the gateway's internal sensors and is handled internally.


Live Mode​

liveMode works on the DIN-Rail gateway via Ethernet, LTE and LoRaWAN.


Limitations​

  • Time synchronization over Ethernet: With MQTT over Ethernet, time synchronization is currently not supported. With CoAP to the Lobaro Platform, the device gets the time from the platform. With WAN set to ethernet+lte, the time is synchronized as soon as LTE is used.

Wired M-Bus​

The DIN-Rail gateway has a wired M-Bus master on terminals 3 (M+) and 4 (M-) since v0.16.0. It supports primary and secondary addressing, automatic meter scan and overload protection.

Wired M-Bus uses the same parameters and uplink formats as the M-Bus Add-On. Unlike on the M-Bus Add-On, mbusAddrList is empty by default on the DIN-Rail gateway, so wired M-Bus is disabled until it is configured.