瑚琦 姜敏 盧定凡
摘 要:我國水產(chǎn)養(yǎng)殖規(guī)模越來越大,種類越來越多,而傳統(tǒng)水產(chǎn)養(yǎng)殖環(huán)境下存在水溫參數(shù)自動監(jiān)測系統(tǒng)投資大、實時性差等問題。提出基于Android系統(tǒng)、WiFi模塊和云平臺實現(xiàn)遠程實時監(jiān)測養(yǎng)殖環(huán)境水溫的系統(tǒng)。系統(tǒng)主控模塊ESP8266和智能手機通過云服務(wù)器進行數(shù)據(jù)傳輸,溫度傳感器DS18B20實時捕獲水溫,將參數(shù)通過云平臺傳輸協(xié)議轉(zhuǎn)發(fā)給遠程云服務(wù)器,使用智能手機作為移動終端實時監(jiān)測與調(diào)節(jié)水溫。該系統(tǒng)具有搭建成本低、可靠穩(wěn)定、方便簡單易上手等優(yōu)點。
關(guān)鍵詞:Android;ESP8266;云平臺;水溫遠程監(jiān)測系統(tǒng);無線網(wǎng)絡(luò)
DOI:10. 11907/rjdk. 182839 開放科學(資源服務(wù))標識碼(OSID):
中圖分類號:TP319文獻標識碼:A 文章編號:1672-7800(2019)009-0108-04
Real-time Monitoring of Water Temperature in
Aquaculture Systems Based on Cloud Platform
HU Qi,JIANG Min,LU Ding-fan,CAI Wen-long
(School of Optical-Electrical and Computer Engineering,University of Shanghai for Science and Technology,Shanghai 200093,China)
Abstract:In view of the current large-scale aquaculture production in China, the types are becoming more and more abundant, and the traditional monitoring system of water temperature parameters in the traditional aquaculture environment has large investment and poor real-time performance. A system for remotely monitoring and regulating the temperature range of the aquaculture environment based on the android platform, WIFI module and cloud is put forward. The main control module ESP8266 and the smart phone in the system transmit data through the cloud server. The temperature sensor DS18B20 captures the water temperature in real time, passes the parameters and forwards it to the remote cloud serve through the cloud platform transmission protocol and the wireless network channel. Finally, the smartphone can be used as a mobile terminal to monitor and adjust the water temperature in real time. The system has the advantages of low construction cost, reliability, stability, convenience and ease of use.
Key Words: Android; ESP8266; cloud platform; remote monitoring system of water temperature; wireless network
0 引言
隨著經(jīng)濟的發(fā)展,水產(chǎn)食品需求不斷攀升,水產(chǎn)養(yǎng)殖業(yè)已成為我國當前農(nóng)業(yè)經(jīng)濟的主要增長點之一。資料表明魚類等水生生物不能像人類那樣通過新陳代謝活動保持自身溫度的恒定,而只能與水溫保持相對穩(wěn)定(魚的最佳生理代謝溫度是15-25℃,而熱帶淡水魚的適宜溫度一般為24-28℃)[1-2]。當溫度低于4℃或高于35℃時,魚會產(chǎn)生生理不適甚至死亡。水溫的變化還會引起水體環(huán)境改變,間接對魚類產(chǎn)生影響[3-4],因此水溫的合理控制是養(yǎng)殖成功的關(guān)鍵因素之一。
國外早在2012年就將無線傳感器網(wǎng)絡(luò)技術(shù)應(yīng)用于水溫監(jiān)控,建立了水產(chǎn)養(yǎng)殖和銷售可追溯系統(tǒng),該系統(tǒng)可根據(jù)水溫水質(zhì)等數(shù)據(jù)進行預(yù)警預(yù)報,避免經(jīng)濟損失[5-6]。我國的監(jiān)測系統(tǒng)綜合成本高,應(yīng)用在小規(guī)模養(yǎng)殖區(qū)域,無線、ZigBee等傳輸技術(shù)還沒有大規(guī)模應(yīng)用,經(jīng)濟效益較差[7]。
本文提出基于物聯(lián)網(wǎng)技術(shù)的水產(chǎn)養(yǎng)殖環(huán)境參數(shù)監(jiān)控系統(tǒng),可以遠程實時監(jiān)測與自動控制水溫,技術(shù)成本低 [8]。將養(yǎng)殖現(xiàn)場以5m×5m的面積劃分為一個節(jié)點,硬件系統(tǒng)分布式放置在各個節(jié)點中,各設(shè)備端將采集到的溫度數(shù)據(jù)通過傳輸協(xié)議匯總至云平臺服務(wù)器,移動終端或PC平臺可遠程實時監(jiān)測,調(diào)節(jié)各養(yǎng)殖范圍的溫度,保證水溫環(huán)境適宜,現(xiàn)場監(jiān)視屏可直觀顯示各節(jié)點水溫。
1 系統(tǒng)總體設(shè)計
系統(tǒng)主要由溫度傳感器模塊、云平臺傳輸協(xié)議模塊、WiFi主控模塊、手機端控制模塊組成,按功能分為信息采集、信息記錄及云端上傳、信息實時監(jiān)測與遠程控制3部分 [9]。
(1)信息采集:通過外置的溫度傳感器像人類器官一樣將感受到的溫度信息采集起來。
3.2 移動終端軟件設(shè)計
WiFi模塊將采集到的溫度數(shù)據(jù)打包,通過網(wǎng)絡(luò)傳輸?shù)綑C智云平臺的遠程服務(wù)器上,APP終端通過與遠程服務(wù)器通信獲得水溫監(jiān)測數(shù)據(jù)。云平臺服務(wù)器需對新建工程進行項目配置,建立數(shù)據(jù)點,然后綁定APP。下面給出APP端發(fā)送數(shù)據(jù)給云端和APP從云端接收數(shù)據(jù)的主要函數(shù)及解釋。
(1)發(fā)送數(shù)據(jù):給設(shè)備發(fā)送控制指令,參數(shù)data為要發(fā)給設(shè)備的操作指令,sn為控制指令序號,用于對應(yīng)控制指令應(yīng)答數(shù)據(jù)。
public void write(Concurrent HashMap
(2)接收反饋數(shù)據(jù):當 SDK 遇到無法解析的數(shù)據(jù)時,會作為透傳數(shù)據(jù)處理,此時錯誤碼為GIZ_SDK_SUCCESS[18]。函數(shù)中的參數(shù)解釋如下:device:回復(fù)狀態(tài)的設(shè)備對象;result:GIZ_SDK_SUCCESS表示成功,其它為失敗;data:設(shè)備上報的數(shù)據(jù)內(nèi)容;sn:控制指令的應(yīng)答序號,此應(yīng)答序號與 APP 發(fā)送控制指令序號一致。
public void didReceiveData(GizWifiErrorCode result,GizWifiDevice device,
Concurrent HashMap
將智能設(shè)備通過WiFi連接到云端后,就可用生成的APP實時查看水溫狀態(tài),控制目標設(shè)備。圖7、圖8分別是云后臺的數(shù)據(jù)記錄和本監(jiān)測系統(tǒng)APP開發(fā)的界面,圖中的temp表示監(jiān)測到的水溫,是只讀狀態(tài)。auto_mode為自動手動切換模式,0表示自動調(diào)整,設(shè)備端將自動根據(jù)環(huán)境數(shù)據(jù)判斷是否調(diào)高或調(diào)低水溫;1為手動模式,由用戶決定是否調(diào)節(jié)水溫[19]。heating_switch為手動模式下控制水溫加熱裝置的開關(guān)。
4 結(jié)語
隨著機械設(shè)施和生產(chǎn)系統(tǒng)的精密化,對物理設(shè)備的設(shè)計、制造、維護等提出了更高要求[20]。本文溫度調(diào)控系統(tǒng)可實現(xiàn)水產(chǎn)養(yǎng)殖環(huán)境的水溫遠程精確測量與調(diào)節(jié),解決了以往監(jiān)測水溫人力資源浪費、設(shè)備維護成本高且性能不穩(wěn)定、數(shù)據(jù)傳輸速度慢等問題,利用無線遠程技術(shù)極大提高了監(jiān)測效率[21]。其它指標如水體PH值、光照強度、水中含氧量等數(shù)據(jù)采集都可通過這種方法實現(xiàn),該監(jiān)測系統(tǒng)實用性強。
參考文獻:
[1] 駱東松, 韓雪晴. 基于機智云平臺的滾動軸承在線監(jiān)測系統(tǒng)[J]. 單片機與嵌入式系統(tǒng)應(yīng)用,2016(7):68-71.
[2] 李小勇,于群,趙紅玉,等. 南疆地區(qū)的大規(guī)模農(nóng)田遠程監(jiān)測系統(tǒng)設(shè)計[J]. 單片機與嵌入式系統(tǒng)應(yīng)用,2016(6):54-57.
[3] DHOLU M,MRS ?K A. Ghodinde internet of things (iot) for precision agriculture application[C]. Proceedings of the 2nd International Conference on Trends in Electronics and Informatics,2018:339-342.
[4] LI Y Q, HE J Z. Design of indoor environment monitoring system based on WiFi[C]. Advanced Information Management Communicates Electronic and Automation Control Conference,2018:1842-1845.
[5] TANMAY B,NIKITA,PUSHPENDRA KUMAR P. Development of IoT based smart security and monitotoring device for agriculturre[C]. IEEE 6th International conference-cloud system and big data Engineering,2016.
[6] SHOPAN DEY,AYON ROY,SANDIP DAS. Home automation using internet of thing[C]. Ubiquitous Computing Electronics & Mobile Communication Conference(UEMCON) IEEE Annual,2016:256-259.
[7] SARASWATI SAHA,ANUPAM MAJUMDAR. Data centre temperature monitoring with esp8266 based wireless sensor network and cloud based dashboard with real time alert system[C]. Devices for Integrated Circuit. IEEE,2017:307-310.
[8] 朱文錦,冉綱軍. 水產(chǎn)養(yǎng)殖環(huán)境參數(shù)自動監(jiān)控系統(tǒng)研究[J]. 淡水漁業(yè),2001(1):60-61.
[9] 汪傳生,方德光,張金秀,等. 開源硬件Arduino與樂聯(lián)網(wǎng)的農(nóng)業(yè)環(huán)境實時監(jiān)測系統(tǒng)[J]. 單片機與嵌入式系統(tǒng)應(yīng)用,2018(5):49-52.
[10] 曹豐年,李穎,張曉蕊,等. 基于WiFi技術(shù)的智能家居系統(tǒng)設(shè)計[J]. 軟件導(dǎo)刊,2017(8):67-72.
[11] 戴磊,李華,金翰林. 基于ESP8266的一種WiFi控制插座設(shè)計[J]. 裝備制造技術(shù),2017(4):12-14.