Wiznet makers

sophia

Published July 30, 2026 ©

88 UCC

13 VAR

0 Contests

0 Followers

1 Following

Original Link

How Does W5500 Turn an ESP32-S3 into a Modbus TCP Device Simulator?

An ESP32-S3 and W5500-based learning platform that simulates industrial Modbus TCP devices and supports Ethernet OTA, configurable network settings, an HTTP API

COMPONENTS Hardware components

WIZnet - W5500

x 1


PROJECT DESCRIPTION

개요

산업 자동화 시스템을 개발할 때 PLC, SCADA, HMI 또는 데이터 수집 소프트웨어를 실제 센서와 연결하기 전에 통신 기능부터 검증해야 하는 경우가 많습니다. 그러나 테스트할 실제 장비가 준비되지 않았거나, 여러 종류의 센서 데이터를 반복적으로 재현해야 한다면 개발 과정이 복잡해질 수 있습니다.

modbus_tcp_simulator는 이러한 상황에서 사용할 수 있도록 제작된 ESP32-S3 기반 Modbus TCP 장치 시뮬레이터 학습 프로젝트입니다. Waveshare ESP32-S3-ETH 보드에 탑재된 W5500 Ethernet 컨트롤러를 사용해 안정적인 유선 네트워크 경로를 구성하고, 실제 산업용 장치처럼 측정값과 Coil 상태를 Modbus TCP로 제공합니다.

이 프로젝트는 단순히 Modbus 패킷을 한 번 송수신하는 예제가 아닙니다. Ethernet 연결부터 OTA 업데이트, Modbus 데이터 시뮬레이션, HTTP API, Python CLI 및 네트워크 설정 관리까지 단계별로 확장되는 학습 구조를 제공합니다.


사용 하드웨어

프로젝트의 대상 보드는 Waveshare ESP32-S3-ETH입니다.

주요 구성은 다음과 같습니다.

  • ESP32-S3R8 MCU
  • 8 MB PSRAM
  • W25Q128 16 MB 외장 Flash
  • W5500 10/100 Mbps Ethernet 컨트롤러
  • GPIO21에 연결된 WS2812 RGB LED

W5500은 ESP32-S3에 유선 Ethernet 연결을 제공하며, Modbus TCP 서버와 관리 인터페이스가 동작하는 네트워크 경로를 담당합니다.


프로젝트가 해결하는 문제

산업용 네트워크 애플리케이션을 개발할 때 다음과 같은 문제가 발생할 수 있습니다.

  • 테스트할 실제 Modbus 장비가 아직 없음
  • 센서 값을 원하는 조건으로 반복하기 어려움
  • PLC 또는 SCADA 설정을 검증하기 위해 여러 장치가 필요함
  • 현장에 설치된 장비의 펌웨어를 직접 연결해 업데이트하기 어려움
  • DHCP와 Static IP 환경을 각각 시험해야 함

이 프로젝트는 ESP32-S3 보드 한 대를 소프트웨어로 제어 가능한 가상 Modbus 장치로 만들어 이러한 테스트 과정을 단순화합니다.


시스템 구조

 
PLC / SCADA / HMI / Modbus Client
                │
           Modbus TCP
                │
        Ethernet Network
                │
             W5500
                │
            ESP32-S3
        ┌───────┴────────┐
 Simulated FC04 Data   FC01 / FC05 Coil
 Configurable Value     WS2812 LED
        │
 HTTP API / Python CLI / Ethernet OTA
 

PC의 Modbus 클라이언트는 Ethernet을 통해 ESP32-S3에 접속합니다. W5500은 ESP32-S3와 유선 네트워크 사이의 Ethernet 인터페이스로 동작하고, ESP32-S3는 설정된 측정값과 Coil 상태를 Modbus TCP로 제공합니다.


주요 기능

1. DHCP 및 Static IPv4 지원

장치는 DHCP를 사용해 자동으로 네트워크 주소를 받을 수 있으며, 필요할 경우 고정 IP 설정도 유지할 수 있도록 구성됩니다.

이는 개발 환경에서는 DHCP를 사용하고, IP 주소가 고정되어야 하는 PLC 또는 공장 네트워크에서는 Static IP를 사용하는 실제 배포 조건을 시험하는 데 유용합니다.

2. Modbus TCP 측정값 시뮬레이션

프로젝트는 설정 가능한 측정값을 Modbus FC04, Read Input Registers를 통해 제공합니다.

예를 들어 실제 온도 센서가 연결되지 않아도 ESP32-S3가 특정 온도값을 가진 가상 센서처럼 동작하도록 설정할 수 있습니다. 개발자는 이를 활용해 PLC 스케일링, 경보 조건, HMI 표시 및 데이터 로깅 기능을 검증할 수 있습니다.

3. Coil 읽기 및 제어

온보드 WS2812 LED는 Modbus Coil 0과 연결됩니다.

  • FC01: Coil 상태 읽기
  • FC05: Single Coil 쓰기

이를 통해 Modbus 클라이언트의 제어 명령이 실제 보드의 출력 상태 변화로 이어지는 과정을 시각적으로 확인할 수 있습니다.

4. Ethernet OTA

프로젝트는 Ethernet을 통한 push 방식 애플리케이션 업데이트 기능을 포함하며, 기본적으로 포트 8080을 사용합니다.

장치가 제어반이나 원격 테스트 환경에 설치된 경우 USB 케이블을 매번 연결하지 않고도 유선 네트워크를 통해 펌웨어를 업데이트할 수 있습니다.

5. HTTP API와 Python CLI

버전이 관리되는 HTTP API와 Python 표준 라이브러리 기반 CLI를 통해 각 테스트 보드를 설정할 수 있습니다.

따라서 개발자는 여러 ESP32-S3 테스트 장치의 측정값과 네트워크 설정을 자동화 스크립트에서 변경하거나, 반복 테스트 시나리오를 구성할 수 있습니다.


W5500의 역할

이 프로젝트에서 W5500은 단순히 RJ45 커넥터를 추가하는 부품이 아닙니다.

유선 Modbus TCP 경로 제공

Modbus TCP 클라이언트의 요청과 ESP32-S3의 응답이 W5500 Ethernet 인터페이스를 통해 전달됩니다.

산업용 네트워크 환경 재현

PLC와 SCADA 시스템은 고정된 IP 구조와 유선 Ethernet을 사용하는 경우가 많습니다. W5500을 사용하면 Wi-Fi 환경과 구분되는 실제 유선 테스트 구조를 만들 수 있습니다.

네트워크 기반 관리 기능 지원

Modbus TCP뿐 아니라 HTTP API와 Ethernet OTA도 동일한 유선 네트워크를 사용합니다. 즉, 하나의 Ethernet 연결이 데이터 통신, 설정 및 펌웨어 관리 경로를 함께 제공합니다.


단계별 학습 구조

저장소는 다음과 같은 순서로 기능을 구현하도록 구성되어 있습니다.

  1. W5500 Ethernet과 DHCP 연결
  2. Ethernet 기반 애플리케이션 업데이트
  3. Modbus TCP를 이용한 가상 온도값 제공
  4. Modbus 테스트 장치 설정 및 자동화
  5. DHCP와 Static IPv4 설정의 영구 저장

이러한 구성은 완성된 코드를 단순히 복사하는 방식보다, Ethernet 기반 산업용 장치가 만들어지는 과정을 단계적으로 이해하는 데 도움이 됩니다.


활용 가능 분야

이 프로젝트는 다음과 같은 용도로 확장할 수 있습니다.

  • PLC 프로그램 사전 검증
  • SCADA 및 HMI 화면 개발
  • Modbus TCP 게이트웨이 테스트
  • 산업용 데이터 로거 개발
  • 생산라인 시운전 교육
  • 여러 가상 센서를 사용하는 자동화 테스트
  • Ethernet OTA 및 원격 장치 관리 검증
  • CI 기반 Modbus 통신 회귀 테스트

여러 대의 보드를 각각 온도, 압력, 유량 또는 설비 상태를 나타내는 장치로 설정하면 실제 생산설비 없이도 소규모 산업용 Ethernet 테스트 네트워크를 구성할 수 있습니다.


WIZnet Maker 내 관련 콘텐츠

ESP32-S3 Ethernet W5500 Modbus TCP Connect to Modbus Poll

ESP32-S3와 W5500에서 생성한 전압, 전류, 온도, 알람 값을 Modbus TCP로 전송하고 Modbus Poll에서 확인하는 프로젝트입니다.

https://maker.wiznet.io/gunn/projects/esp32-s3-ethernet-w5500-modbus-tcp-connect-to-modbus-poll/

ESP32 Modbus TCP/IP over Ethernet Using W5500

ESP32, W5500, Arduino IDE와 Modbus 라이브러리를 이용해 Modbus TCP Server를 구현하는 과정을 설명한 튜토리얼입니다.

https://maker.wiznet.io/bruno/projects/esp32-modbus-tcp-ip-over-ethernet-w5500-using-arduino-ide/

ESP32 Modbus W5500 Client

ESP32와 W5500을 이용해 TCP Port 502의 Modbus Server에 접속하는 간단한 Modbus TCP Client 예제입니다.

https://maker.wiznet.io/lawrence/projects/esp32-modbus-w5500/

STM32 and W5500 Modbus RTU-to-TCP Conversion

STM32와 W5500을 이용해 Modbus RTU와 Modbus TCP 네트워크를 연결하고, Modbus Slave와 Modbus Poll을 통해 통신을 검증한 프로젝트입니다.

https://maker.wiznet.io/chen/projects/stm32-w5500-for-modbus-rtu-and-modbus-tcp-conversion/


이 프로젝트의 차별점

기존 프로젝트들은 주로 Modbus TCP 통신, Client와 Server 구현 또는 RTU-to-TCP 프로토콜 변환에 초점을 맞춥니다.

반면 modbus_tcp_simulator는 실제 산업용 센서나 장비가 준비되지 않은 상황에서도 PLC, SCADA, HMI 및 데이터 수집 소프트웨어를 시험할 수 있도록 소프트웨어로 설정 가능한 가상 Modbus 장치를 구현합니다.

이 프로젝트는 FC04를 통한 가상 공정 데이터 제공, FC01과 FC05를 통한 Coil 읽기 및 제어, 온보드 LED를 이용한 출력 상태 확인, HTTP API 기반 원격 설정, Python CLI 기반 반복 테스트 자동화, Ethernet 기반 펌웨어 업데이트, DHCP 및 Static IPv4 설정 저장 기능을 포함합니다.

따라서 이 프로젝트는 단순한 Modbus TCP 통신 예제가 아니라, 재사용 가능한 Modbus TCP Device Simulator이자 산업용 소프트웨어 테스트 플랫폼이라는 점에서 차별화됩니다.


개발자가 참고해야 할 점

이 프로젝트는 산업 인증을 받은 상용 Modbus 계측기가 아니라 학습 및 테스트를 위한 시뮬레이터입니다.

또한 저장소의 README는 개발 순서와 목표 기능을 제시하지만, 실제 현장 배포 전에는 다음 항목을 별도로 검증해야 합니다.

  • 장시간 네트워크 연결 안정성
  • 동시에 처리 가능한 Modbus 클라이언트 수
  • 잘못된 패킷에 대한 예외 처리
  • OTA 인증 및 접근 제어
  • API 보안
  • 전원 장애 후 설정 복구
  • 실제 PLC 및 SCADA 제품과의 호환성

따라서 이 프로젝트의 가장 큰 가치는 완성된 산업용 제품이라기보다, ESP32-S3와 W5500을 이용해 재사용 가능한 Modbus TCP 테스트 노드를 구현하는 개발 레퍼런스에 있습니다.


결론

modbus_tcp_simulator는 W5500 Ethernet, Modbus TCP, OTA, HTTP API 및 Python 자동화를 하나의 ESP32-S3 플랫폼에 결합한 프로젝트입니다.

단순한 Ethernet 연결 예제에서 끝나지 않고, 실제 산업용 애플리케이션 개발 과정에서 필요한 테스트 장치의 구조를 보여준다는 점이 특징입니다. W5500을 통해 안정적인 유선 네트워크 경로를 확보하고, ESP32-S3가 가상 센서와 제어 출력을 제공함으로써 PLC, SCADA 및 산업용 소프트웨어를 실제 장비 없이도 검증할 수 있습니다.

 

Industrial automation software often needs to be tested before the actual sensors, controllers, or production equipment are available. PLC logic, SCADA screens, alarm conditions, and data-logging functions may all depend on Modbus devices that are difficult to reproduce during early development.

modbus_tcp_simulator is an ESP32-S3-based learning project designed to act as a configurable Modbus TCP test device. It uses the onboard W5500 Ethernet controller of the Waveshare ESP32-S3-ETH board to provide a wired network path and exposes simulated measurements and controllable output states over Modbus TCP.

Rather than demonstrating only a single Modbus request, the repository presents a staged development path covering Ethernet connectivity, OTA updates, simulated Modbus data, an HTTP API, a Python CLI, and persistent network configuration.


Target Hardware

The project targets the Waveshare ESP32-S3-ETH board with:

  • ESP32-S3R8 MCU
  • 8 MB PSRAM
  • W25Q128 16 MB external flash
  • Onboard W5500 10/100 Mbps Ethernet controller
  • WS2812 RGB LED connected to GPIO21

The W5500 provides the wired Ethernet interface used by the Modbus TCP service and the board-management functions.


What Problem Does It Solve?

Developers may encounter several limitations when building industrial Ethernet applications:

  • The real Modbus device is not yet available.
  • Physical sensor values are difficult to reproduce consistently.
  • Multiple devices are required to test PLC or SCADA configurations.
  • Installed devices are inconvenient to update through USB.
  • Both DHCP and static-IP deployment conditions must be tested.

The simulator turns a compact ESP32-S3 board into a software-configurable virtual industrial device that can be used throughout development and integration testing.


System Architecture

 
PLC / SCADA / HMI / Modbus Client
                │
           Modbus TCP
                │
        Ethernet Network
                │
             W5500
                │
            ESP32-S3
        ┌───────┴────────┐
 Simulated FC04 Data   FC01 / FC05 Coil
 Configurable Value     WS2812 LED
        │
 HTTP API / Python CLI / Ethernet OTA
 

A Modbus TCP client connects to the ESP32-S3 over the wired network. The W5500 forms the Ethernet interface between the MCU and the network, while the ESP32-S3 provides configurable measurement data and coil states.


Main Functions

Persistent DHCP and Static IPv4

The firmware can obtain its address through DHCP or retain a static IPv4 configuration.

This enables developers to test both flexible laboratory networks and fixed-address industrial networks where PLCs and supervisory systems expect each device to remain at a known address.

Simulated Modbus Measurements

A configurable measurement is exposed through Modbus function code FC04, Read Input Registers.

The board can therefore behave like a virtual temperature or process sensor even when no physical sensor is connected. PLC scaling, alarms, HMI displays, and logging applications can be tested against predictable values.

Coil Reading and Control

The onboard WS2812 LED is mapped to Modbus coil zero.

  • FC01 reads the coil state.
  • FC05 writes a single coil.

This provides a visible indication that a control request from the Modbus client has reached and changed the state of the target device.

Application OTA over Ethernet

The project includes a push-only application update mechanism over Ethernet, using port 8080.

For devices mounted in cabinets or remote test locations, this provides a more practical maintenance path than reconnecting a USB cable for every firmware update.

HTTP API and Python CLI

A versioned HTTP API and a Python standard-library CLI are used to manage tester boards.

This design allows test values and network settings to be changed from scripts, making the board suitable for repeatable test scenarios and multi-device automation.


The Role of W5500

The W5500 is more than a physical Ethernet connector in this design.

Wired Modbus TCP Transport

Requests from PLCs or Modbus clients and responses from the ESP32-S3 are transported through the W5500 Ethernet interface.

Reproducing Industrial Network Conditions

Industrial controllers commonly operate on wired networks with predictable addressing. W5500 enables the simulator to reproduce a wired deployment model rather than relying exclusively on Wi-Fi.

Shared Management and Data Path

Modbus TCP, the HTTP API, and application OTA all use the Ethernet connection. One wired interface can therefore support process-data simulation, configuration, and firmware maintenance.


Structured Learning Sequence

The repository organizes the project into the following stages:

  1. Connect W5500 Ethernet using DHCP.
  2. Add application updates over Ethernet.
  3. Expose simulated temperature through Modbus TCP.
  4. Configure and automate the Modbus tester.
  5. Manage persistent DHCP and static IPv4 settings.

This sequence helps developers understand how an Ethernet-enabled industrial node is built progressively instead of treating the final firmware as a black box.


Potential Applications

The project can serve as a foundation for:

  • PLC logic validation
  • SCADA and HMI development
  • Modbus TCP gateway testing
  • Industrial data-logger development
  • Commissioning and training environments
  • Automated testing with multiple virtual sensors
  • Ethernet OTA and remote-management validation
  • Modbus communication regression testing

Multiple boards could be configured to represent temperature, pressure, flow, or equipment-status devices, creating a compact industrial Ethernet test network without requiring the actual production equipment.


Verified Scope and Limitations

This is a learning and testing project, not a certified commercial Modbus instrument.

Before production deployment, developers should independently evaluate:

  • Long-term network stability
  • The number of simultaneous client connections
  • Malformed-packet handling
  • OTA authentication and access control
  • HTTP API security
  • Configuration recovery after a power interruption
  • Interoperability with the intended PLC and SCADA products

Its primary value is therefore as a reusable development reference showing how ESP32-S3 and W5500 can form a configurable Modbus TCP test node.


Conclusion

modbus_tcp_simulator combines W5500 Ethernet, Modbus TCP, OTA, an HTTP API, and Python-based automation on a single ESP32-S3 platform.

The project goes beyond basic Ethernet connectivity by addressing a practical industrial-development problem: testing PLC, SCADA, and data-acquisition software before the real field devices are available. W5500 provides the wired network path, while ESP32-S3 simulates process data and controllable outputs, creating a compact and reusable industrial Ethernet testing platform.


Frequently Asked Questions

What is the ESP32-S3 Modbus TCP Simulator?

The ESP32-S3 Modbus TCP Simulator is a compact development and testing device that emulates industrial Modbus TCP sensors and digital outputs. It allows developers to test PLC, SCADA, HMI, and data-acquisition software without connecting actual field equipment.

What hardware does the project use?

The project targets the Waveshare ESP32-S3-ETH board, which combines an ESP32-S3 microcontroller with an onboard WIZnet W5500 10/100 Mbps Ethernet controller.

What is the role of the W5500?

The W5500 provides the ESP32-S3 with a wired Ethernet interface. It carries Modbus TCP requests and responses between the simulator and a PLC, SCADA system, HMI, or PC-based Modbus client.

Which Modbus function codes are supported?

The project uses FC04 for reading simulated input-register values, FC01 for reading a Coil, and FC05 for controlling a single Coil.

What does the simulator emulate?

The simulator can expose a configurable virtual measurement, such as temperature, through Modbus Input Registers. It also maps a Modbus Coil to the onboard WS2812 LED so that control commands can be confirmed visually.

Can the simulated sensor value be changed remotely?

Yes. The project includes a versioned HTTP API and a Python command-line interface that can be used to configure the simulator and automate test scenarios.

Does the project support Ethernet firmware updates?

Yes. The project includes an application-update mechanism that transfers firmware through the Ethernet network without requiring a direct USB connection for every update.

Does it support both DHCP and Static IP addresses?

Yes. The intended firmware structure supports DHCP and persistent Static IPv4 configuration, allowing the device to be tested in both laboratory and fixed-address industrial networks.

Why use Ethernet instead of Wi-Fi for Modbus TCP testing?

Industrial controllers commonly operate on wired networks with fixed or predictable addressing. Ethernet allows the simulator to reproduce an environment closer to the network conditions used by PLCs, SCADA systems, and industrial gateways.

Can this project replace a certified industrial Modbus device?

No. It is a learning and development platform rather than a certified commercial instrument. Network stability, security, interoperability, and long-term operation should be independently validated before production deployment.

What can developers test with this simulator?

Developers can use it to test PLC logic, HMI screens, SCADA alarms, register scaling, Coil control, Modbus Client software, data logging, Ethernet OTA, and automated regression-test scenarios.

What makes this project different from a basic Modbus TCP example?

A basic example normally demonstrates only register reading or writing. This project combines virtual measurements, Coil control, an HTTP API, a Python CLI, Ethernet firmware updates, and persistent network configuration in one reusable testing platform.

Documents
Comments Write