《电子技术应用》
您所在的位置:首页 > 嵌入式技术 > 设计应用 > 基于ESP32嵌入式Web服务器的手机化仪表设计
基于ESP32嵌入式Web服务器的手机化仪表设计
电子技术应用
丁依,何岭松
华中科技大学 机械科学与工程学院
摘要: 随着物联网技术的发展,单片机性能升级且功能变得丰富,利用单片机创建Web服务器,使用浏览器作为客户端进行访问变得可行。借鉴其思路,提出一种嵌入式Web服务器+浏览器架构的无软件化手机仪表设计方法。先用JavaScript语言将常用的手机仪表元素设计为一个能嵌入到单片机存储系统中的50 KB大小的库,然后在其基础上形成C风格手机仪表HTML网页生成函数,最后再通过单片机Web服务器将封装后的C风格手机仪表HTML网页生成函数转换为手机浏览器支持的HTML网页进行显示和用户操作。该设计实现将仪表软件安装在下位机,客户端零安装、零配置访问仪表界面。
中图分类号:TP311.1 文献标志码:A DOI: 10.16157/j.issn.0258-7998.256290
中文引用格式: 丁依,何岭松. 基于ESP32嵌入式Web服务器的手机化仪表设计[J]. 电子技术应用,2025,51(11):107-115.
英文引用格式: Ding Yi,He Lingsong. Design of mobile phone instrument based on ESP32 embedded Web server[J]. Application of Electronic Technique,2025,51(11):107-115.
Design of mobile phone instrument based on ESP32 embedded Web server
Ding Yi,He Lingsong
School of Mechanical Science and Engineering, Huazhong University of Science and Technology
Abstract: With the development of Internet of Things technology, the performance of the single-chip microcontroller has been upgraded and the functions have become rich, and it has become feasible to use the single-chip microcontroller to create a web server and use the browser as a client to access. Drawing on its ideas, a mobile phone instrument design method that does not require software installation based on embedded Web server + browser architecture was proposed. First, the JavaScript language is used to design the commonly used mobile phone instrument elements as a 50KB library that can be embedded in the storage system of single-chip microcontroller. Then, on the basis of it, the C-style mobile phone instrument HTML web page generation function is formed. Finally, through the single-chip microcomputer web server, the encapsulated C-style mobile phone instrument HTML web page generation function is converted into the HTML web page supported by the mobile phone browser for display and user operation. It realizes the function of installing the instrument software on the lower computer, and accessing the instrument interface with zero installation and zero configuration on the client.
Key words : embedded;web server;mobile phone instrument;browser;JavaScript program;instrument library

引言

随着社会需求不断地信息化、自动化和智能化,基于单片机设计的智能仪表在不同领域中都发挥着重要作用[1-3]。目前主流的智能仪表大多需要在显示模块上预装APP后才能使用[4-5],对安装平台也有一定的要求[6],当下位机仪器被更换时,需要重装软件进行适配,较为繁琐,或者存在整个仪表的集成度太高导致二次开发的学习成本较大等问题,例如东辉的DY2000系列智能仪表,通常使用LCD、LED或OLED显示屏作为显示模块,界面设计简洁而直观,但显示的内容有限且更改较为困难,用户在某些应用场景下可能无法找到合适的功能设置;德能的智能水表采用蓝牙技术与手机连接的设计模式,仪表界面更加丰富,实现了“抄表不入户,缴费不出门”的智能供水服务,但需要下载并安装APP后才能使用。随着物联网技术的迅速发展,目前许多单片机都集成了ESP32、ESP8266等Wi-Fi通信模块,且ESP32的大部分性能优于ESP8266[7-8],能够轻松地在下位机运行嵌入式Web服务器,实现网页托管与访问等功能,网上已经有了许多应用[9-11]。由于嵌入式系统资源有限且仪表库封装工作繁琐,目前没有能够在嵌入式Web服务器中运行的小型仪表库,缺少这类手机仪表的应用。

针对这些问题,本文提出一种基于ESP32嵌入式Web服务器的手机化仪表设计方法,采用嵌入式Web服务器与浏览器通信的模式,设计了一个可以自由组装仪表界面的下位机标准库,能够将仪表界面存储在单片机中,通过Web服务器方式运行,利用手机浏览器查看与操作仪表界面,不用安装任何软件,只需要连接与下位机相同的热点,即可通过设备IP地址访问不同仪器的仪表界面。该设计操作简单且交互友好,学习成本低,仪表库开源便于进一步拓展。


本文详细内容请下载:

https://www.chinaaet.com/resource/share/2000006848


作者信息:

丁依,何岭松

(华中科技大学 机械科学与工程学院,湖北 武汉 430074)


subscribe.jpg

此内容为AET网站原创,未经授权禁止转载。