摘 要: 随着计算机技术的不断发展,物联网设备的远控技术在实现上变得更加快捷。其中,串口是当前嵌入 式数据传输技术的一种主流通讯方式,它有着协议简单,支持全双工传输等特点。本文针对常用的RS232串口,基于 Websocket协议,使用支持跨平台的网络库libevent和串口库Serial Communication Library,研究并实现了Websocket 与RS232之间的数据中转。接着基于Web前端HTML5标准的Websocket特性及相关UI框架,实现了Web与RS232之间数 据的异地操作与传输,将串口数据实时绘制为网页图表并最终验证了该系统设计的有效性与可扩展性。 |
关键词: 物联网;远程控制;串口通讯;Websocket |
中图分类号: TP311
文献标识码: A
|
基金项目: 湘南学院2017年度校级实验室开放项目(编号31). |
|
Research on the Serial Port Control System Based on Websocket |
ZHANG Hongqiao,JIANG Hu,ZENG Xiaohua,DUAN Lingfei
|
( College of Electronic Information and Electrical Engineering, Xiangnan University, Chenzhou 423000, China)
|
Abstract: With the development of computer technology,it becomes more efficient to implement the remote control techniques on the devices of Internet of Things.The serial port is a main method of data transmission for embedded devices,with the characteristics of simple protocol and good support for full duplex transmission.Aiming at the serial port type of RS232,this paper studies the research and implementation of data transfer between Websocket and RS232 by using the cross-platform network library of libevent and the serial port library of Serial Communication Library.Then,based on the Websocket characteristics of HTML5 and Echarts Library of Web UI framework,it realizes the remote operation and data transmission between Web and RS232,and renders the serial port data on a web page graph in real time.Finally,the validity and extensibility of the proposed system are verified. |
Keywords: Internet of Things;remote control;serial port communication;Websocket |