

The Modbus 4CH I/O module (Manufacturer: Somewhere, Part ID: modbus) is a versatile 4-channel input/output device designed for seamless communication and control over a Modbus network. This module enables the integration of multiple sensors and actuators, making it ideal for industrial automation, home automation, and other applications requiring reliable and efficient data exchange.








| Pin Name | Description |
|---|---|
| V+ | Positive power supply (12V-24V DC) |
| GND | Ground (0V) |
| A | RS-485 communication line A |
| B | RS-485 communication line B |
| Pin Name | Description |
|---|---|
| IN1 | Digital input channel 1 |
| IN2 | Digital input channel 2 |
| IN3 | Digital input channel 3 |
| IN4 | Digital input channel 4 |
| GND | Common ground for input signals |
| Pin Name | Description |
|---|---|
| OUT1 | Digital output channel 1 |
| OUT2 | Digital output channel 2 |
| OUT3 | Digital output channel 3 |
| OUT4 | Digital output channel 4 |
| COM | Common terminal for output signals |
Below is an example of how to control the Modbus 4CH I/O module using an Arduino UNO and the ModbusMaster library.
#include <ModbusMaster.h>
// Instantiate ModbusMaster object
ModbusMaster node;
// Define the Modbus slave ID of the 4CH I/O module
#define SLAVE_ID 1
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Initialize RS-485 communication (using pins 0 and 1 for Arduino UNO)
Serial1.begin(9600); // Adjust baud rate as per module configuration
// Assign the RS-485 serial port to the ModbusMaster object
node.begin(SLAVE_ID, Serial1);
}
void loop() {
uint8_t result;
// Example: Turn ON output channel 1
result = node.writeSingleCoil(0x0000, 1); // Address 0x0000 corresponds to OUT1
if (result == node.ku8MBSuccess) {
Serial.println("Output 1 turned ON successfully.");
} else {
Serial.print("Error: ");
Serial.println(result, HEX);
}
delay(1000); // Wait for 1 second
// Example: Turn OFF output channel 1
result = node.writeSingleCoil(0x0000, 0); // Address 0x0000 corresponds to OUT1
if (result == node.ku8MBSuccess) {
Serial.println("Output 1 turned OFF successfully.");
} else {
Serial.print("Error: ");
Serial.println(result, HEX);
}
delay(1000); // Wait for 1 second
}
No Communication with the Module
Inputs Not Responding
Outputs Not Activating
Intermittent Communication Errors
Q: Can I use this module with a Modbus TCP network?
A: No, this module is designed for Modbus RTU (RS-485) communication. You would need a Modbus RTU-to-TCP gateway for integration with a Modbus TCP network.
Q: How do I change the Modbus address of the module?
A: The Modbus address can be configured using the DIP switches or configuration software provided by the manufacturer. Refer to the manufacturer's manual for detailed instructions.
Q: What happens if I exceed the output current rating?
A: Exceeding the 2A current rating may damage the output channels. Use external relays or drivers for high-current loads.
Q: Can I use this module in outdoor environments?
A: The module is not weatherproof. Use an appropriate enclosure to protect it from moisture, dust, and extreme temperatures.