MD20001 Modbus RTU 12 Relays (EN)
From Modig.pl Wiki
Description
12-Relay Control Board via RS485 and Modbus RTU
The Modbus RTU 12 Relays module is equipped with 12 SPDT electromagnetic relays, which are controlled via Modbus standard commands transmitted through the RS485 interface. The control interface features galvanic isolation and surge protection, ensuring stable operation even in installations exposed to severe interference. The communication and operation parameters of the module can be flexibly configured and adapted to the requirements of various applications.

Basic features and parameters
- 12 relay outputs - NC/NO contacts, 10 A, 250 V AC / 30 V DC
- RS485 interface with galvanic isolation and surge protection
- Configurable communication parameters:
- baud rate: 1200…1000000;
- parity: none/even/odd;
- stop bits: 1/1.5/2
- Power supply: 5 V DC (4.9…5.3 V DC) with a minimum capacity of 1 A via a USB-C connector or a 2.1/5.5 DC barrel jack
- Power supply: 7…28 V min. 0.5 A via a 3.81 mm Phoenix connector
- Control and configuration of settings via Modbus commands
- Measurement of power supply voltage value (on the 5 V side) and module temperature
- Dimensions: 175x90x41 mm
- Assembly on a DIN-35 rail
Relay connectors
The relay contacts are routed to screw terminals with a 5.08 mm pitch. Each of the 12 outputs offers normally closed (NC) and normally open (NO) contacts. When a specific output is switched on, the NO contact is connected to the common contact (COM), while the NC contact is disconnected from COM. The pinout arrangement is shown in the figure below.

An example of a circuit controlled using the Modig Modbus 12Relays is shown in the figure below.

RS485 Interface
The RS485 interface is routed in the form of a 4-pin Phoenix Contact MC 3.81 mm connector. Depending on the installation type, only lines A+ and B- can be used, or all of them: 120 Ω, A+, B-, GND. Their functions are described in the table below.

| Designation | Function |
|---|---|
| 120 Ω / T | Activation of the internal 120 Ω termination resistor. The resistor is active when terminal T is connected to terminal A+, e.g., using a jumper mounted directly in the plug. |
| A+ | Line A of the RS485 bus (positive potential) |
| B- | Line B of the RS485 bus (negative potential) |
| GND / G | Ground GND of the RS485 bus. |
The RS485 interface is galvanically isolated from the remaining components and equipped with surge protection components, ensuring stable operation even in installations exposed to severe interference.
The RS485 communication parameters are configured via Modbus commands; default settings are: 19200, 8, none, 1.
The Modig Modbus 12R module can be connected to an RS485 bus that links up to 64 devices (including the module). Each device should be connected in such a way that no bus branches are created - any branch connections should be as short as possible. It is recommended to connect 120 Ω termination resistors at both ends of the bus. Modig Modbus features an integrated resistor of this type, but to activate it, terminal A+ and T must be connected together in the plug.
The figure shows a simplified schematic diagram of the RS485 bus, terminated with a 120 Ω termination resistor on one side, and with the termination resistor integrated in the module on the other side. Furthermore, correct and incorrect device connections to the bus are shown.

Power Supply
The Modig Modbus 12R module is equipped with 3 different power supply connectors. Choose only one of them and connect a power supply with the correct parameters and correct polarity. Detailed information can be found in the table and in the figure below.
| Connector | Function |
|---|---|
| USB-C (J3) | Standard USB-C socket, serves as a power supply connector only |
| 2.1/5.5 (J2) | 2.1/5.5 barrel jack compatible with "wall wart" type power supplies. Pay attention to polarity - center positive. |
| MC 3.81 mm (J1) | Connector with a plug for wire attachment. Pay attention to polarity - positive side towards the relays. |

Status LEDs
There are two status LEDs on the Modig Modbus 12R board that provide information about the device operation.
| LED Indicator | Function |
|---|---|
| STA | LED blinking with a brief cyclic blanking indicates correct operation of the device |
| BUS | LED flashing indicates receiving data from the RS485 bus and Modbus commands |

Restoring Factory Settings
There is a SET micro-button on the Modig Modbus 12R module board. Pressing and holding it for approximately 5 seconds will restore all settings (configuration register values) to their default values. This function is helpful in situations where sending Modbus commands to the module is impossible due to incorrect parameter configuration. Restoring default settings will set the RS485 communication parameters to: 19200, 8, none, 1 and the module address to "1".

Configuration Registers (Holding Registers)
All device parameters are defined by the values of the configuration registers, known as Holding Registers. Registers can be read and written via Modbus commands, allowing you to change the operation of the device. The list of registers and their functions are described in the table below.
| Register number (hex) | Name | Description | Default value /
value range |
|---|---|---|---|
| x4000 | Address | Specifies the module address when controlled with Modbus commands | 1 (x0001)
1…255 |
| x4002 | Coils | Contains a value specifying the number of outputs (Coils) available in the module. Read-only value |
16 (x0010) |
| x4004 | Inputs | Contains a value specifying the number of inputs (Discrete inputs) available in the module. Read-only value |
0 (x0000) |
| x4006 | Baud | Specifies the RS485 communication speed (baud). Value without the last 2 zeros, e.g.: 1200 = 12 = x000C; 2400 = 24 = x0018 |
192 (x00C0)
12…10000 |
| x4008 | Parity | Specifies the parity check for RS485 communication. 0 - none; 1 - even; 2 - odd |
0 (x0000)
0…2 |
| x400A | Stop | Specifies the stop bits for RS485 communication. 1 - 1 stop bit; 2 - two stop bits |
1 (x0001)
1…2 |
| x400C | Broadcast | Defines whether the device executes commands with the broadcast address value of 0 (x00) - broadcast. 0 - no, 1 - yes | 1 (x0001)
0…1 |
| x400E | CRC | Defines whether the device verifies the checksum in Modbus commands. 0 - no, 1 - yes | 0 (x0000)
0…1 |
| x4010 | Response | Allows sending responses to Modbus commands. 0 - does not send any responses, |
1 (x0001)
0…1 |
| x4012 | IO Offset | Specifies the starting value from which inputs and outputs (coils) are indexed. 0 - inputs/outputs start from 0 (0…15) |
1 (x0001)
0…1 |
| x4014 and x8000 |
Version | Contains the firmware software version. Value of 10 - means 1.0, etc. |
10 (x00A0) |
| x2000 | ExBaud | Allows configuring communication parameters using one of the predefined values. The lower byte corresponds to the baud rate: |
x0002
x0000…x0208 |
Measurement Input Registers (Input Registers)
The device is equipped with measurement circuits for the power supply voltage and temperature, which allow monitoring the module operating conditions and avoiding failures. The measurement results are available in the measurement input registers, known as Input Registers. The measurement registers can be read via Modbus commands.
| Register number (hex) | Name | Description | Value range |
|---|---|---|---|
| x3000 | Voltage | Measurement of the power supply voltage value. Value of 495 = 4.95 V, etc. | 330…550 |
| x3002 | Temp | Measurement of the module temperature. Temperature value 24 (x0018), which means 24 degrees C. Temperature range: -20…-1 is stored as xFF14…xFF01 |
-20…-1 *C = xFF14…xFF01 0…70 *C = |
Modbus Standard Control Commands
Each command in the Modbus standard takes the form of a data frame, the structure of which is shown in the figure below:

Consecutive frames must be separated by an interval of at least 3.5 character times (the time required to transmit a complete ASCII character), while the interval between transmitting one character and starting the transmission of the next character within the same frame must not exceed 1.5 character times. These rules apply to communication speeds (baud rates) up to 19200.
If the communication speed is set above 19200, the minimum interval between frames has a constant value equal to 1.75 ms. Meanwhile, the interval between consecutive characters within the same frame must not exceed 0.75 ms.
Each device connected to the Modbus bus must have a unique address assigned. The address field is located in every transmitted frame, has a size of 1 byte, and can have a value within the range of 1…255. An address value of 0 is the so-called broadcast address and allows a command to be directed to all devices connected to the bus. In some systems, it is not recommended to set addresses above the value of 247.
Outputs and inputs are standardly numbered starting from 1. In this case, the first output is the output numbered 1 (x01), and the last one is numbered 16 (0x10). The command descriptions and command examples refer specifically to this variant. However, the device can be configured in such a way that outputs and inputs are numbered starting from 0. In that case, the first output is the output numbered 0 (x00), and the last one is numbered 15 (0x0F). If the output number to which the control/reading command refers exceeds the number of outputs contained in the device (15 or 16, depending on the configuration), the command will not be executed and will remain without response.
Several standard commands exist in the Modbus standard. Each of them, along with example commands and device responses, is described in the subsequent sections of this manual.
List of Supported Modbus Commands
| Command Name | Command Code | Function |
|---|---|---|
| Write Single Coil | x05 | Allows controlling the state of an output or outputs |
| Write Multiple Coils | x0F | Allows controlling the state of multiple outputs simultaneously, both enabling and disabling specific outputs. |
| Read Coils | x01 | Allows reading the state of an output or outputs |
| Read Discrete Inputs | x02 | Allows reading the state of inputs. Since the Modig Modbus 16R device does not have inputs for reading states, it reads the state of outputs in response to this command, similar to the “Read Coils” command - x01. |
| Read Input Registers | x04 | Allows reading values from measurement input registers |
| Read Holding Registers | x03 | Allows reading values from configuration registers |
| Write Single Holding Register | x06 | Allows setting a value in a configuration register |
| Write Multiple Holding Registers | x10 | Allows setting values in several configuration registers |
Command “Write Single Coil” - x05
The x05 command allows controlling the state of an output or outputs.
| Data frame with command x05 | 01 05 00 00 FF 00 8C 3A | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x05 | Command “Write Single Coil” - control of a single output |
| 3…4 | x0000 | Output number to be controlled: 0 - none of the outputs, 1 - output 1 (first), 16 - output 16 (last) x00FF - controls all outputs - from 1 to 16 |
| 5…6 | xFF00 | Value specifying the task to be executed: x0000 - turn off (OFF), xFF00 - turn on (ON), x5500 - change state to the opposite (TOGGLE) ON->OFF / OFF->ON |
| 7…8 | x8C3A | CRC16 Checksum |
| Response | A device that reads and executes the command will send an identical frame in response: 01 05 00 00 FF 00 8C 3A | |
Similar commands:
- A5 05 00 08 55 00 6A 7C - x05 command to device with address 165 (xA5), output no. 8 (x0008) will change its state to the opposite (x5500)
- Response: A5 05 00 08 55 00 6A 7C
- 14 05 00 01 00 00 9E CF - x05 command to device with address 20 (x14), output no. 1 (x0001) will be turned off - OFF (x0000)
- Response: 14 05 00 01 00 00 9E CF
- 29 05 00 FF FF 00 BA 22 - x05 command to device with address 41 (x29), all outputs (x00FF) will be turned on - ON (xFF00)
- Response: 29 05 00 FF FF 00 BA 22
Command “Write Multiple Coils” - x0F
The x0F command allows controlling the state of multiple outputs simultaneously, both enabling and disabling specific outputs.
| Data frame with command x0F | 01 0F 00 01 00 03 02 00 05 27 76 | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x0F | Command “Write Multiple Coils” - control of multiple outputs |
| 3…4 | x0001 | Output number from which control begins: 0 - none of the outputs will be controlled, 1 - from output 1 (first), 16 - from output 16 (last) |
| 5…6 | x0003 | Number of outputs to be controlled: 0 - none of the outputs will be controlled 1 - one output, 16 - to control 16 outputs |
| 7 | x02 | Number of data bytes containing the control sequence - must be 2 |
| 8…9 | x0005 | Control sequence, LSB -> output no. 1. Bits with a value of 0 cause outputs to turn off, bits with a value of 1 cause outputs to turn on. x0005 = 00000000 00000101 - outputs 1 and 3 are enabled |
| 10...11 | x27 76 | CRC16 Checksum |
| Response | A device that reads and executes the command will send the following frame in response:
| |
| 1 | x01 | Address of the responding device |
| 2 | x0F | Command “Write Multiple Coils” - control of outputs |
| 3...4 | x0001 | Output number from which control started |
| 5...6 | x0003 | Number of outputs that were actually controlled |
| 7...8 | x440A | CRC16 Checksum |
If the number of outputs to be set exceeds the number of outputs contained in the device (after taking into account the output number from which control begins), the command will be executed correctly for the existing outputs. The response will return the number of outputs actually controlled.
Similar commands:
- A5 0F 00 03 00 04 02 00 07 6C E6 - x0F command to device with address 165 (xA5), controls 4 (x0004) outputs from output no. 3 (x0003), control sequence is x0007 (00000000 00000111) which means it will enable outputs 3, 4, 5 and disable output 6.
- Response: A5 0F 00 03 00 04 2C BD
- 14 0F 00 06 00 05 02 00 00 14 DA - x0F command to device with address 20 (x14), controls 5 (x0005) outputs from output no. 6 (x0006), control sequence is x0000 (00000000 00000000) which means it will disable outputs 6, 7, 8.
- Response: 14 0F 00 06 00 03 F7 0E (3 outputs controlled instead of 5)
- 29 0F 00 01 00 10 02 FF FF 1C 40 - x0F command to device with address 41 (x29), controls 16 (x0010) outputs from output no. 1 (x0001), control sequence is xFFFF (11111111 11111111) which means it will enable all outputs from 1 to 8.
- Response: 29 0F 00 01 00 08 03 E5
Command “Read Coils” - x01
The x01 command allows reading the state of an output or outputs.
| Data frame with command x01 | 01 01 00 02 00 04 9C 09 | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x01 | Command “Read Coils” - read output states |
| 3…4 | x0002 | Output number from which reading output states begins: 2 - read starting from output no. 2 |
| 5…6 | x0004 | Value specifying how many outputs will be read: 4 - read 4 outputs, i.e.: 2, 3, 4, and 5 |
| 7…8 | x9C09 | CRC16 Checksum |
| Response | A device that reads and executes the command will send the following frame in response: 01 01 02 00 0C B9 F9 | |
| 1 | x01 | Address of the responding device |
| 2 | x01 | Command “Read Coils” - read output states |
| 3 | x02 | Number of data bytes containing the response - 2 |
| 4…5 | x000C | State of outputs: 2 - OFF (0), 3 - OFF (0), 4 - ON (1), 5 - ON (1) Binary: 00000000 00001100 |
| 6…7 | xB9F9 | CRC16 Checksum |
Similar commands:
- A5 01 00 06 00 02 44 EE - x01 command to device with address 165 (xA5), read state of 2 (x0002) outputs, starting from output 6 (x0006).
- Response: A5 01 02 00 02 49 E4 - only output no. 7 is enabled (x0002)
- 14 01 00 08 00 01 7E CD - x01 command to device with address 20 (x14), read state of one (x0001) output, starting from output 8 (x0008).
- Response: 14 01 02 00 00 B4 3F - output is turned off (x0000)
- 29 01 00 20 00 08 3A 2E - x01 command to device with address 41 (x29), read state of 8 (x0008) outputs, starting from output 32 (x0020).
- Response: no response - cannot read state starting from output 32
If the number of outputs to be read exceeds the number of outputs contained in the device (after taking into account the output number from which the state reading begins), the non-existent outputs in the response will always have an OFF (0) state.
Command “Read Discrete Inputs” - x02
The x02 command allows reading the state of inputs. Since the Modig Modbus 12R device does not have inputs for reading states, it reads the state of outputs in response to this command, similar to the “Read Coils” command - x01.
| Data frame with command x02 | 01 02 00 02 00 04 D8 09 | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x02 | Command “Read Discrete Inputs” - read input states |
| 3…4 | x0002 | Input number from which reading input states begins: 2 - read starting from input no. 2 |
| 5…6 | x0004 | Value specifying how many inputs will be read: 4 - read 4 inputs, i.e.: 2, 3, 4, and 5 |
| 7…8 | xD809 | CRC16 Checksum |
| Response | A device that reads and executes the command will send the following frame in response: 01 02 02 00 0C B9 BD | |
| 1 | x01 | Address of the responding device |
| 2 | x02 | Command “Read Discrete Inputs” - read input states |
| 3 | x02 | Number of data bytes containing the response - 2 |
| 4…5 | x000C | State of inputs: 2 - inactive (0), 3 - inactive (0), 4 - active (1), 5 - active (1); Binary: 00000000 00001100 |
| 6…7 | xB9BD | CRC16 Checksum |
Similar commands:
- A5 02 00 02 00 06 40 EC - x02 command to device with address 165 (xA5), read state of 6 (x0006) inputs, starting from input 2 (x0002).
- Response: A5 02 02 00 02 49 A0 - only output no. 3 is active (x0002)
- 14 02 00 08 00 01 3A CD - x02 command to device with address 20 (x14), read state of one (x0001) input, starting from input 8 (x0008).
- Response: 14 02 02 00 00 B4 7B - output is inactive (x0000)
- 29 02 00 20 01 00 7E 78 - x02 command to device with address 41 (x29), read state of 16 (x0010) inputs, starting from input 32 (x0020).
- Response: no response - cannot read state starting from input 32
If the number of inputs to be read exceeds the number of inputs contained in the device (after taking into account the input number from which the state reading begins), the non-existent inputs in the response will always have an inactive (0) state.
Command “Read Input Registers” - x04
The x04 command allows reading values from the measurement input registers. In the Modig Modbus 12R module, it is possible to measure the power supply voltage and the module temperature.
| Data frame with command x04 | 01 04 30 00 00 02 7E CB | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x04 | Command “Read Input Registers” - read measurement input registers |
| 3…4 | x3000 | Register number from which reading begins. x3000 - reading the power supply voltage measurement x3002 - reading the module temperature measurement |
| 5…6 | x0002 | Value specifying how many registers will be read: 1 - one register, e.g., voltage only; 2 - both measurement registers |
| 7…8 | x7ECB | CRC16 Checksum |
| Response | A device that reads and executes the command will send the following frame in response: 01 04 04 02 06 00 18 1A 37 | |
| 1 | x01 | Address of the responding device |
| 2 | x04 | Command “Read Input Registers” - read measurement input registers |
| 3 | x04 | Number of data bytes containing the response - 4 |
| 4…5 | x0206 | Voltage value - x0206 = 518, which means 5.18 V |
| 6…7 | x0018 | Temperature value - x0018 = 24, which means 24 degrees C Temperature range: -20…-1 is stored as xFF14…xFF01 Temperature range: 0…70 is stored as x0000…x0046 |
| 8…9 | x1A37 | CRC16 Checksum |
Similar commands:
- A5 04 30 00 00 01 27 EE - x04 command to device with address 165 (xA5), read one register (x0001) numbered x3000, i.e., the power supply voltage measurement register.
- Response: A5 04 02 01 F0 49 A0 - voltage is 4.96 V (x01F0 = 496)
- 14 04 30 08 00 02 FD CC - x04 command to device with address 20 (x14), read two (x0002) measurement registers starting from number x3008.
- Response: no response - there is no measurement register numbered x3008.
- 29 04 30 02 00 02 7E 78 - x04 command to device with address 41 (x29), read two (x0002) measurement registers starting from number x3002.
- Response: A5 04 02 00 18 C8 E3 - the device does not have measurement registers higher than x3002, therefore only one register numbered x3002 was read - module temperature = 24 (x0018) and the response contains only two data bytes (x02)
Command “Read Holding Registers” - x03
The x03 command allows reading values from the configuration registers.
| Data frame with command x03 | 01 03 40 00 00 01 91 CA | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x03 | Command “Read Holding Registers” - read configuration registers |
| 3…4 | x4000 | Register number from which reading begins. Available registers are in the range of x4000…x4014 as well as x2000 and x8000 |
| 5…6 | x0001 | Value specifying how many registers will be read: 1 - one register, etc., maximum 8 |
| 7…8 | x91CA | CRC16 Checksum |
| Response | A device that reads and executes the command will send the following frame in response: 01 03 02 00 01 79 84 | |
| 1 | x01 | Address of the responding device |
| 2 | x03 | Command “Read Holding Registers” - read configuration registers |
| 3 | x02 | Number of data bytes containing the response - 2 |
| 4…5 | x0001 | The register numbered x4000 contains the address for Modbus commands, which in this case is 1 (x0001) |
| 6…7 | x7984 | CRC16 Checksum |
Similar commands:
- A5 03 40 06 00 04 28 EE - x03 command to device with address 165 (xA5), read four configuration registers (x0004), starting from number (x4006).
- Response: 01 03 08 00 C0 00 00 00 01 00 01 C5 DB - values of 4 configuration registers, i.e., 8 bytes of data
- 14 03 80 00 00 01 AF 0F - x03 command to device with address 20 (x14), read one (x0001) configuration register numbered x8000, i.e., the firmware version.
- Response: 14 03 02 00 A0 B5 FF - 2-byte response (x00A0) = 10 which means firmware version 1.0
Command “Write Single Holding Register” - x06
The x06 command allows setting a value in a configuration register.
| Data frame with command x06 | 01 06 40 00 00 01 5D CA | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x06 | Command “Write Single Holding Register” - write configuration register |
| 3…4 | x4000 | Register number to which the new value will be written. Available registers are in the range of x4000, x4006…x4012 as well as x2000 |
| 5…6 | x0001 | Value to be written to the register |
| 7…8 | x5DCA | CRC16 Checksum |
| Response | A device that reads and executes the command will send an identical frame in response: 01 06 40 00 00 01 5D CA | |
Similar commands:
- A5 06 40 00 00 04 84 ED - x06 command to device with address 165 (xA5), write the value 4 (x0004) to configuration register numbered x4000, i.e., assigning a new address value of 4.
- Response: A5 06 40 00 00 04 84 ED
- 14 06 40 0C 00 00 5E CC - x06 command to device with address 20 (x14), write the value 0 (x0000) to configuration register numbered x400C, i.e., disabling support for broadcast type commands.
- Response: 14 06 40 0C 00 00 5E CC
Command “Write Multiple Holding Registers” - x10
The x10 command allows setting values in several configuration registers.
| Data frame with command x10 | 01 10 40 0C 00 03 06 00 01 00 00 00 01 8F 7E | |
|---|---|---|
| Byte Number | Value (hex) | Meaning |
| 1 | x01 | Target device address |
| 2 | x10 | Command “Write Multiple Holding Registers” - write several configuration registers |
| 3…4 | x400C | Register number from which writing begins. Available registers are in the range of x4000, x4006…x4012 as well as x2000 |
| 5…6 | x0003 | Value specifying how many registers will be written: 1 - one register, etc., maximum 8 |
| 7 | x06 | Number of data bytes containing the values to be written |
| 8…13 | x0001 x0000 x0001 |
Three values to be entered into the configuration registers |
| 14…17 | x8F7E | CRC16 Checksum |
| Response | A device that reads and executes the command will send the following frame in response: 01 10 40 0C 00 03 55 CB | |
| 1 | x01 | Address of the responding device |
| 2 | x10 | Command “Write Multiple Holding Registers” - write several configuration registers |
| 3 | x400C | Register number from which the writing of values started |
| 4…5 | x0003 | Value specifying how many registers were actually written |
| 6…7 | x55CB | CRC16 Checksum |
Similar commands:
- A5 10 40 00 00 01 02 00 03 6D 52 - x10 command to device with address 165 (xA5), write one (x0001) configuration register starting from number x4000 with data of two bytes length (x02) equal to x0003, i.e., assigning a new address value of 3.
- Response: A5 10 40 00 00 03 8C EC
- 14 10 40 0C 00 02 04 00 01 00 00 D6 F5 - x10 command to device with address 20 (x14), write two (x0002) configuration registers starting from number x400C with values x0001 and x0000, i.e., enabling support for broadcast type commands and disabling CRC checksum verification.
- Response: 14 10 40 0C 00 02 96 CE
