牛青松,胡永強(qiáng),鄧西金,李積雲(yún)
(青海省科學(xué)技術(shù)信息研究所,青海西寧 810008)
?
基于無(wú)線(xiàn)傳感器網(wǎng)絡(luò)的溫室大棚環(huán)境監(jiān)測(cè)系統(tǒng)設(shè)計(jì)
牛青松,胡永強(qiáng),鄧西金,李積雲(yún)
(青海省科學(xué)技術(shù)信息研究所,青海西寧 810008)
針對(duì)目前溫室大棚環(huán)境監(jiān)測(cè)系統(tǒng)存在布線(xiàn)困難、靈活性低和成本高等問(wèn)題,構(gòu)建了基于無(wú)線(xiàn)傳感器網(wǎng)絡(luò)(WSN)的溫室大棚環(huán)境監(jiān)測(cè)系統(tǒng),并重點(diǎn)對(duì)傳感節(jié)點(diǎn)和網(wǎng)關(guān)節(jié)點(diǎn)進(jìn)行了設(shè)計(jì)。該系統(tǒng)的傳感器節(jié)點(diǎn)負(fù)責(zé)對(duì)環(huán)境參數(shù)進(jìn)行采集,并通過(guò)無(wú)線(xiàn)傳感器網(wǎng)絡(luò)將數(shù)據(jù)發(fā)送到網(wǎng)關(guān)節(jié)點(diǎn),網(wǎng)關(guān)節(jié)點(diǎn)再向遠(yuǎn)程監(jiān)測(cè)平臺(tái)傳輸數(shù)據(jù)。節(jié)點(diǎn)硬件的微處理器模塊采用MSP430F149單片機(jī)進(jìn)行數(shù)據(jù)處理和控制;無(wú)線(xiàn)通信模塊由nRF905射頻芯片及其外圍電路組成,負(fù)責(zé)對(duì)數(shù)據(jù)進(jìn)行傳輸和接收;傳感器模塊采用AM2301傳感器進(jìn)行數(shù)據(jù)測(cè)量;電源模塊以L(fǎng)T1129-3.3、LT1129-5 和Max660 組成的電路提供3.3 和±5.0 V電源。節(jié)點(diǎn)的無(wú)線(xiàn)路由協(xié)議和時(shí)間同步算法均采用C語(yǔ)言開(kāi)發(fā),實(shí)現(xiàn)節(jié)點(diǎn)數(shù)據(jù)采集與處理、規(guī)則轉(zhuǎn)發(fā)和遠(yuǎn)程傳輸?shù)裙δ堋_h(yuǎn)程監(jiān)測(cè)軟件采用NET.ASP、HTML和C#開(kāi)發(fā),為用戶(hù)提供形象直觀(guān)的Web模式遠(yuǎn)程數(shù)據(jù)管理平臺(tái)。該系統(tǒng)在青海省西寧市溫室大棚進(jìn)行了組網(wǎng)測(cè)試,結(jié)果表明系統(tǒng)運(yùn)行穩(wěn)定可靠,網(wǎng)絡(luò)平均丟包率為2.4%,有效解決了溫室環(huán)境監(jiān)測(cè)系統(tǒng)中存在的問(wèn)題,滿(mǎn)足溫室大棚栽培環(huán)境監(jiān)測(cè)的應(yīng)用要求。
無(wú)線(xiàn)傳感器網(wǎng)絡(luò);溫室環(huán)境;無(wú)線(xiàn)監(jiān)測(cè)系統(tǒng);網(wǎng)絡(luò)性能
無(wú)線(xiàn)傳感器網(wǎng)絡(luò)技術(shù)已經(jīng)融入人們的生活和生產(chǎn)的各個(gè)領(lǐng)域,它被列為21世紀(jì)最有影響力的技術(shù)之一。最近,無(wú)線(xiàn)傳感器網(wǎng)絡(luò)的應(yīng)用已涉及各個(gè)領(lǐng)域,而在農(nóng)業(yè)領(lǐng)域更是得到了廣泛應(yīng)用[1-5]。美國(guó)英特爾公司在俄勒岡州建立了一個(gè)葡萄園無(wú)線(xiàn)傳感器網(wǎng)絡(luò)[6],并分析了網(wǎng)絡(luò)的性能。Aline Baggio[7]建立了一個(gè)基于T-MAC協(xié)議的WSN系統(tǒng)用于監(jiān)控土豆的溫度、濕度和葉表面溫度。在牧場(chǎng)布置的無(wú)線(xiàn)傳感器網(wǎng)絡(luò)系統(tǒng)被設(shè)計(jì)用于收集農(nóng)業(yè)信息如土壤含水量、空氣溫濕度、土壤鹽度等[8-11]。在農(nóng)田部署的節(jié)點(diǎn)主要收集溫度、濕度、土壤含水量、陽(yáng)光強(qiáng)度和二氧化碳濃度[12-15]。大規(guī)模種植面積和高要求環(huán)境被認(rèn)為是溫室栽培的重要特性。盡管保持合適的溫度和濕度是作物生長(zhǎng)的關(guān)鍵,但目前溫室環(huán)境的測(cè)量仍然依賴(lài)人工。筆者基于無(wú)線(xiàn)傳感器網(wǎng)絡(luò)硬件平臺(tái),設(shè)計(jì)了一個(gè)溫室種植的無(wú)線(xiàn)傳感器監(jiān)控系統(tǒng)。
無(wú)線(xiàn)監(jiān)測(cè)系統(tǒng)由傳感器節(jié)點(diǎn)、網(wǎng)關(guān)節(jié)點(diǎn)和遠(yuǎn)程管理平臺(tái)組成。傳感器節(jié)點(diǎn)用于收集溫室環(huán)境的數(shù)據(jù),網(wǎng)關(guān)節(jié)點(diǎn)通過(guò)GPRS網(wǎng)絡(luò)將網(wǎng)絡(luò)數(shù)據(jù)傳輸?shù)竭h(yuǎn)程管理平臺(tái),無(wú)線(xiàn)傳感器網(wǎng)絡(luò)是以Ad hoc網(wǎng)絡(luò)的形式進(jìn)行數(shù)據(jù)多跳或單跳傳輸。系統(tǒng)結(jié)構(gòu)如圖1所示。
圖1 無(wú)線(xiàn)監(jiān)控系統(tǒng)結(jié)構(gòu)Fig.1 System structure of wireless monitoring
1.1系統(tǒng)硬件平臺(tái)
1.1.1傳感器節(jié)點(diǎn)。傳感器節(jié)點(diǎn)硬件平臺(tái)是由微處理器模塊、無(wú)線(xiàn)通信模塊、傳感器模塊、串口通信模塊和電源模塊組成,傳感器節(jié)點(diǎn)實(shí)物如圖2所示。
(1)微處理器模塊是核心組件。該系統(tǒng)選定AVR系列單片機(jī)MSP430F149為主控制芯片。微處理器模塊可支持實(shí)現(xiàn)設(shè)備管理、任務(wù)調(diào)度、數(shù)據(jù)集成和通信協(xié)議等功能。
(2)無(wú)線(xiàn)傳感器網(wǎng)絡(luò)的工作特征有著低功耗的需求,因此無(wú)線(xiàn)通信模塊是關(guān)鍵的部分。無(wú)線(xiàn)通信模塊必須滿(mǎn)足低功耗設(shè)計(jì),可以根據(jù)不同的需求而改變其發(fā)射功率。無(wú)線(xiàn)通信模塊采用nRF905射頻模塊,工作電壓為1.9~3.6 V,工作于433/868/915MHz 3個(gè)ISM頻段,具有抗干擾能力強(qiáng)、低功耗和傳輸距離遠(yuǎn)等特點(diǎn)。
圖2 傳感器節(jié)點(diǎn)實(shí)物Fig.2 Sensor nodes
(3)傳感器模塊負(fù)責(zé)完成對(duì)感興趣的物理參數(shù)的收集。AM2301傳感器主要收集的是環(huán)境溫度和濕度。
(4)JTAG下載模塊是嵌入式系統(tǒng)和計(jì)算機(jī)之間的程序下載接口。
1.1.2網(wǎng)關(guān)節(jié)點(diǎn)。網(wǎng)關(guān)節(jié)點(diǎn)硬件平臺(tái)是由微處理器模塊、無(wú)線(xiàn)通信模塊、GPRS模塊、數(shù)據(jù)存儲(chǔ)模塊、串口通信模塊和電源模塊組成,網(wǎng)關(guān)節(jié)點(diǎn)實(shí)物如圖3所示。
圖3 網(wǎng)關(guān)節(jié)點(diǎn)實(shí)物Fig.3 Gateway node
(1)網(wǎng)關(guān)節(jié)點(diǎn)與傳感器節(jié)點(diǎn)相同的采用MSP430F149和nRF905分別作為主要控制芯片和射頻芯片。
(2)GPRS模塊主要是負(fù)責(zé)網(wǎng)關(guān)節(jié)點(diǎn)和外部網(wǎng)絡(luò)之間的數(shù)據(jù)傳輸和發(fā)送警告信息。網(wǎng)關(guān)節(jié)點(diǎn)使用MC55作為GPRS模塊的主控芯片,并通過(guò)串口與控制器模塊通信。
(3)數(shù)據(jù)存儲(chǔ)模塊用于存儲(chǔ)網(wǎng)絡(luò)數(shù)據(jù),確保數(shù)據(jù)完整性。數(shù)據(jù)被存儲(chǔ)在SD卡之前,數(shù)據(jù)將被傳輸?shù)竭h(yuǎn)程管理平臺(tái),管理者可以獲得整個(gè)網(wǎng)絡(luò)數(shù)據(jù)并分析溫室環(huán)境的變化規(guī)律。
(4)電源模塊采用2節(jié)鋰電池為網(wǎng)關(guān)每個(gè)模塊供電,2節(jié)鋰電池串聯(lián)后通過(guò)LT1129-5、LT1129-3.3 組成的電路轉(zhuǎn)換為3.3 V,為處理器模塊和無(wú)線(xiàn)通信模塊供電;通過(guò)LT1129-5、Max660 組成的電路轉(zhuǎn)換為±5.0 V,為傳感器模塊供電,并利用太陽(yáng)能給電池充電,實(shí)現(xiàn)能源自給自足,有效延長(zhǎng)網(wǎng)關(guān)節(jié)點(diǎn)的使用壽命。
1.2節(jié)點(diǎn)軟件平臺(tái)節(jié)點(diǎn)軟件平臺(tái)的設(shè)計(jì)會(huì)直接影響節(jié)點(diǎn)網(wǎng)絡(luò)的性能和穩(wěn)定性。為了使系統(tǒng)節(jié)點(diǎn)有效地完成網(wǎng)絡(luò)任務(wù),減少丟包率和保證網(wǎng)絡(luò)的同步,系統(tǒng)軟件的設(shè)計(jì)包括傳感器節(jié)點(diǎn)應(yīng)用程序和網(wǎng)關(guān)節(jié)點(diǎn)應(yīng)用程序。
(1)傳感器節(jié)點(diǎn)的應(yīng)用程序?qū)崿F(xiàn)底層驅(qū)動(dòng)程序的調(diào)用、數(shù)據(jù)收集和傳播。設(shè)計(jì)思路如下:傳感器節(jié)點(diǎn)收集溫室環(huán)境數(shù)據(jù)并在到達(dá)所設(shè)定時(shí)間向網(wǎng)絡(luò)廣播;然后,傳感器節(jié)點(diǎn)進(jìn)入接收模式接收其他節(jié)點(diǎn)的數(shù)據(jù)包,并判斷是否需要轉(zhuǎn)發(fā)或丟棄。當(dāng)接收到網(wǎng)關(guān)節(jié)點(diǎn)發(fā)來(lái)的同步數(shù)據(jù)包后,傳感器節(jié)點(diǎn)設(shè)置當(dāng)?shù)貢r(shí)間并轉(zhuǎn)發(fā)同步數(shù)據(jù)包到網(wǎng)絡(luò),然后進(jìn)入睡眠模式等待下一個(gè)循環(huán)周期。傳感器節(jié)點(diǎn)程序流程見(jiàn)圖4。
圖4 傳感器節(jié)點(diǎn)程序流程Fig.4 Flow chart of sensor node software
(2)網(wǎng)關(guān)節(jié)點(diǎn)的應(yīng)用程序?qū)崿F(xiàn)了數(shù)據(jù)遠(yuǎn)程傳輸和備份,并當(dāng)數(shù)據(jù)異常時(shí)發(fā)送警告信息。設(shè)計(jì)思路如下:在系統(tǒng)啟動(dòng)后,網(wǎng)關(guān)節(jié)點(diǎn)首先發(fā)送同步數(shù)據(jù)包到網(wǎng)絡(luò),使整個(gè)網(wǎng)絡(luò)進(jìn)入休眠。設(shè)定時(shí)間到達(dá)時(shí),網(wǎng)關(guān)節(jié)點(diǎn)進(jìn)入接收模式,從網(wǎng)絡(luò)接收數(shù)據(jù)包并將數(shù)據(jù)備份到SD卡。然后,發(fā)送同步數(shù)據(jù)包使網(wǎng)絡(luò)進(jìn)入休眠狀態(tài),并且通過(guò)GPRS網(wǎng)絡(luò)和互聯(lián)網(wǎng)將數(shù)據(jù)傳輸?shù)竭h(yuǎn)程管理平臺(tái)。網(wǎng)關(guān)節(jié)點(diǎn)程序流程見(jiàn)圖5。
圖5 網(wǎng)關(guān)節(jié)點(diǎn)程序流程Fig.5 Flow chart of gateway node software
1.3遠(yuǎn)程管理平臺(tái)的設(shè)計(jì)為了方便數(shù)據(jù)管理和咨詢(xún),基于.NET開(kāi)發(fā)平臺(tái)、SQL Server 2000和C# 設(shè)計(jì)了遠(yuǎn)程管理平臺(tái)。用戶(hù)可以通過(guò)計(jì)算機(jī)和手機(jī)連接到互聯(lián)網(wǎng)或WAP網(wǎng)絡(luò)對(duì)數(shù)據(jù)進(jìn)行遠(yuǎn)程管理和咨詢(xún)。
遠(yuǎn)程管理平臺(tái)主要包括數(shù)據(jù)實(shí)時(shí)顯示、數(shù)據(jù)統(tǒng)計(jì)分析、實(shí)時(shí)預(yù)警系統(tǒng)、歷史數(shù)據(jù)查詢(xún)等功能。
該研究設(shè)計(jì)的系統(tǒng)布置在青海省西寧市匯豐蔬菜種植基地進(jìn)行試驗(yàn),對(duì)5個(gè)溫室環(huán)境進(jìn)行了環(huán)境溫度和濕度的在線(xiàn)監(jiān)測(cè)。每個(gè)溫室放置1個(gè)傳感器節(jié)點(diǎn)并配置3個(gè)傳感器測(cè)量溫室環(huán)境數(shù)據(jù)指標(biāo)。傳感器節(jié)點(diǎn)部署現(xiàn)場(chǎng)如圖6所示。
圖6 環(huán)境監(jiān)測(cè)傳感器節(jié)點(diǎn)安裝部署Fig.6 Node installation of environmental monitoring sensor nodes
該系統(tǒng)將通過(guò)網(wǎng)絡(luò)丟包率(PLR)測(cè)試來(lái)評(píng)估整個(gè)網(wǎng)絡(luò)的可靠性。數(shù)據(jù)采集周期設(shè)置為30 min,設(shè)置PLR測(cè)試時(shí)間為168 h。PLR測(cè)試結(jié)果如表1所示,表中LocalPakts表示每個(gè)節(jié)點(diǎn)發(fā)出的本地?cái)?shù)據(jù)包的數(shù)量,F(xiàn)orwardingPakts表示節(jié)點(diǎn)轉(zhuǎn)發(fā)數(shù)據(jù)包的數(shù)量,Recpakts表示PC接收的數(shù)據(jù)包的數(shù)量,Lost表示每個(gè)節(jié)點(diǎn)的數(shù)據(jù)包丟失數(shù)量。下式是系統(tǒng)網(wǎng)絡(luò)丟包率的計(jì)算,測(cè)試結(jié)果表明該系統(tǒng)通信穩(wěn)定可靠,整個(gè)網(wǎng)絡(luò)的平均丟包率為2.4%。
表1 網(wǎng)絡(luò)丟包率測(cè)試統(tǒng)計(jì)
圖7 溫室溫度8月19日數(shù)據(jù)Fig.7 Temperature in greenhouses on August 19th
圖8 溫室濕度8月19日數(shù)據(jù)Fig.8 Humidity in greenhouses on August 19th
通過(guò)AM2301傳感器對(duì)溫室環(huán)境溫度和濕度進(jìn)行測(cè)量,平均數(shù)據(jù)由節(jié)點(diǎn)1、2、3、4和5采集并由網(wǎng)關(guān)節(jié)點(diǎn)遠(yuǎn)程傳輸至服務(wù)器,其中8月19日的溫度、濕度監(jiān)測(cè)數(shù)據(jù)分別見(jiàn)圖7、8。
無(wú)線(xiàn)傳感器網(wǎng)絡(luò)是一種測(cè)量環(huán)境參數(shù)的有效工具。該研究設(shè)計(jì)的傳感器節(jié)點(diǎn)低功率,穩(wěn)定可靠,能精確測(cè)量溫室環(huán)境溫濕度。分析測(cè)試結(jié)果表明,該無(wú)線(xiàn)傳感器網(wǎng)絡(luò)在試驗(yàn)應(yīng)用中能穩(wěn)定運(yùn)行,準(zhǔn)確傳輸測(cè)量數(shù)據(jù)到遠(yuǎn)程管理平臺(tái),并且網(wǎng)絡(luò)丟包率低,滿(mǎn)足實(shí)際運(yùn)行的需要。
[1] BECKWITH R,TEIBEL C, BOWEN P.Report from the field:Results from an agricultural wireless sensor network[C]//Proc.29th Annual IEEE Intl.Conf.Piscataway,N.J.:IEEE,2004:241-249.
[2] LI Z,WANG N,F(xiàn)RANZEN A,et al.Development of a wireless sensor network for field soil moisture monitoring[M].St.Joseph.Mich.:ASABE,2008:135-141.
[3] ANDRADE-SANCHEZ P,PIERCE F J,ELLIOT T V.Performance assessment of wireless sensor networks in agricultural setting[C]//2007 ASABE annual international meeting.Minneapolis,USA,2007:311-319.
[4] JIANG S,WANG W X,SUN D Z,et al.Design of energy self-sufficient wireless sensor network node for orchardinformation acquisition[J].Transactions of the Chinese society of agricultural engineering(Transactions of the CSAE),2012,28(9):153-158.
[5] WANG W X,LUO X W,SUN D Z,et al.Design of wireless sensor network node for data transmission in tea plantations[J].Transactions of the CSAE,2011,27(5):169-173.
[6] HUANG J Q,WANG W X,JIANG S,et al.Development and test of aquacultural water quality monitoring system based on wireless sensor network[J].Transactions of the Chinese society of agricultural engineering,2013,29(4):183-190.
[7] BAGGIO A.Wireless sensor networks in precision agriculture[C]//Proc.workshop on real-world wireless sensor networks.Stockholm,Sweden,2007.
[8] ZHANG B H,LI S N,TENG W X,et al.Development and design of greenhouse testing and control system based on wireless sensor networks[J].Microeletronics & computer,2008,25(5):154-157.
[9] CHEN X,XUE M S,WANG J,et al.Wireless measurement and control system for greenhouse environment based on ZigBee protocol[J].Automation & instrumentation,2007(3):39-41,50.
[10] ZHANG Y W,YANG Z Y,SHEN C,et al.Design and implementation of the WSN-based gateway in a greenhouse intelligent measuring and controlling system[J].Computer engineering and science,2008,30(6):98-100,105.
[11] BU T R,LV L X,WANG W.Design of agriculture environment monitoring system based on TinyOS wireless sensor network[J].Agriculture network information,2009(2):25-27.
[12] LI L W, YEO T S, KOOI P S,et al.Radio wave propagation along mixed paths through a four-layered model of rain forest:An analytic approach[J].IEEE Trans actions on Antennas and propagation,1998,46(7):1098-1111.
[13] AYDAY C,SAFAK S.Application of wireless sensor networks with GIS on the soil moisture distribution mapping[C]//Proceedings of 16th International Symposium GIS Ostrava 2009-Seamless Geoinformation Technologies,Ostrava,Czech Republic,2009:123-132.
[14] AKYILDIZ I F,SU W,SANKARASUBRAMANIAM Y,et al.Wireless sensor networks:A survey[J].Computer networks,2002,38(4):393-422.
[15] CAMILLI A,CUGNASCA C E,SARAIVA A M,et al.From wireless sensor to field mapping:Anatomy of an application for precision agriculture[J].Comput Electron Agric,2007,58:25-36.
Design of Greenhouse Environment Monitoring System based on Wireless Sensor Network
NIU Qing-song, HU Yong-qiang, DENG Xi-jin et al
(Institute of Qinghai Science and Technology Information, Xining, Qinghai 810008)
According to the problems of difficult wiring, low flexibility and high cost in greenhouse environment monitoring system at present, we constructed the greenhouse environment monitoring system based on wireless sensor network (WSN). The sensing node and gateway node were designed. The sensor node in this system is used to collect environmental parameter. Data were sent to gateway node through wireless sensor network. The gateway node transmit data to remote monitoring platform. The microprocessor modules of node hardware used MSP430F149 Single Chip Microcomputer to process and control data. Wireless communication module is composed by nRF905 radio frequency chip and its peripheral circuit, which were used to transmit and receive the data. Sensor module used AM2301 sensor to measure data. Circuit of power module was composed of LT1129-3.3, LT1129-5 and Max660, so as to provide 3.3 and ±5 V power supply. Wireless routing protocol in the node was developed by C language, and realized the node data acquisition and treatment, rules retransmission and Tele transmission and so on. Remote monitoring software used NET.ASP, HTML and C# for development, which provided visual and intuitionistic WEB mode remote data management platform. Networking testing of this system was carried out in greenhouse in Xining City of Qinghai Province. Results showed that the system was stable and reliable. The average packet loss rate was 2.4%, which effectively solve the problems in greenhouse environment monitoring system, and met the requirements for application of greenhouse cultivation environment monitoring.
Wireless sensor network; Greenhouse environment; Wireless monitoring system; Network performance
青海省企業(yè)技術(shù)創(chuàng)新資金計(jì)劃項(xiàng)目(2015-GX-Q22)。
牛青松(1977- ),男,山東金鄉(xiāng)人,實(shí)習(xí)研究員,從事農(nóng)業(yè)信息技術(shù)、無(wú)線(xiàn)網(wǎng)絡(luò)傳感技術(shù)研究。
2016-06-22
S 126
A
0517-6611(2016)24-235-03