Industrial gateway solution based on STM32 and W5500, supporting multiple protocols (Modbus TCP/RTU/ASCII, BACnet/IP, MQTT) for building automation and IIoT.
COMPONENTSHardware components
WIZnet - W5500-EVB
x 1
STMicroelectronics - STM32F103RCT6
x 1
PROJECT DESCRIPTION
[Analyst's Note: Unveiling 'Sbasi']
Code Analysis & Investigation Result
Upon analyzing the repository, which lacks a README, we conducted a deep dive into the source code (config.h, task_serial_server.c) and author background.
'Sbasi': Confirmed as a unique project codename by the developer, likely standing for a specific internal identifier.
'MTGateway': Stands for Multi-Protocol Gateway (or Modbus TCP Gateway).
Findings: The code reveals a highly sophisticated implementation supporting Modbus (TCP/RTU/ASCII), BACnet/IP, and MQTT, proving it to be a high-level industrial project by a skilled embedded engineer.
분석가 노트: README가 없는 이 프로젝트를 분석하기 위해 소스 코드와 작성자를 심층 조사했습니다.
발견: 코드는 Modbus (TCP/RTU/ASCII), BACnet/IP, MQTT를 모두 지원하는 매우 정교한 구현을 담고 있으며, 이는 숙련된 임베디드 엔지니어의 작품임을 증명합니다.
[Source Mention]
Original Project by hyacinthxinxin on GitHub
This project was originally published on Oct 2025 by hyacinthxinxin. (이 프로젝트는 2025년 10월 hyacinthxinxin에 의해 GitHub에 게시되었습니다.)
1. Introduction (소개)
Overview: The MTGateway is an all-in-one industrial protocol converter designed to bridge legacy serial devices (RS485) with modern Ethernet networks. Powered by STM32 and WIZnet W5500, it seamlessly converts data between Modbus RTU/ASCII and Modbus TCP, and even supports BACnet/IP for building automation and MQTT for cloud connectivity.
MTGateway는 레거시 시리얼 장치(RS485)를 최신 이더넷 네트워크와 연결하기 위해 설계된 올인원 산업용 프로토콜 변환기입니다. STM32와 WIZnet W5500을 기반으로 Modbus RTU/ASCII와 Modbus TCP 간의 데이터를 매끄럽게 변환하며, 빌딩 자동화를 위한 BACnet/IP와 클라우드 연결을 위한 MQTT까지 지원합니다.
Why WIZnet? (Developer's Perspective): Stability in Protocol Conversion (External Value): In industrial gateways, timing and stability are critical. Software-based TCP/IP stacks can introduce jitter or crashes under heavy load, which is fatal for protocols like Modbus or BACnet. The W5500 handles the TCP/IP stack in hardware, freeing up the STM32 to focus entirely on the complex logic of protocol conversion. This architecture ensures deterministic performance and industrial-grade reliability.
프로토콜 변환에서의 안정성 (외부 가치) 산업용 게이트웨이에서는 타이밍과 안정성이 매우 중요합니다. 소프트웨어 기반 TCP/IP 스택은 부하가 걸리면 지터(Jitter)나 충돌을 유발할 수 있으며, 이는 Modbus나 BACnet 같은 프로토콜에 치명적입니다. W5500은 하드웨어에서 TCP/IP 스택을 처리하여, STM32가 복잡한 프로토콜 변환 로직에만 집중할 수 있게 해줍니다. 이러한 아키텍처는 결정론적 성능과 산업 등급의 신뢰성을 보장합니다.
2. Technical Deep Dive (기술 심층 분석)
Multi-Protocol Architecture: The system is architected to handle multiple sockets simultaneously via W5500, assigning specific roles to each:
Socket 0: DHCP Client
Socket 2 (Port 502): Modbus TCP Server (converts to Serial RTU/ASCII)
Socket 4 (Port 47808): BACnet/IP Agent
Socket 5: MQTT Client (Future expansion)
Code Insight (Modbus Logic): The task_serial_server.c handles the core translation logic. It checks the configuration (SERIAL_DATA_CONV) and automatically converts packets between TCP, RTU, and ASCII formats.
코드 인사이트: task_serial_server.c는 핵심 변환 로직을 담당합니다. 설정(SERIAL_DATA_CONV)을 확인하고 TCP, RTU, ASCII 포맷 간의 패킷을 자동으로 변환합니다.
3. Future Expectations (향후 기대 효과)
Expansion to Smart Buildings: With the built-in BACnet/IP stack, this gateway is ready to be deployed in smart building projects (HVAC, Lighting control) without additional hardware.
스마트 빌딩으로의 확장: 내장된 BACnet/IP 스택 덕분에, 이 게이트웨이는 추가 하드웨어 없이 스마트 빌딩 프로젝트(HVAC, 조명 제어)에 즉시 투입될 수 있습니다.
Cloud Integration (AIoT): The MQTT support paves the way for AIoT integration. Industrial data collected via Modbus can be published to cloud platforms (AWS, Azure) for AI-based anomaly detection or predictive maintenance.
클라우드 통합 (AIoT): MQTT 지원은 AIoT 통합을 위한 길을 열어줍니다. Modbus를 통해 수집된 산업 데이터는 클라우드 플랫폼으로 전송되어 AI 기반 이상 탐지나 예지 보전에 활용될 수 있습니다.
4. Conclusion (마무리)
Summary: This project is a hidden gem that demonstrates how a single W5500 chip can empower a microcontroller to become a versatile industrial gateway. It perfectly aligns with the trend of IT/OT Convergence.
이 프로젝트는 단 하나의 W5500 칩이 마이크로컨트롤러를 다재다능한 산업용 게이트웨이로 변모시키는 방법을 보여주는 숨은 보석과 같습니다. 이는 IT/OT 융합이라는 최신 트렌드에 완벽하게 부합합니다.