KMtronic KMtronic 4Port Modbus RTU template

KMtronic 4Port

The KMtronic 4Port is a four-channel relay output board controlled over Modbus RTU via RS485. It is used in building automation, industrial control, and energy management installations where software needs to switch discrete loads such as lights, ventilation contactors, motors, or alarm outputs. This template reads the live state of all four relays through coils 0 to 3 and writes target states using function code 15. Connecting the KMtronic 4Port to a ModbusCloud Gateway lets you log relay states, trigger cloud alerts, and audit switching history without additional hardware.

Protocol
Modbus RTU
Connection
RS485
Registers
8, read and write
Last updated

Registers (8)

4 read, 4 write

NameUnitAccessAddress (Hidden until you enter your email)Function (hidden)Type (hidden)
relay_1_aRead
relay_2_aRead
relay_3_aRead
relay_4_aRead
relay_1_bWrite
relay_2_bWrite
relay_3_bWrite
relay_4_bWrite

Loading registers…

Send your device list

If a device is not in the library yet, we build the template for free as soon as we have the register data.

Number of installations (optional)

Use cases

  • Monitor the live on/off state of all four relay channels to verify automated switching sequences are executing correctly.
  • Alert on a relay remaining energised beyond its expected duty cycle to detect stuck contactors or logic errors.
  • Log relay switching events over time to produce an audit trail for maintenance reporting and fault analysis.
  • Verify that a ventilation or heating contactor controlled via relay output responds within the expected latency.
  • Compare commanded relay states against read-back coil values to confirm physical contact actuation in the field.

Installation

  1. Set the Modbus unit ID on the KMtronic 4Port board by configuring the DIP switches located near the RS485 connector, then note the assigned address for use in the portal.

  2. Wire the RS485 A and B terminals of the board to the corresponding terminals on the ModbusCloud Gateway; supply the board with 12 VDC at the power terminals.

  3. In your ModbusCloud portal, add the Gateway, import the KMtronic 4Port template, and set the unit ID to match the DIP switch setting on the board; leave baud rate at 9600, 8N1.

  4. Spot-check the installation by reading coil address 0 (relay_1_a) in the portal live view and manually toggling the relay to confirm the read-back value changes correctly.

Things to watch for

All relay coil reads return errors. What should I check?

Confirm the RS485 A and B lines are not swapped. The KMtronic board uses 9600 baud, 8 data bits, 1 stop bit, no parity. Any mismatch in the ModbusCloud Gateway serial settings will cause all reads to fail. Also verify the unit ID in the portal matches the DIP switch position on the board; the factory default is unit ID 1.

The portal shows the relay state, but the physical contact does not switch.

FC01 reads coil state as reported by the microcontroller, which may not reflect a welded or failed relay contact. Check the load wiring on the NO or NC terminals independently with a multimeter. Inductive loads such as motor coils or solenoids can cause voltage spikes that damage contacts; fit a suppression capacitor if not already present.

Why does a write to relay_1_b not always take effect?

The KMtronic 4Port uses FC15 (Write Multiple Coils) in the OpenEMS implementation. Some older firmware variants on KMtronic boards respond only to FC05 (Write Single Coil). If writes are acknowledged with an exception code, test with FC05 directly using a Modbus test tool to determine which function code the board firmware supports.

Is it safe to write relay states from an automated rule in the cloud portal?

Write registers (relay_1_b through relay_4_b) directly energise or de-energise relay contacts. Before enabling automated write rules, confirm the connected load can tolerate unexpected switching, particularly for HVAC contactors or motor starters where abrupt on/off cycles can cause equipment damage or trip protection devices. Always test with low-risk loads first.

Want to see how it works?

Electrician working in an open distribution board