ModbusTCP_RU
ModbusTCP_RU
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 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.
