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
[English Version]
[Analyst's Note: The 2.0 Discovery]
From "Converter" to "Controller" Our initial look labeled this as a solid Modbus Gateway. However, a deeper code inspection (task_http_server.c, bacnet.c) revealed its true value. It is an intelligent, Web-Controlled System.
Feature Discovery: HTTPD: It runs a lightweight HTTP Server, allowing users to configure IP and Serial settings directly via a web browser—no dedicated software required.
Native BACnet Binding: It maps physical GPIOs directly to BACnet Binary Input objects, effectively turning the gateway into a remote I/O block for Building Automation Systems (BAS).
Source Mention
Original Project by hyacinthxinxin on GitHub This project was originally published on Oct 2025 by FanXin.
1. Web-Based Configuration (No Drivers Required)
Visual Preview:
Figure 1: The Serial Port Configuration Page (port0.html). Notice the comprehensive Modbus mode selection (TCP<->RTU/ASCII).
Figure 2: The KNX Lighting Control Page (knx.html). A clean, dashboard-style UI for testing Binary Outputs.
Embedded Web Server Implementation: Instead of proprietary "Config Tools," this project utilizes the W5500's independent sockets to run a persistent Web Server. The firmware (html_pages.h) explicitly hosts full HTML pages like index.html (Device Status), port0.html (Serial Settings), and even knx.html (Light Control).
Network Settings: IP, Gateway, Subnet via config.cgi
Serial Parameters: Baud rate (1200-115200), Parity via config0.cgi
Code Insight: The cgi_http_config and cgi_serial_config functions handle these POST requests and commit them to Flash memory.
Why WIZnet? (Hardware Socket Isolation):
Running Modbus TCP, BACnet/IP, and an HTTP Server simultaneously typically imposes a context-switching penalty on the MCU. The W5500 manages TCP/IP states in hardware. This allows the simple STM32F103 to serve web requests (Control Plane) while maintaining deterministic industrial protocol loops (Data Plane) without jitter.
2. Protocol Integration: BACnet & I/O
Direct GPIO-Object Mapping: In bacnet.c, the code actively monitors the board's buttons/sensors (BI_Update_From_GPIO). These inputs are exposed as standard BACnet Binary Input Objects.
Interoperability for Smart Buildings: This allows any Building Management System (BMS) to poll the status of switches or sensors connected to this gateway instantly via the BACnet protocol, functioning as a "Gateway + Remote I/O" combo device.
3. Technical Architecture
Concurrency Logic:
Socket 0 (HTTP): Configuration Interface
Socket 2 (Modbus TCP): Serial Tunneling (RS485)
Socket 4 (BACnet/IP): Object Control (Smart Building)
4. Technical Verification (Fact Check)
The "MT" Identity & Origin:
Developer Identified: The git logs confirm the author is FanXin (fanxin0202@163.com), a Chinese developer.
"MTControl Team": This appears to be a personal branding or small team alias used by FanXin, rather than a large corporation. The "1998-2025" copyright in the header is likely a stylistic choice to imply longevity.
Conclusion: This is a high-quality individual/community project from China, unrelated to the Chilean "MT Solutions". The "MT" likely refers to "Module/Modbus Technology" or simply "Micro-Technology".
Web Persistence: Unique functions like write_http_config_to_flash in wiz_interface.c demonstrate the intent to save user configurations permanently (Note: Flash write implementation is prepared but currently commented out in the repo).
BACnet Mapping: Line 97 of bacnet.c (BI_Update_From_GPIO) explicitly binds the board's physical keys to BACnet Binary Input objects.
5. Conclusion
Implementation Maturity: This project demonstrates a high level of completeness. With its web interface and protocol integration, it represents a commercial-grade architecture rather than a prototype.
6.
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.
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.
[Korean Version]
[분석가 노트: 2.0의 발견 - 변환기를 넘어 컨트롤러로]
변환기를 넘어선 지능형 컨트롤러 처음에는 이 프로젝트를 견고한 Modbus 게이트웨이로만 보았습니다. 하지만 코드(task_http_server.c, bacnet.c)를 심층 분석한 결과 진짜 가치를 발견했습니다. 이것은 단순한 변환기가 아니라, 웹으로 제어되는 시스템입니다.
기능 발견: HTTPD: 경량 HTTP 서버를 내장하여, 사용자가 전용 소프트웨어 없이 웹 브라우저만으로 IP와 시리얼 설정을 변경할 수 있습니다.
네이티브 BACnet 바인딩: 물리적 GPIO를 BACnet Binary Input 객체에 직접 매핑하여, 게이트웨이 자체를 빌딩 자동화 시스템(BAS)의 원격 I/O 블록으로 활용할 수 있게 합니다.
원문 출처 (Source Mention)
Original Project by FanXin on GitHub 이 프로젝트는 2025년 10월 FanXin 님에 의해 GitHub에 게시되었습니다
1. 웹 기반 설정 (드라이버 불필요)
비주얼 프리뷰 (Visual Preview):
Figure 1: 시리얼 포트 설정 페이지 (port0.html). 모드버스 모드(TCP<->RTU/ASCII) 변환 기능이 상세히 구현되어 있습니다.
Figure 2: KNX 조명 제어 페이지 (knx.html). 직관적인 대시보드 형태의 UI를 제공합니다.
임베디드 웹 서버 구현: 전용 설정 툴을 배제하고 W5500의 독립 소켓을 활용해 웹 서버를 구동합니다. 펌웨어(html_pages.h) 내에 index.html(상태), port0.html(시리얼 설정), knx.html(조명 제어) 등 실제 웹 페이지 코드가 내장되어 있어, 브라우저만으로 즉시 제어가 가능합니다.
코드 인사이트: cgi_http_config 함수가 action='config.cgi'로 들어오는 POST 요청을 처리하며, 플래시 메모리에 저장을 시도하는 구조를 갖추고 있습니다.
왜 WIZnet인가? (하드웨어 소켓 격리):
Modbus TCP, BACnet/IP, HTTP 서버를 동시 구동하면 MCU에 문맥 교환(Context Switching) 부하가 발생합니다. W5500은 TCP/IP 상태를 하드웨어에서 관리합니다. 덕분에 STM32F103은 웹 요청(제어 평면)을 처리하면서도 산업용 프로토콜(데이터 평면)의 실시간성을 보장할 수 있습니다.
2. 프로토콜 통합: BACnet & I/O
직접 GPIO-객체 매핑: bacnet.c 코드는 보드의 버튼 상태를 모니터링하여, 표준 BACnet Binary Input 객체로 노출시킵니다.
스마트 빌딩 상호운용성: 빌딩 관리 시스템(BMS)이 이 게이트웨이를 통해 스위치나 센서 상태를 즉시 폴링(Polling)할 수 있어, "게이트웨이 + 원격 I/O" 기기로 동작합니다.
3. 기술 아키텍처 (Technical Architecture)
동시성 로직 (Concurrency):
소켓 0 (HTTP): 설정 인터페이스
소켓 2 (Modbus TCP): 시리얼 터널링 (RS485)
소켓 4 (BACnet/IP): 객체 제어 (스마트 빌딩)
4. 기술 검증 (Fact Check)
MT(Modbus Tech)의 정체:
개발자 확인: Git 로그 분석 결과, 작성자는 중국의 개발자 FanXin 님으로 확인되었습니다.
"MTControl Team": 헤더에 적힌 팀명은 기업 브랜드가 아닌 개인 브랜드 또는 소규모 팀의 명칭으로 파악됩니다. 기업 제품은 아니지만, 상용 제품에 준하는 기능과 완성도를 갖춘 고품질의 프로젝트입니다.
웹 설정 저장: wiz_interface.c에 write_http_config_to_flash 함수가 정의되어 있어 설정 영구 저장 의도를 확인했습니다. (현재 레포지토리 코드상 실제 Flash 쓰기 루프는 주석 처리되어 있음)
BACnet 매핑: bacnet.c의 97번 라인(BI_Update_From_GPIO)은 물리적 입력을 BACnet 객체와 직접 바인딩하는 코드입니다.
5. 마무리 (Conclusion)
구현 완성도: 이 프로젝트는 높은 수준의 완성도를 보여줍니다. 웹 인터페이스와 프로토콜 통합 구조는 단순 프로토타입을 넘어 상용 등급의 아키텍처를 지향하고 있습니다.
6. 향후 기대 효과
스마트 빌딩으로의 확장: 내장된 BACnet/IP 스택 덕분에, 이 게이트웨이는 추가 하드웨어 없이 스마트 빌딩 프로젝트(HVAC, 조명 제어)에 즉시 투입될 수 있습니다.
클라우드 통합 (AIoT): MQTT 지원은 AIoT 통합을 위한 길을 열어줍니다. Modbus를 통해 수집된 산업 데이터는 클라우드 플랫폼으로 전송되어 AI 기반 이상 탐지나 예지 보전에 활용될 수 있습니다.