Wiznet makers

jaden

Published June 29, 2026 ©

130 UCC

18 WCC

59 VAR

0 Contests

0 Followers

0 Following

Original Link

GatewaySuriotaPOC

ESP32-S3 Industrial IoT Gateway with Modbus RTU/TCP

COMPONENTS
PROJECT DESCRIPTION

How to Build an Industrial Modbus Gateway with W5500 on ESP32-S3?

Summary

The SRT-MGATE-1210 project demonstrates an industrial IoT gateway built on the ESP32-S3 platform using the WIZnet W5500 Ethernet controller for reliable wired networking. The gateway collects data from Modbus RTU and Modbus TCP devices and securely forwards it to cloud platforms through MQTT or HTTP. By combining Ethernet as the primary network interface with Wi-Fi failover, the system is designed to maintain stable cloud connectivity even in demanding industrial environments.


What the Project Does

GatewaySuriotaPOC is an industrial communication gateway that bridges field devices and cloud services. It supports two RS485 Modbus RTU ports as well as Modbus TCP devices connected over Ethernet. Device data is periodically collected, processed by the ESP32-S3, and transmitted to remote cloud servers using MQTT publish/subscribe messaging or HTTP REST APIs.

The project separates networking, protocol handling, cloud communication, and device management into dedicated FreeRTOS tasks. Configuration is performed over Bluetooth Low Energy (BLE), while the gateway continuously manages Modbus polling, cloud synchronization, local storage, and automatic network recovery.

Its architecture focuses on reliable industrial communication rather than simple sensor connectivity.


Where WIZnet Fits

The project uses the WIZnet W5500 as its dedicated Ethernet interface for the ESP32-S3.

Instead of relying solely on wireless networking, the gateway prioritizes wired Ethernet for communication with MQTT brokers and cloud servers. Wi-Fi operates as a secondary interface when Ethernet becomes unavailable.

The hardware documentation defines the dedicated SPI connection for the W5500:

#define ETH_CS   48
#define ETH_MOSI 14
#define ETH_MISO 21
#define ETH_SCK  47
#define ETH_RST  3
#define ETH_INT  9

SPIClass SPI3(FSPI);
SPI3.begin(ETH_SCK, ETH_MISO, ETH_MOSI, ETH_CS);
Ethernet.init(ETH_CS);

This configuration establishes the physical Ethernet interface used by higher-level networking services including:

Modbus TCP communication

MQTT client connections

HTTP REST communication

Network failover management

Using a dedicated Ethernet controller allows the gateway to maintain predictable network performance for industrial equipment where stable connectivity is more important than wireless convenience.


Network Stack and Cloud Connectivity

One of the strongest aspects of this project is its layered network architecture.

The communication flow follows a straightforward pipeline:

Industrial Device
Modbus RTU / Modbus TCP
ESP32-S3 Gateway
W5500 Ethernet
TCP/IP
MQTT Broker or HTTP Cloud Service

Rather than coupling device communication directly with cloud services, the project separates each network layer into dedicated managers.

The Network Manager initializes either Ethernet or Wi-Fi based on the configured priority:

if (ethernetEnabled) {
    bool useDhcp = ethernetConfig["use_dhcp"] | true;
    initEthernet(useDhcp, staticIp, gateway, subnet);
}

Once the network becomes available, the MQTT manager establishes persistent broker connections.

The project documentation recommends configuring the MQTT client with larger packet buffers, keep-alive intervals, and socket timeouts to improve long-running cloud communication.

mqttClient.setServer(broker, port);
mqttClient.setBufferSize(2048);
mqttClient.setKeepAlive(60);
mqttClient.setSocketTimeout(30);

Combined with automatic reconnection and persistent message queues, the gateway continues forwarding industrial data even after temporary network interruptions.

 


Why Ethernet Matters for Industrial IoT

Although the ESP32-S3 includes Wi-Fi, this project intentionally places Ethernet at the center of its communication architecture.

For industrial automation systems, Ethernet provides several practical advantages:

Stable latency for continuous Modbus polling

Reduced sensitivity to RF interference

Reliable MQTT sessions over long operating periods

Easier integration with factory networks

Predictable cloud connectivity for always-on gateways

The W5500 enables these characteristics through a dedicated SPI Ethernet interface while allowing the ESP32-S3 to focus on application logic, protocol processing, and cloud services.


Practical Tips

Verify the W5500 SPI pin mapping before enabling Ethernet.

Test both DHCP and static IP configurations during deployment.

Separate Ethernet and SD card SPI chip-select signals to avoid bus conflicts.

Enable MQTT persistent queues to prevent data loss during temporary outages.

Configure Ethernet as the preferred interface and Wi-Fi as backup for maximum availability.

Monitor Ethernet link status through the W5500 interrupt pin to improve recovery time.


FAQ

Why does this project use the W5500?

The W5500 provides a dedicated wired Ethernet interface for industrial networking. It enables stable TCP/IP communication between the gateway and cloud infrastructure while supporting continuous MQTT and HTTP traffic over wired Ethernet.

How is the W5500 connected to the ESP32-S3?

The controller communicates through the ESP32-S3 FSPI interface. The project assigns dedicated GPIO pins for SPI, chip select, reset, and interrupt signals, allowing the Arduino Ethernet library to initialize the network interface.

What role does the W5500 play in this gateway?

The W5500 serves as the primary communication path between industrial devices and cloud services. It transports Modbus TCP traffic, MQTT messages, and HTTP requests while supporting automatic failover to Wi-Fi when necessary.

Is this project suitable for beginners?

This project targets intermediate embedded developers. Familiarity with ESP32 development, SPI peripherals, TCP/IP networking, Modbus, and MQTT is recommended before extending the gateway.

Why use Ethernet instead of Wi-Fi?

Industrial gateways often operate continuously in electrically noisy environments where wireless performance may fluctuate. Ethernet offers more predictable latency, greater connection stability, and consistent cloud communication for long-term deployments.


Source

Original Project

https://github.com/szf2020/GatewaySuriotaPOC

License

MIT License


Tags

#W5500 #ESP32S3 #IndustrialIoT #Ethernet #MQTT #TCPIP #Modbus #CloudConnectivity #IIoT #WIZnet

Documents
Comments Write