Enhancing Bidirectional Modbus TCP ↔ RTU Gateway Performance: A UDP Mechanism and Markov Chain Approach
Abstract
:1. Introduction
- Utilizing the connectionless nature of UDP to dramatically reduce data transfer delays on the Ethernet side of the Modbus gateway in weak network conditions.
- Adopting Markov chain model to analyze Modbus UDP transmission in depth, and proposing an improved UDP protocol, AUDP, i.e., add retransmission, data checking, and confirmation mechanism in the UDP application layer to improve the reliability of UDP transmission itself appropriately.
- Develop a Modbus AUDP and Modbus RTU protocol conversion module, design a Modbus AUDP to Modbus RTU experimental gateway, and conduct data transmission verification tests.
- Analyze and compare the test data using the Markov chain model to verify the performance of the experimental gateway, especially under weak network conditions.
2. Related Works
2.1. Modbus Gateway
2.2. Temporal Properties
2.3. Markov Chain
3. System Design and Implementation
3.1. Overall Architecture
3.2. Hardware Design
- USART to RS48 Module: This is used to convert between USART signals and RS485 bus differential signals to realize the transmission between STM32 microcontroller and RS485 bus.
- USART Module: This is composed of a software FIFO buffer, USART3 peripheral, and interrupt service mechanism. The data is captured in real-time via receive completion interrupt and stored in the FIFO. Frame termination is determined using idle interrupt. The main loop asynchronously reads FIFO data for protocol parsing/processing, enabling transceiver status monitoring and data flow scheduling.
- TIMER2: This utilizes TIM2 to configure the auto-reload value (ARR) and prescaler (PSC) to generate timeout interrupts. It detects the end of a Modbus RTU frame transmission by measuring a 3.5-character time interval.
- SPI Module: It comprises a SPI interface (Mode 0, 8-bit frame @18 MHz) and SPI-DMA driver with double buffering. It enables zero-CPU-overhead full-duplex data transfer between STM32 and W5500 through cyclic DMA channel configuration.
- W5500 Register Configuration Module: The physical layer (PHY) configuration and interrupt enable of W5500 is realized through the configuration of W5500-related registers by STM32.
- Data-Processing Module: It performs CRC-16 validation and bidirectional Modbus AUDP/Modbus RTU protocol conversion.
- Interrupt Management Module: It handles centralized interrupt events (e.g., USART idle, SPI transfer complete, and W5500 status) with priority-based response logic via NVIC, ensuring the timely clearing of interrupt flags through hardware-level register operations.
3.2.1. STM32 Minimum System Schematic
3.2.2. Power Supply Module
3.2.3. Interface Conversion Module
3.3. Software Design
3.3.1. UDP Communication
3.3.2. Implementation of the AUDP Mechanism
- Analysis of UDP Validation Mechanism
- Analysis of Retransmission Mechanism
- Analysis of Transaction ID Matching Mechanism
- Analysis of Transaction ID Matching Mechanism
3.3.3. Protocol Conversion Design
3.3.4. Implementation of the Host-Side Software
4. Experimental Results and Analysis
4.1. Request–Response Latency and Average Latency Modeling
4.2. Comparison of TCP-Based and UDP-Based Transmission on the Network-Side
4.3. Modbus AUDP Gateway Analysis
4.4. Network-Side Comparison of AUDP-Based and UDP/TCP-Based Transmission
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Calderón, D.; Folgado, F.J.; González, I.; Calderón, A.J. Implementation and Experimental Application of Industrial IoT Architecture Using Automation and IoT Hardware/Software. Sensors 2024, 24, 8074. [Google Scholar] [CrossRef] [PubMed]
- Bożek, A.; Rzonca, D. Communication Time Optimization of Register-Based Data Transfer. Electronics 2023, 12, 4917. [Google Scholar] [CrossRef]
- Elamanov, S.; Son, H.; Flynn, B.; Yoo, S.K.; Dilshad, N.; Song, J. Interworking between Modbus and internet of things platform for industrial services. Digit. Commun. Netw. 2024, 10, 461–471. [Google Scholar] [CrossRef]
- Martins, T.; Oliveira, S.V.G. Enhanced Modbus/TCP Security Protocol: Authentication and Authorization Functions Supported. Sensors 2022, 22, 8024. [Google Scholar] [CrossRef] [PubMed]
- Figueroa-Lorenzo, S.; Añorga, J.; Arrizabalaga, S. A Role-Based Access Control Model in Modbus SCADA Systems. A Centralized Model Approach. Sensors 2019, 19, 4455. [Google Scholar] [CrossRef]
- Găitan, V.G.; Zagan, I. Experimental Implementation and Performance Evaluation of an IoT Access Gateway for the Modbus Extension. Sensors 2021, 21, 246. [Google Scholar] [CrossRef]
- Lin, M.-Y.; Chen, C.-H.; Dong, Z.-B.; Chen, C.-C. Gigabit Modbus user datagram protocol fieldbus network integrated with industrial vision communication. Microprocess. Microsyst. 2022, 94, 104682. [Google Scholar] [CrossRef]
- Pandey, B.; Farulla, G.A.; Indaco, M.; Iovino, L.; Prinetto, P. Design and review of water management system using ethernet, Wi-Fi 802.11 n, modbus, and other communication standards. Wirel. Pers. Commun. 2019, 106, 1677–1699. [Google Scholar] [CrossRef]
- Hao, Z.; Asadullah, A.; Wawale, S.; Das, S. Application of modbus double-layer communication network technology in intelligent management of urban traffic equipment. Int. J. Syst. Assur. Eng. Manag. 2022, 13, 197–202. [Google Scholar] [CrossRef]
- Lorincz, J.; Klarin, Z.; Ožegović, J. A Comprehensive Overview of TCP Congestion Control in 5G Networks: Research Challenges and Future Perspectives. Sensors 2021, 21, 4510. [Google Scholar] [CrossRef]
- Lu, S.; Liming, W. Design of embedded system for high-speed data transmission in distributed testing based on UDP/IP protocol. Nucl. Electron. Detect. Technol. 2014, 34, 750–753+779. [Google Scholar] [CrossRef]
- Yu, X.; Gan, W.y.; Chu, Z.z. Design and implementation of Modbus UDP based AUV control system. Proc. SPIE 2023, 12940, 8. [Google Scholar] [CrossRef]
- Park, T.; Lee, K. Supporting ultra-low latency mixed-criticality communication using hardware-based data plane architecture. J. Netw. Comput. Appl. 2022, 204, 103401. [Google Scholar] [CrossRef]
- Gao, M.; Wan, L.; Shen, R.; Gao, Y.; Wang, J.; Li, Y.; Vucetic, B. SparkLink: A short-range wireless communication protocol with ultra-low latency and ultra-high reliability. Innovation 2023, 4, 100386. [Google Scholar] [CrossRef] [PubMed]
- Chi, H.R.; Wu, C.K.; Huang, N.F.; Tsang, K.F.; Radwan, A. A survey of network automation for industrial internet-of-things toward industry 5.0. IEEE Trans. Ind. Inform. 2022, 19, 2065–2077. [Google Scholar] [CrossRef]
- Zheng, H.; Boyce, J. An improved UDP protocol for video transmission over internet-to-wireless networks. IEEE Trans. Multimed. 2001, 3, 356–365. [Google Scholar] [CrossRef]
- Pai, V.U.; Mehta, N.B.; Singh, C. Novel Insights From a Cross-Layer Analysis of TCP and UDP Traffic Over Full-Duplex WLANs. IEEE Trans. Mob. Comput. 2025, 24, 3288–3301. [Google Scholar] [CrossRef]
- Mahmoodi Khaniabadi, S.; Javadpour, A.; Gheisari, M.; Zhang, W.; Liu, Y.; Sangaiah, A.K. An intelligent sustainable efficient transmission internet protocol to switch between User Datagram Protocol and Transmission Control Protocol in IoT computing. Expert Syst. 2023, 40, e13129. [Google Scholar] [CrossRef]
- Chen, C.-Y.; Wu, S.-H.; Huang, B.-W.; Huang, C.-H.; Yang, C.-F. Web-based Internet of Things on environmental and lighting control and monitoring system using node-RED, MQTT and Modbus communications within embedded Linux platform. Internet Things 2024, 27, 101305. [Google Scholar] [CrossRef]
- Tamboli, S.; Rawale, M.; Thoraiet, R.; Agashe, S. Implementation of Modbus RTU and Modbus TCP communication using Siemens S7-1200 PLC for batch process. In Proceedings of the 2015 International Conference on Smart Technologies and Management for Computing, Communication, Controls, Energy and Materials (ICSTM), Avadi, India, 6–8 May 2015; pp. 258–263. [Google Scholar] [CrossRef]
- Cheng, C.; Huiming, W.; Hongling, L. Design of embedded gateway for Modbus protocol based on STM32F107 platform. Intergrated Circuit Embed. Syst. 2018, 18, 48–52. [Google Scholar]
- Sharma, A.; Airan, S.; Shah, D. Designing C Library for MODBUS-RTU to CANBUS and MODBUS-TCP IOT Converters. In Proceedings of the 2021 Second International Conference on Electronics and Sustainable Communication Systems (ICESC), Coimbatore, India, 4–6 August 2021; pp. 731–737. [Google Scholar] [CrossRef]
- Korodi, A.; Silea, I. Achieving interoperability using low-cost middleware OPC UA wrapping structure. Case study in the water industry. In Proceedings of the 2017 IEEE 15th International Conference on Industrial Informatics (INDIN), Emden, Germany, 24–26 July 2017; pp. 1223–1228. [Google Scholar] [CrossRef]
- Ma, T.; Yu, H.; Peng, D.; Sun, H. Design of a Modbus TCP-MQTT Protocol Conversion Gateway Based on Dual-Line Ethernet. Appl. Electron. Tech. 2023, 49, 108–113. [Google Scholar] [CrossRef]
- Sacoto Cabrera, E.J.; Palaguachi, S.; León-Paredes, G.A.; Gallegos-Segovia, P.L.; Bravo-Quezada, O.G. Industrial Communication Based on MQTT and Modbus Communication Applied in a Meteorological Network. Available online: https://link.springer.com/chapter/10.1007/978-3-030-63665-4_3 (accessed on 15 June 2025).
- Tong, W.; Zhang, E.; Shen, J.; Jiang, W.; Li, Z. Modelling and Conversion of Heterogeneous Modbus Protocols Based on UML and MySQL. In Proceedings of the 2024 4th International Conference on Artificial Intelligence, Big Data and Algorithms, Zhengzhou, China, 21–23 June 2024; pp. 654–660. [Google Scholar] [CrossRef]
- Vekslerchik, V.E.; Melnik, S.S.; Pritula, G.M.; Usatenko, O.V. Correlation Properties of Additive Linear High-Order Markov Chains. In Proceedings of the 2018 9th International Conference on Ultrawideband and Ultrashort Impulse Signals (UWBUSIS), Odessa, Ukraine, 4–7 September 2018; pp. 150–155. [Google Scholar] [CrossRef]
- Kuntz, J.; Thomas, P.; Stan, G.B.; Barahona, M. Stationary distributions of continuous-time Markov chains: A review of theory and truncation-based approximations. Siam Rev. 2021, 63, 3–64. [Google Scholar] [CrossRef]
- Mo, H.; Sansavini, G. Hidden Markov model-based smith predictor for the mitigation of the impact of communication delays in wide-area power systems. Appl. Math. Model. 2021, 89, 19–48. [Google Scholar] [CrossRef]
- Bishop, J.; Axon, C. Using natural driving experiments and Markov chains to develop realistic driving cycles. Transp. Res. Part 2024, 137, 104507. [Google Scholar] [CrossRef]
- Fei, Z.; Wu, Z.; Zhao, X.; Zong, G.; Lin-Shi, X. Reachability-Guaranteed Sliding-Mode Control for Asynchronously Switched Uncertain Systems. IEEE Trans. Autom. Control 2025, 70, 921–932. [Google Scholar] [CrossRef]
1 | 24.7% | 6.2% | 23.55% | 23.19% | 5.82% | 0.36% | 93.84% |
2 | 23.5% | 1.3% | 23.62% | 23.54% | 5.55% | 0.07% | 94.4% |
3 | 23.8% | 0.3% | 23.61% | 23.58% | 5.64% | 0.02% | 94.39% |
4 | 24.9% | 0.2% | 23.55% | 23.53% | 5.82% | 0.01% | 94.18% |
5 | 24.8% | 0.2% | 23.55% | 23.53% | 5.85% | 0.01% | 94.18% |
6 | 25.6% | 0.1% | 23.50% | 23.49% | 6.02% | 0.006% | 93.99% |
Configuration | |||
---|---|---|---|
NMMS_ | 0.8532 | 0.1468 | 20.55% |
NMMS_ | 0.9030 | 0.0970 | 13.57% |
NMMS_ | 0.9032 | 0.0968 | 13.55% |
NMMS_ | 0.8602 | 0.1380 | 19.30% |
NMMS_ | 0.9033 | 0.0967 | 13.53% |
NMMS_ | 0.8607 | 0.1393 | 19.50% |
Comprehensive Score () | Ranking | |
---|---|---|
1 | 0.1802 | 6 |
2 | 0.9462 | 1 |
3 | 0.9319 | 2 |
4 | 0.6559 | 3 |
5 | 0.6633 | 4 |
6 | 0.4374 | 5 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhao, S.; Zhang, Q.; Zhao, Q.; Zhang, X.; Guo, Y.; Lu, S.; Song, L.; Zhao, Z. Enhancing Bidirectional Modbus TCP ↔ RTU Gateway Performance: A UDP Mechanism and Markov Chain Approach. Sensors 2025, 25, 3861. https://doi.org/10.3390/s25133861
Zhao S, Zhang Q, Zhao Q, Zhang X, Guo Y, Lu S, Song L, Zhao Z. Enhancing Bidirectional Modbus TCP ↔ RTU Gateway Performance: A UDP Mechanism and Markov Chain Approach. Sensors. 2025; 25(13):3861. https://doi.org/10.3390/s25133861
Chicago/Turabian StyleZhao, Shuang, Qinghai Zhang, Qingjian Zhao, Xiaoqian Zhang, Yang Guo, Shilei Lu, Liqiang Song, and Zhengxu Zhao. 2025. "Enhancing Bidirectional Modbus TCP ↔ RTU Gateway Performance: A UDP Mechanism and Markov Chain Approach" Sensors 25, no. 13: 3861. https://doi.org/10.3390/s25133861
APA StyleZhao, S., Zhang, Q., Zhao, Q., Zhang, X., Guo, Y., Lu, S., Song, L., & Zhao, Z. (2025). Enhancing Bidirectional Modbus TCP ↔ RTU Gateway Performance: A UDP Mechanism and Markov Chain Approach. Sensors, 25(13), 3861. https://doi.org/10.3390/s25133861