Wiznet makers

lawrence

Published March 29, 2026 ©

139 UCC

9 WCC

32 VAR

0 Contests

0 Followers

0 Following

Original Link

ModbusTCP_RU

ModbusTCP_RU is an Arduino library for building Modbus TCP Master and Slave devices on boards equipped with W5100 or W5500 Ethernet controllers.

COMPONENTS Hardware components

Arduino - Arduino UNO

x 1


Arduino - Arduino Ethernet Shield

x 1


PROJECT DESCRIPTION

ModbusTCP_RU: A Lightweight Modbus TCP Library for Arduino and W5500

Project Overview

ModbusTCP_RU is an Arduino library for building Modbus TCP Master and Slave devices on boards equipped with W5100 or W5500 Ethernet controllers. The project is intended for direct device-to-device communication as well as SCADA integration, and the current public release is v0.1.3, documented for Arduino IDE 2.3.5 and tested with W5500.

Where It Fits

This project is useful when a small embedded device needs to expose data or accept control commands over industrial Ethernet using Modbus TCP. Typical use cases include relay control nodes, simple sensor gateways, Modbus test benches, and Arduino-based field devices that need to communicate with PLCs, HMIs, or SCADA systems. The included examples cover relay control, HTU21D sensor data mapping, and direct Master-to-Slave communication without SCADA.

Key Features

The library supports both Slave mode and Master mode, which makes it flexible for small control and monitoring projects. It also supports the most common Modbus function codes: FC1, FC2, FC3, FC4, FC5, FC6, FC15, and FC16. Internally, Modbus data is stored in a shared MbData[] array, with a default length of 30 16-bit registers, which also allows bit-level access across the same memory model.

Technical Highlights

The design is intentionally simple. In Slave mode, the library processes requests through MbsRun(), while in Master mode it sends requests with Req() and handles responses through MbmRun(). The current release also improved boundary checks, request/response buffer handling, automatic TCP server startup in Slave mode, and direct Master-to-Slave example support.

Why Master Support Matters

(* created by AI)

A notable point of ModbusTCP_RU is that it supports not only Slave mode but also Master mode. Along with MbsRun() for Slave operation, the library provides Req(), MbmRun(), and remSlaveIP for sending requests to remote Slave devices. The included direct Master-to-Slave example without SCADA shows that Arduino + W5500 can act not only as a passive Modbus TCP endpoint, but also as a lightweight polling, control, and test node. This expands the project beyond simple data serving into practical use cases such as sensor polling, relay control, and small device-to-device automation.

  • Direct device-to-device communication
    Master mode allows Arduino + W5500 to communicate directly with remote Slave devices, not just act as a PC-connected endpoint for SCADA or HMI.
  • Sensor polling node
    The Arduino can periodically read holding registers from remote Slave sensors and collect data such as temperature, humidity, or power values.
  • Lightweight controller
    It can read data from one Slave and send write commands to another, making simple automation and relay control possible.
  • Test and validation node
    Arduino + W5500 can also work as a small Modbus TCP test master, which is useful for checking register maps and communication flow without a full PLC or SCADA setup.

Why W5500 Matters

W5500 is a strong match for this project because it provides a hardwired TCP/IP stack, embedded 10/100 Ethernet MAC/PHY, 8 independent sockets, and 32 KB of internal Tx/Rx buffer memory, all connected to the MCU through SPI. That makes wired Ethernet implementation much easier on Arduino-class hardware. In the context of ModbusTCP_RU, W5500 helps turn a small MCU board into a practical wired Modbus TCP node with less software overhead than a fully software-driven Ethernet stack.

 

QnA

1. What is ModbusTCP_RU?

ModbusTCP_RU is a lightweight Arduino library for implementing Modbus TCP communication over Ethernet. It supports both Master and Slave modes and is designed for boards using W5100 or W5500 Ethernet controllers.

2. What does ModbusTCP_RU do?

ModbusTCP_RU allows Arduino-based devices to communicate over Modbus TCP, either as a Slave that responds to requests or as a Master that actively polls and controls remote Modbus TCP devices.

3. Which Ethernet hardware is supported by ModbusTCP_RU?

ModbusTCP_RU is built for Ethernet-capable Arduino systems using W5100 or W5500. The project documentation specifically mentions testing with W5500.

4. Does ModbusTCP_RU support both Master and Slave modes?

Yes. One of the key features of ModbusTCP_RU is support for both Modbus TCP Master and Modbus TCP Slave operation in the same library.

5. Why is Master support important in ModbusTCP_RU?

Master support allows Arduino + W5500 to do more than just respond to SCADA or PLC requests. It can actively read sensor values, control remote Slave devices, and work as a small polling or automation node in a Modbus TCP network.

Documents
Comments Write