潘小紅 楊志勇
摘 ?要: 針對現(xiàn)有溫室大棚種植園環(huán)境監(jiān)測的缺陷和不足,采用物聯(lián)網(wǎng)技術(shù),設(shè)計(jì)對溫室大棚遠(yuǎn)程監(jiān)控的系統(tǒng)。文中提出了模糊功率控制算法,以接收信號強(qiáng)度和丟包率變化作為模糊控制器的輸入,實(shí)現(xiàn)對傳感器節(jié)點(diǎn)的發(fā)射功率自動調(diào)整。以低功耗CC2530為處理器,通過傳感器節(jié)點(diǎn)模塊采集數(shù)據(jù)后傳輸?shù)絽R聚節(jié)點(diǎn)模塊,再由匯聚節(jié)點(diǎn)模塊傳輸數(shù)據(jù)到網(wǎng)關(guān)節(jié)點(diǎn)模塊,最后通過GPRS模塊將數(shù)據(jù)上傳到服務(wù)器。實(shí)驗(yàn)結(jié)果表明,所提系統(tǒng)運(yùn)行穩(wěn)定,采集的數(shù)據(jù)準(zhǔn)確,可以實(shí)現(xiàn)對溫室大棚種植園的環(huán)境監(jiān)測。
關(guān)鍵詞: 環(huán)境監(jiān)測; 物聯(lián)網(wǎng)技術(shù); 數(shù)據(jù)采集; 數(shù)據(jù)上傳; 溫室大棚; 傳感器技術(shù)
中圖分類號: TN926?34; TP212 ? ? ? ? ? ? ? ? 文獻(xiàn)標(biāo)識碼: A ? ? ? ? ? ? ? ? ? ?文章編號: 1004?373X(2019)14?0127?04
Greenhouse plantation environment monitoring system based on
Internet of Things technology
PAN Xiaohong1, YANG Zhiyong2
(1. Yangtze University College of Arts and Science, Jingzhou 434000, China; 2. Nanchang Hangkong University, Nanchang 330000, China)
Abstract: In view of the defects and insufficiency of the existing greenhouse plantation environmental monitoring, a remote monitoring system for greenhouses is designed by means of the Internet of Things (IoT) technology. A fuzzy power control algorithm is proposed for this system, which takes the received signal strength and packet loss rate as the input of the fuzzy controller to realize the automatic adjustment of the transmit power of the sensor node. Besides, low power consumption CC2530 is used as processor. The sensor node module is adopted to collect data, and then send the data to the sink node module, by which the data is transmitted to the gateway node module. Finally, the data is uploaded to the server through the GPRS module, so as to realize the monitoring of the PC upper computer. The experimental results show that the system operates stably and the collected data is accurate. It can realize the environmental monitoring of the greenhouse plantation.
Keywords: environmental monitoring; IoT technology; data acquisition; data uploading; greenhouse; sensor technology
0 ?引 ?言
我國是農(nóng)業(yè)大國,農(nóng)業(yè)的發(fā)展與否直接關(guān)系著社會的穩(wěn)定與發(fā)展。2018年中央一號文件《關(guān)于實(shí)施鄉(xiāng)村振興戰(zhàn)略的意見》也提到了要提高農(nóng)業(yè)質(zhì)量效益和競爭力。土壤的濕度與光照強(qiáng)度、空氣溫濕度等因素有關(guān)[1?3]。健康的土壤是生產(chǎn)安全農(nóng)產(chǎn)品的基本條件,如何提高農(nóng)產(chǎn)品的生產(chǎn)經(jīng)濟(jì)效益也是農(nóng)民需要考慮的問題。農(nóng)民通過老式的溫室大棚對農(nóng)產(chǎn)品進(jìn)行種植,往往借鑒于多年積累下來的經(jīng)驗(yàn),農(nóng)民對于一些農(nóng)產(chǎn)品甚至還需要24 h守護(hù)大棚,致使經(jīng)濟(jì)效益低,且管理上不方便。近些年,隨著無線通信技術(shù)的發(fā)展,可以實(shí)現(xiàn)對農(nóng)產(chǎn)品的遠(yuǎn)程監(jiān)測[4?5]。將物聯(lián)網(wǎng)技術(shù)應(yīng)用于對溫室大棚種植園環(huán)境參數(shù)的監(jiān)測,能夠?qū)崟r(shí)采集到空氣的溫濕度、土壤濕度、光照強(qiáng)度和二氧化碳濃度。農(nóng)民通過PC機(jī)和手機(jī)可以遠(yuǎn)程監(jiān)測到大棚的狀況,并能夠?qū)Υ笈锃h(huán)境進(jìn)行控制,從而大大提高效率且?guī)懋a(chǎn)量的大幅度增加。
本文提出了基于物聯(lián)網(wǎng)技術(shù)的溫室大棚種植園環(huán)境監(jiān)測系統(tǒng)。通過應(yīng)用物聯(lián)網(wǎng)技術(shù)在溫室大棚草莓園部署傳感器節(jié)點(diǎn),各傳感器模塊負(fù)責(zé)采集數(shù)據(jù),如空氣的溫濕度、土壤濕度、光照強(qiáng)度和二氧化碳濃度,射頻模塊將傳感器采集到的數(shù)據(jù)傳輸?shù)絽R聚節(jié)點(diǎn)。然后匯聚節(jié)點(diǎn)將數(shù)據(jù)傳輸?shù)奖O(jiān)測主機(jī),主機(jī)監(jiān)控系統(tǒng)處理相關(guān)數(shù)據(jù),將處理的結(jié)果通過GSM或GPRS方式向大棚管理人員發(fā)送。實(shí)現(xiàn)了對溫室草莓種植園中各種環(huán)境狀態(tài)的遠(yuǎn)程監(jiān)測和控制。
1 ?節(jié)點(diǎn)功率控制算法
在溫室大棚草莓種植園環(huán)境中,通過部署傳感器節(jié)點(diǎn)可以實(shí)現(xiàn)對環(huán)境數(shù)據(jù)的采集。研究表明,無線傳感器節(jié)點(diǎn)的功耗主要在射頻模塊[6],節(jié)點(diǎn)發(fā)送的功率是否合適也直接影響無線傳感器網(wǎng)絡(luò)的通信質(zhì)量和生存時(shí)間。由于溫室大棚草莓種植園的株高和密度對無線信號傳播有較大影響,從而引起通信質(zhì)量和接收信號強(qiáng)度都下降[7]。為降低傳感器節(jié)點(diǎn)功耗,設(shè)計(jì)了節(jié)點(diǎn)功率控制算法。根據(jù)文獻(xiàn)[8]得,無線通信中通信距離、接收功率和發(fā)射功率的關(guān)系為:
[PR=PTrn] ?(1)
式中:[PR]表示無線信號的接收功率,單位為[mW];[PT]表示無線信號的發(fā)射功率,單位為[mW];[r]表示發(fā)送節(jié)點(diǎn)和接收節(jié)點(diǎn)之間的距離,單位為[m];[n]表示環(huán)境傳播因子。對式(1)兩邊取對數(shù)乘以10,單位換算為[dBm],可得到:
[PT-PR=10nlg r] ? (2)
考慮到溫室大棚草莓園環(huán)境監(jiān)測系統(tǒng)中傳感器采集節(jié)點(diǎn)與匯聚節(jié)點(diǎn)之間的數(shù)據(jù)傳輸,設(shè)傳感器采集節(jié)點(diǎn)發(fā)射功率為[PscnT],單位為[mW],匯聚節(jié)點(diǎn)接收信號強(qiáng)度為[RSSIsn],單位為[mW],匯聚節(jié)點(diǎn)發(fā)射功率為[PsnT],單位為[mW],傳感器采集節(jié)點(diǎn)接收信號強(qiáng)度為[RSSIscn],單位為[mW]。由式(2)可得到式(3):
[PscnT-RSSIsn=PsnT-RSSIscn] ?(3)
由式(3)可知,當(dāng)匯聚節(jié)點(diǎn)發(fā)射功率為[PsnT]不變時(shí),傳感器采集節(jié)點(diǎn)的發(fā)射功率[PscnT]跟匯聚節(jié)點(diǎn)接收信號強(qiáng)度為[RSSIsn]有關(guān)。在溫室大棚草莓園存在遮擋情況下,為了保證無線通信質(zhì)量,實(shí)際丟包率[PLR]應(yīng)不能低于丟包率參考值[PLR0],提出了自適應(yīng)模糊控制法對傳感器采集節(jié)點(diǎn)發(fā)射功率進(jìn)行控制,并將節(jié)點(diǎn)的發(fā)射功率調(diào)整到最佳值。設(shè)匯聚節(jié)點(diǎn)實(shí)際接收信號強(qiáng)度為[RSSI],理想低功耗接收信號強(qiáng)度參考值為[RSSI0]。模糊控制器的輸入為丟包率的[ePLR]、接收信號強(qiáng)度的變化率[eRSSI],輸出為發(fā)射功率調(diào)整值[ΔP]。其中,[ePLR]為丟包率實(shí)測值與最低丟包率參考值之差;[eRSSI]為接收信號強(qiáng)度實(shí)測值相對理想低功耗接收信號強(qiáng)度參考值的變化率。模糊控制器如圖1所示。
2 ?監(jiān)測系統(tǒng)硬件設(shè)計(jì)
本系統(tǒng)由傳感器節(jié)點(diǎn)模塊、匯聚節(jié)點(diǎn)模塊、網(wǎng)關(guān)節(jié)點(diǎn)模塊、GPRS模塊和上位機(jī)監(jiān)控模塊五部分組成。其中,傳感器節(jié)點(diǎn)模塊和匯聚節(jié)點(diǎn)模塊在硬件上都采用低功耗且性價(jià)比高的CC2530芯片,但是在軟件編程上有差異。由于全向天線相對比定向天線具有較強(qiáng)的輻射能力[9?10],通過在傳感器節(jié)點(diǎn)模塊和網(wǎng)關(guān)節(jié)點(diǎn)模塊上配備全向天線,匯聚節(jié)點(diǎn)模塊上配備定向天線,該系統(tǒng)實(shí)現(xiàn)了混合天線方式組網(wǎng)。傳感器節(jié)點(diǎn)模塊上可以安裝空氣溫濕度傳感器、土壤濕度傳感器、光照強(qiáng)度傳感器和二氧化碳濃度傳感器,并將采集到的數(shù)據(jù)沿其他傳感器節(jié)點(diǎn)進(jìn)行傳輸,經(jīng)過單跳或多跳后,路由到匯聚節(jié)點(diǎn)。匯聚節(jié)點(diǎn)通過ZigBee協(xié)議將數(shù)據(jù)傳輸?shù)骄W(wǎng)關(guān)節(jié)點(diǎn),網(wǎng)關(guān)節(jié)點(diǎn)再通過GPRS模塊將數(shù)據(jù)傳輸?shù)椒?wù)器,實(shí)現(xiàn)了PC上位機(jī)監(jiān)控,通過Android編程后還可以實(shí)現(xiàn)手機(jī)監(jiān)控。硬件系統(tǒng)總體結(jié)構(gòu)圖如圖2所示。
2.1 ?傳感器節(jié)點(diǎn)模塊
傳感器節(jié)點(diǎn)模塊是用來采集溫室大棚草莓種植園的環(huán)境參數(shù),其由傳感器模塊、信號調(diào)理電路模塊、處理器模塊、射頻模塊、電源模塊和RSSI檢測模塊組成。傳感器模塊選用數(shù)字式溫濕度傳感器DHT11、數(shù)字式土壤溫濕度傳感器FS200?SHT11、數(shù)字式光照強(qiáng)度傳感器BH1750FVI和模擬式二氧化碳濃度傳感器MG811。為了解決無線傳感器網(wǎng)絡(luò)能量受限問題,電源模塊通過太陽能充電可提供永久的5 V和3.3 V電壓,電路包括充電芯片、太陽能電池板、電壓轉(zhuǎn)化模塊和鋰電池。
2.2 ?匯聚節(jié)點(diǎn)模塊
匯聚節(jié)點(diǎn)模塊是用來對傳感器節(jié)點(diǎn)采集的數(shù)據(jù)進(jìn)行融合后再傳輸?shù)骄W(wǎng)關(guān)節(jié)點(diǎn)。它由傳感處理器模塊、射頻模塊、電源模塊、定向天線模塊和RSSI檢測模塊組成。電源模塊通過太陽能充電提供,可以延長匯聚節(jié)點(diǎn)模塊的生存時(shí)間。
2.3 ?網(wǎng)關(guān)節(jié)點(diǎn)模塊
網(wǎng)關(guān)節(jié)點(diǎn)模塊是用來收集匯聚節(jié)點(diǎn)模塊轉(zhuǎn)發(fā)過來的數(shù)據(jù),并將這些數(shù)據(jù)進(jìn)行融合后再傳輸?shù)缴衔粰C(jī)監(jiān)測中心。網(wǎng)關(guān)節(jié)點(diǎn)模塊由傳感器模塊、處理器模塊、射頻模塊、電源模塊、存儲模塊、GPRS模塊和RSSI檢測模塊組成。電源模塊也通過太陽能充電提供,可以延長網(wǎng)關(guān)節(jié)點(diǎn)模塊的生存時(shí)間。
3 ?上位機(jī)監(jiān)控模塊
系統(tǒng)的上位機(jī)軟件采用Visual Studio 2008為開發(fā)環(huán)境,通過ASP.Net技術(shù)和C#進(jìn)行開發(fā)。上位機(jī)監(jiān)控模塊設(shè)計(jì)包括數(shù)據(jù)接收服務(wù)端設(shè)計(jì)和智能監(jiān)控服務(wù)端設(shè)計(jì)。數(shù)據(jù)接收服務(wù)端負(fù)責(zé)接收無線傳感器網(wǎng)絡(luò)發(fā)送過來的各種大棚環(huán)境參數(shù)數(shù)據(jù),并保存于數(shù)據(jù)庫中,如圖3所示。
智能監(jiān)控服務(wù)端可實(shí)現(xiàn)的功能包括環(huán)境參數(shù)設(shè)置、草莓生長階段管理、傳感器類型參數(shù)設(shè)置、控制閥參數(shù)設(shè)置、大棚設(shè)備管理、系統(tǒng)報(bào)表、用戶管理、數(shù)據(jù)維護(hù)和環(huán)境參數(shù)實(shí)時(shí)監(jiān)控9個(gè)模塊,如圖4所示。其中,環(huán)境參數(shù)設(shè)置負(fù)責(zé)對系統(tǒng)進(jìn)行監(jiān)控的各種環(huán)境參數(shù)進(jìn)行管理。草莓生長階段管理可根據(jù)草莓不同的生長階段,設(shè)置合適的各項(xiàng)環(huán)境參數(shù)。傳感器類型參數(shù)設(shè)置可用來對系統(tǒng)中使用的各種傳感器類型參數(shù)進(jìn)行設(shè)置。控制閥參數(shù)設(shè)置可用來對系統(tǒng)中使用的控制器進(jìn)行設(shè)置。大棚設(shè)備管理可以對系統(tǒng)中要進(jìn)行監(jiān)控的大棚,以及大棚中的各種傳感器、控制閥設(shè)置參數(shù)。系統(tǒng)報(bào)表用來生成大棚環(huán)境參數(shù)報(bào)表。
4 ?系統(tǒng)測試
應(yīng)用本系統(tǒng)在草莓園進(jìn)行實(shí)驗(yàn)。在每個(gè)大棚中部署傳感器節(jié)點(diǎn)模塊用于采集數(shù)據(jù),這些數(shù)據(jù)可以通過登錄草莓大棚智能監(jiān)控系統(tǒng)界面遠(yuǎn)程監(jiān)測。系統(tǒng)登錄界面如圖5所示。
用戶成功登錄監(jiān)控系統(tǒng)界面后,進(jìn)入首頁可以看到大棚當(dāng)前環(huán)境參數(shù)監(jiān)測界面,如圖6所示。大棚管理人員還可以通過監(jiān)控系統(tǒng)查詢溫室大棚在指定時(shí)間段的各個(gè)環(huán)境參數(shù)的數(shù)據(jù)。圖7為大棚1號在4月1日的空氣溫度數(shù)據(jù)。
5 ?結(jié) ?語
本文結(jié)合物聯(lián)網(wǎng)技術(shù)設(shè)計(jì)了溫室大棚草莓種植園監(jiān)控系統(tǒng),該系統(tǒng)可以方便農(nóng)戶對草莓園環(huán)境參數(shù)的信息進(jìn)行遠(yuǎn)程監(jiān)控,并對模糊功率控制算法進(jìn)行研究,同時(shí)對監(jiān)測系統(tǒng)的軟硬件設(shè)計(jì)和上位機(jī)監(jiān)測模塊做介紹。實(shí)驗(yàn)結(jié)果表明,系統(tǒng)運(yùn)行穩(wěn)定,采集的數(shù)據(jù)準(zhǔn)確,可以實(shí)現(xiàn)對溫室大棚種植園的環(huán)境監(jiān)測。
參考文獻(xiàn)
[1] 嚴(yán)芳芳,張曙光,索雪松,等.農(nóng)業(yè)大棚太陽能供電數(shù)據(jù)采集系統(tǒng)設(shè)計(jì)[J].農(nóng)機(jī)化研究,2013(5):103?106.
YAN Fangfang, ZHANG Shuguang, SUO Xueong, et al. The design of solar?powered agricultural greenhouse nodes'data acquisition system [J]. Journal of agricultural mechanization research, 2013(5): 103?106.
[2] 牛濤,王一涯,陳曙光,等.基于ZigBee的多環(huán)境參數(shù)監(jiān)測系統(tǒng)設(shè)計(jì)[J].現(xiàn)代農(nóng)業(yè)科技,2017(1):169?170.
NIU Tao, WANG Yiya, CHEN Shuguang, et al. Design of multiple environment parameters monitoring system based on ZigBee [J]. Modern agricultural science and technology, 2017(1): 169?170.
[3] 丁筱玲,楊翠翠,吳玉紅,等.基于無線網(wǎng)絡(luò)的環(huán)境監(jiān)測與智控灌溉系統(tǒng)設(shè)計(jì)研究[J].節(jié)水灌溉,2015,40(7):86?89.
DIND Xiaoling, Yang Cuicui, WU Yuhong, et al. Environmental monitoring and intelligent irrigation system based on wireless network [J]. ?Water saving irrigation, 2015, 40(7): 86?89.
[4] 劉燕德,吳滔,蔡麗君,等.無線傳輸技術(shù)在農(nóng)產(chǎn)品長勢及質(zhì)量監(jiān)測中的應(yīng)用[J].中國農(nóng)機(jī)化,2012(1):180?184.
LIU Yande, WU Tao, CAI Lijun, et al. Management and research of digital agriculture based on wireless transmission technology [J]. Chinese agricultural mechanization, 2012(1): 180?184.
[5] 黃鴻鋒.基于ZigBee技術(shù)的農(nóng)作物溫室大棚監(jiān)控系統(tǒng)的設(shè)計(jì)和實(shí)現(xiàn)[D].成都:電子科技大學(xué),2014.
HUANG Hongfeng. The design and implementation of crops greenhouse monitoring and control system based on ZigBee technology [D]. Chengdu: University of Electronic Science and Technology of China, 2014.
[6] 文韜,洪添勝,李震,等.橘園無線傳感器網(wǎng)絡(luò)不同節(jié)點(diǎn)部署方式下的射頻信號傳播試驗(yàn)[J].農(nóng)業(yè)工程學(xué)報(bào),2010,26(6): 211?215.
WEN Tao, HONG Tiansheng, LI Zhen, et al. Test of wireless sensor network radio frequency signal propagation based on different node deployments in citrus orchards [J]. Transactions of the Chinese society of agricultural engineering, 2010, 26(6): 211?215.
[7] 王衛(wèi)星,陳華強(qiáng),姜晟,等.基于低功耗的發(fā)射功率自適應(yīng)水稻田WSN 監(jiān)測系統(tǒng)[J].農(nóng)業(yè)機(jī)械學(xué)報(bào),2018,49(3):150?157.
WANG Weixing, CHEN Huaqiang, JIANG Sheng, et al. WSN monitoring system with adaptive transmitting power based on low?power?consumption in rice fields [J]. Transactions of the Chinese society for agricultural machinery, 2018, 49(3): 150?157.
[8] 方震,趙湛,郭鵬,等.基于RSSI測距分析[J].傳感技術(shù)學(xué)報(bào),2007(11):2526?2530.
FANG Zhen, ZHAO Zhan, GUO Peng, et al. Analysis of distance measurement based on RSSI [J]. Chinese journal of sensors and actuators, 2007(11): 2526?2530.
[9] 孫寶霞,王衛(wèi)星,雷剛,等.基于定向天線WSN射頻信號傳播試驗(yàn)[J].廣東農(nóng)業(yè)科學(xué),2013,40(14):185?188.
SUN Baoxia, WANG Weixing, LEI Gang, et al. Test of wireless sensor network radio frequency signal propagation based on the directional antenna in paddy field [J]. Guangdong agricultural sciences, 2013, 40(14): 185?188.
[10] 鄭少雄,王衛(wèi)星,孫寶霞,等.基于定向天線WSNs的水稻田溫濕度監(jiān)測系統(tǒng)設(shè)計(jì)[J].傳感器與微系統(tǒng),2014,33(1):92?96.
ZHENG Shaoxiong, WANG Weixing, SUN Baoxia, et al. Humiture monitoring system in paddy field based on directional antenna WSNs [J]. Transducer and microsystem technologies, 2014, 33(1): 92?96.