Wiznet makers

irina

Published September 25, 2025 ©

112 UCC

5 WCC

89 VAR

0 Contests

0 Followers

0 Following

Original Link

Arduino + W5500 Ethernet Series Overview (C & Modbus TCP)

Nokanda’s Arduino + W5500 series evolves from Ethernet basics to Modbus TCP, showing step-by-step networking, request/response, and protocol use.

COMPONENTS
PROJECT DESCRIPTION

Clicking the picture redirects you to the maker’s website.

1. Introduction

This post collects and explains a full Arduino + W5500 Ethernet series.
The videos are created by Nokanda, with project posts shared by different contributors:

He uploaded the fundamentals (#610, #611, #612).

He uploaded the applied part (#614,# 615) to extend the series into Modbus TCP.

➡️ Readers can learn step by step: networking basics → request/response → Modbus TCP fundamentals → advanced Modbus TCP features.

#614, #615 goes beyond a simple Modbus TCP example and demonstrates practical implementation with Arduino UNO + W5500 Ethernet.

We start with the basics: controlling and reading coils with FC05 (Write Single Coil) and FC01 (Read Coils), and then expand to advanced functions such as FC15 (Write Multiple Coils), FC06 (Write Single Register), and FC04 (Read Input Registers) including 32-bit floating-point data.

Arduino acts as a Modbus TCP Slave (Server), while the C# WinForms application functions as the Master (Client).

Series Roadmap Diagram

[Networking Basics] (610, 611)   by Bruno
        ↓
[Request/Response] (612)         by Bruno
        ↓
[Modbus TCP Basics] (614)        by irina
        ↓
[Modbus TCP Advanced] (615)      by irina
Videos created by Nokanda

3. Modbus TCP 프레임구조

+--------------------------------------+
| MBAP Header (7 bytes)  |
|  - Transaction ID (2)     	  |
|  - Protocol ID (2)      		  |
|  - Length (2)            			  |
|  - Unit ID (1)           			  |
+---------------------------------------+
| PDU                         		      |
|  - Function Code (1)         |
|  - Data (N)                 		  |
+---------------------------------------+

2. Modbus RTU vs TCP

RTU

  • Requires CRC16 checksum
  • RS-485/RS-232 based
  • 1-byte slave address

TCP

  • CRC removed (error handling by TCP/IP)
  • Adds a 6-byte MBAP Header
  • Devices identified by IP address instead of only Slave ID

👉 Conclusion: TCP is more scalable and network-friendly, making it better suited for industrial control and IoT.


3. Modbus Basics

  • Coils: 1-bit (ON/OFF, mapped to Arduino GPIO pins)
  • Registers: 16-bit values (used for variables or sensor data)
  • Common Function Codes:
    • 0x01 → Read Coils (#614)
    • 0x05 → Write Single Coil (#614)
    • 0x15 → Write Multiple Coils (#615)
    • 0x06 → Write Single Register (#615)
    • 0x04 → Read Input Registers (32-bit float supported, #615)

4. Arduino + W5500 Examples

(1) Write Single Coil (FC05, #614)

Control a single LED (Coil0 → D2).

ON  → 00 01 00 00 00 06 01 05 00 00 FF 00  
OFF → 00 01 00 00 00 06 01 05 00 00 00 00 

(2) Read Coils (FC01, #614)

Read multiple coil states and display them in the UI.

(3) Write Multiple Coils (FC15, #615)

Batch control multiple LEDs (Coil0~Coil5 → D2~D7).

(4) Write Single Register (FC06, #615)

Update Arduino’s variable remotely with a 16-bit value.

(5) Read Input Registers (FC04, #615)

Read sensor values or variables.

32-bit float = 2 registers (4 bytes)

Must agree on endianness and word order (ABCD, BADC, CDAB, DCBA).


5. C# WinForms UI Integration

  • Acts as Modbus TCP Master.
  • Supports:
    • Coil ON/OFF buttons
    • Register write/read
    • Timer-based real-time coil monitoring
  • Implementation:
    • Raw Socket: Build MBAP + PDU manually
    • NModbus4 Library: Simplifies request/response handling
  • Always include timeout, retry logic, and exception frame parsing (FC | 0x80).

6. Troubleshooting

  • Endian mismatch: Garbage float values
  • Length mismatch: Master rejects frame
  • Coil bit packing error: Wrong LED toggles
  • W5500 buffer overflow (2KB/socket): Frame truncation → use shorter packets

7. Conclusion

#614: Focused on basics — single coil write (FC05) and coil read (FC01).

#615: Extended to advanced control — multiple coil writes (FC15), register writes (FC06), and safe float data exchange with FC04.

👉 The combination of Arduino UNO + W5500 Ethernet (slave) and C# WinForms (master) provides a practical Modbus TCP solution for:

  • Industrial control
  • IoT gateways
  • Remote monitoring systems

✅ Key SEO Keywords

Arduino Modbus TCP
W5500 Ethernet module
Modbus RTU vs TCP differences
C# WinForms Modbus example
FC15 multiple coil write
FC06 single register write
FC04 read input registers
32-bit float Modbus data

➡️ Next, I plan to explore TLS security, MQTT bridging, and cloud integration as future extensions.

 
Documents
Comments Write