《電子技術(shù)應(yīng)用》
您所在的位置:首頁 > 嵌入式技術(shù) > 設(shè)計應(yīng)用 > 基于ESP32嵌入式Web服務(wù)器的手機化儀表設(shè)計
基于ESP32嵌入式Web服務(wù)器的手機化儀表設(shè)計
電子技術(shù)應(yīng)用
丁依,何嶺松
華中科技大學(xué) 機械科學(xué)與工程學(xué)院
摘要: 隨著物聯(lián)網(wǎng)技術(shù)的發(fā)展,單片機性能升級且功能變得豐富,利用單片機創(chuàng)建Web服務(wù)器,使用瀏覽器作為客戶端進行訪問變得可行。借鑒其思路,提出一種嵌入式Web服務(wù)器+瀏覽器架構(gòu)的無軟件化手機儀表設(shè)計方法。先用JavaScript語言將常用的手機儀表元素設(shè)計為一個能嵌入到單片機存儲系統(tǒng)中的50 KB大小的庫,然后在其基礎(chǔ)上形成C風(fēng)格手機儀表HTML網(wǎng)頁生成函數(shù),最后再通過單片機Web服務(wù)器將封裝后的C風(fēng)格手機儀表HTML網(wǎng)頁生成函數(shù)轉(zhuǎn)換為手機瀏覽器支持的HTML網(wǎng)頁進行顯示和用戶操作。該設(shè)計實現(xiàn)將儀表軟件安裝在下位機,客戶端零安裝、零配置訪問儀表界面。
中圖分類號:TP311.1 文獻標(biāo)志碼:A DOI: 10.16157/j.issn.0258-7998.256290
中文引用格式: 丁依,何嶺松. 基于ESP32嵌入式Web服務(wù)器的手機化儀表設(shè)計[J]. 電子技術(shù)應(yīng)用,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

引言

隨著社會需求不斷地信息化、自動化和智能化,基于單片機設(shè)計的智能儀表在不同領(lǐng)域中都發(fā)揮著重要作用[1-3]。目前主流的智能儀表大多需要在顯示模塊上預(yù)裝APP后才能使用[4-5],對安裝平臺也有一定的要求[6],當(dāng)下位機儀器被更換時,需要重裝軟件進行適配,較為繁瑣,或者存在整個儀表的集成度太高導(dǎo)致二次開發(fā)的學(xué)習(xí)成本較大等問題,例如東輝的DY2000系列智能儀表,通常使用LCD、LED或OLED顯示屏作為顯示模塊,界面設(shè)計簡潔而直觀,但顯示的內(nèi)容有限且更改較為困難,用戶在某些應(yīng)用場景下可能無法找到合適的功能設(shè)置;德能的智能水表采用藍(lán)牙技術(shù)與手機連接的設(shè)計模式,儀表界面更加豐富,實現(xiàn)了“抄表不入戶,繳費不出門”的智能供水服務(wù),但需要下載并安裝APP后才能使用。隨著物聯(lián)網(wǎng)技術(shù)的迅速發(fā)展,目前許多單片機都集成了ESP32、ESP8266等Wi-Fi通信模塊,且ESP32的大部分性能優(yōu)于ESP8266[7-8],能夠輕松地在下位機運行嵌入式Web服務(wù)器,實現(xiàn)網(wǎng)頁托管與訪問等功能,網(wǎng)上已經(jīng)有了許多應(yīng)用[9-11]。由于嵌入式系統(tǒng)資源有限且儀表庫封裝工作繁瑣,目前沒有能夠在嵌入式Web服務(wù)器中運行的小型儀表庫,缺少這類手機儀表的應(yīng)用。

針對這些問題,本文提出一種基于ESP32嵌入式Web服務(wù)器的手機化儀表設(shè)計方法,采用嵌入式Web服務(wù)器與瀏覽器通信的模式,設(shè)計了一個可以自由組裝儀表界面的下位機標(biāo)準(zhǔn)庫,能夠?qū)x表界面存儲在單片機中,通過Web服務(wù)器方式運行,利用手機瀏覽器查看與操作儀表界面,不用安裝任何軟件,只需要連接與下位機相同的熱點,即可通過設(shè)備IP地址訪問不同儀器的儀表界面。該設(shè)計操作簡單且交互友好,學(xué)習(xí)成本低,儀表庫開源便于進一步拓展。


本文詳細(xì)內(nèi)容請下載:

http://ihrv.cn/resource/share/2000006848


作者信息:

丁依,何嶺松

(華中科技大學(xué) 機械科學(xué)與工程學(xué)院,湖北 武漢 430074)


subscribe.jpg

此內(nèi)容為AET網(wǎng)站原創(chuàng),未經(jīng)授權(quán)禁止轉(zhuǎn)載。