# Greenhouse Temperature Monitoring System Based on Labview

Zhihong Zheng, Kai Zhang, Chengliang Liu

► To cite this version:

Zhihong Zheng, Kai Zhang, Chengliang Liu. Greenhouse Temperature Monitoring System Based on Labview. 4th Conference on Computer and Computing Technologies in Agriculture (CCTA), Oct 2010, Nanchang, China. pp.23-29, 10.1007/978-3-642-18336-2_4. hal-01562801

HAL Id: hal-01562801

https://inria.hal.science/hal-01562801

Submitted on 17 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Greenhouse Temperature Monitoring System
Based on Labview

Zhihong Zheng¹, Kai Zhang¹, Chengliang Liu²

¹ School of information and control, Nanjing university of information science & technology, Nanjing Jiangsu, China, 210044

² School of mechanical and power engineering, Shanghai Jiao Tong University, Minhang Shanghai, China, 200240
{hongzhi510@163.com, zk@nuist.edu.cn, chlliu@sjtu.edu.cn}

**Abstract.** The environmental temperature plays an important role in the growing crops. How to make use of computer technology to realize automatic control ambient temperature of greenhouse is a hot issue in the intelligent agriculture. The control of environmental temperature in modern greenhouses is collected and analyzed by monitoring system of greenhouse environment based on Labview software and wireless communications technology. NRF24L01 wireless receive-send model makes temperature collection come true. Moreover, managing computer makes data wireless communications become possible. Over- temperature alarm information is transmissioned to user timely. Finally system interface is designed on the Labview software platform.

**Keywords:** temperature; intelligent agriculture; labview; temperature sensor;

# 1 Introduction

Facility gardening is a kind of production with the bad-effect condition in which the crops (flowers, fruit trees and vegetables) don't tend to grow normally in the cold or hot season. Thus people must utilize heat preservation, cold-proof, temperature reduction, defense and equipments in a man-made way to create an environment that favors the crop's growth without the effect of climate change. It is a comprehensive greenhouse technology, which meets the demand of ecological condition in plant including light, temperature, water, gas, soil and nutrition. Planting in the different seasons is able to yield high vegetables and fruits production in good quality. Comparing with foreign countries, overall technology ability of national facility gardening is poor due to the later start and shorter development time, and therefore environmental regulation should be enhanced. Diverse facility structure, automatic production management, mechanized operation, production intensification are the typical features in Holland, America, Japan, France and Israel. In those countries, modern industry, high technology and advanced management equip agriculture. We utilize computer and information technology to realize intelligent management of the temperature. The system adopts Labview software, wireless communications
technology and GSM technology to realize temperature auto- monitoring and alarm. It
is a good way to facility gardening automatic management.

## 2 Wireless Communications on NRF24L01

It is good for monitoring environmental from several spots due to large gardening
scale, especially in a sunny exposure and at vents. Outside environment largely
influence the temperature. So we should set more spots to collect and pay special
attention to the important spots. It is the best to adopt wireless communications and
use lower powered chip to timely send collected temperature to managing computer
due to difficult allotting the positions. In this thesis, NRF24L01 wireless receive- send
pattern as wireless communication equipment and set 6 sensors (all are 18b20) to
attache to it. The place is that respectively two positions at vents, middle and side in
the greenhouse. The collected environmental temperature is sent to store in the
computer by NRF24L01 pattern in time.

### 2.1 NRF24L01 Chip Introduction

NRF24L01 chip adopts 2.4 Ghz global ISM band comply with 126 multi- spots
and skip band communications requirement. Build- in CRC hardware error detecting
and one to many spots communications requirement. Module is able to set up address.
If only receiving this computer address, the data can be sent out(offer interrupt
directions). Directly connected with single chip to use, programming is very
convenient. Receive-send module is categorized to Enhanced ShockBurstTM,
ShockBurstTM and Direct ways, which is made up to device configuration. Four parts
as bellows:

Data width: declaring data occupied decimals in the radio frequency database. It
receives NRF24L01 to tell data of receive-send database from CRC code;

Address width: declaring address occupied decimals in the radio frequency
database. It renders NRF24L01 to tell address from data;

Address: receive data address, address of Passage 0 to Passage 5;

CRC: yield CRC check code and decoding

If use CRC technology within NRF24L01, CRC checking code should be used in
the configuration(CONFIG's ENptoCRC). Send and receive the same protocol.

Under the Enhanced ShockBurst TM pattern, use first-in and first-out stack area,
data is sent to micro controller with low speed. But it can save more energy under
high speed. Therefore, using low speed micro controller get high sending ratio as well.
All the high speed signals processing in the chip under ShockBurstTM receive - send
pattern, NRF24L01 automatically process character and CRC checking code. When
sending the data, character and CRC checking code is added. EC is high under
sending pattern. It will take 10us to send over.
## 2.2 Data Receive- send Process of NRF24L01

NRF24L01 adopts Enhanced ShockBurstTM pattern to send, it is shown as bellows:
send the address and data to NRF24L01 as time sequences;
configure CONFIG register and make it access to sending pattern;
micro controller put CE higher(at least 10us), activate NRF24L01 and send
Enhanced ShockBurstTM

EnhancedShockBurstTM sending has four steps: (1) supply electricity to ratio front; (2) Data packing ( adding character and CRC checking code ); (3) sending data package with high speed ; (4) send it over, NRF24L01 enters idle state.

Sending BYTES data procedure via NRF24L01 pattern are as follows:

```c
uchar SPI_Write_Buf(BYTE reg, BYTE *pBuf, BYTE bytes)
{
   uchar status, byte_ctr;

   CSN = 0;

   status = SPI_RW(reg);

   for(byte_ctr=0; byte_ctr<bytes; byte_ctr++)
        SPI_RW(*pBuf++);

    CSN = 1; // Set CSN high again

    return(status);
}
```

NRF24L01 adopts EnhancedShockBurstTM pattern receive- send procedure as
follow:

configure local address and be ready to receive data package;
configure CONFIG register and make it access to receiving pattern; put CE high;
after 130us, NRF24L01 enter monitoring state and waiting for data package;

When receiving right data package(right address and CRC checking code),
NRF24L01 auto- character, address and CRC check position removal;

NRF24L01 sets RX DR position of STATUS register through NRF

Read data out of NewMsg_ RF2401;

Clean STATUS register after read over all the data. NRF2401 can enter one of four
patterns.

Procedure of art NRF24L01 pattern receiving end read bytes are shown as bellows:

```c
uchar SPI_Read_Buf(BYTE reg, BYTE *pBuf, BYTE bytes)
{
   uchar status, byte_ctr;
```
CSN = 0; // Set CSN low, init SPI tranaction
status = SPI_RW(reg); // Select register to write to
and read status byte
for (byte_ctr=0;byte_ctr<bytes;byte_ctr++)
pBuf[byte_ctr] = SPI_RW(0); //
CSN = 1;
return(status); // return nRF24L01 status byte
}

## 2.3 Computer Collecting data

NRF24L01 pattern conect to sensors as data collecting. It is required to collect all the spots' environmental value per minute due to slow temperature change. In the other aspect, wireless data receive- send pattern sends temperature data to internal computer to store and analyze taking advantage of computer serial communications. NRF24L01 data is sent through single chip according to receiving address. Write the data to Labview's TDMS formats storage files by sequences. And show the temperature value collected from every sensor. The circuit drawing connected with single chip as bellows:

<figure><img src="image_2.png" /><figcaption>Fig. 1. J2 is NRF2401 wireless communications pattern, AT89S52 single chip which uses P1 foot's I/O to imitate SPI connector links NRF24L01 wireless receive-send pattern. Received temperature value attach to max232 chip and then to computer as serial P3^0 and P3^1 pin.</figcaption></figure>

# 3 Sending Over-temperature Alarm Information to User

When temperature goes above the defined value, the monitoring system should notify the user so that take measure to adjust the temperature in the condition of no
people guarded and low auto processing capability. Nowadays mobile is pretty
popular, thus send timely information to user's phone by using GSM module is a
good way. Here putting MCU into USB and then insert a SIM into MCU. When the
temperature exceeds the defined value, the software platform will transfer such
information to MCU. Finally MCU sends the information out via GSM network.

This system send messages to mobilephone via MCU, thus we should consider
phone code's compatibility. PDA pattern is a common sending or receiving SMS
information method. Most of the phones stand by this pattern. Each GSM SMS can
transfer no more than 140b data. It is enough for transfer alarm information.SMS
adopts a store-and-forward system and provides a guaranteed two-way servise. Don't
make call's connection and release. That's not collided with voice messege. We can
receive the SMS even through the phone in the conversation state still receive SMS.
It's convenient to transfer alarm information by SMS.

Computer and MCU's communications is based on virtual serial communications.
On Labview software platform, attribute set of serial communications is: baud rate
9600, 8 data bits, one stop bits, no error check. Monitoring system writes down AT
instructions via serial:

AT + CSCA =" + 8613010710500" < CR >       // set SMS
centre number

AT + CNMI = 2 ,1 ,0 ,0 ,1 < CR > //set receive-send way
via SIM card

AT + CMGF = 1 < CR > //set Text pattern

AT + CMGS =" 15951775730" < CR > // send one short
message, 15951775730 is target address

Warning! <^Z> // SMS content

AT + CMGR = 6 < CR > // read receiving SMS, suppose if
new SMS's postion in the SIM is 6

+ 861595177573 is mobile service center number in Nanjing area. The side double
quotation mark should be sent. < CR > is enter mark. Each AT instrucion is end up
with enter mark; Warning! That's the SMS content; <^Z> is CTRL + Z.SMS should
be ended up with < ^Z >. Last line is readable SMS instructions, in which 6 is SIM
index number. Once that instrucion is sent, GSM pattern sends bellow informations
back from UART interface:

+ CMGR:" REC UNREAD"," + 8615951775730"," 19/05/10,15:54:00 +
00" Warning!

It is easy to read out sender's mobilephone number,sending time and SMS
conetent.

The system writes AT intructions into virtual serial, which comes out by Labview
software. There are 6 AT instructions to write down by sequence. So each time we
respectively write down different instrutions with condition structure in the circular
struction. Procedures are as follows:
<figure><img src="image_3.png" /><figcaption>Fig. 2. The program is to write AT instructions on Labview.</figcaption></figure>

4 Making Use of Labview Software Developing System Platform

Labview is a kind of developing environment of graphic program language. It is
widely accepted by the industry and education and lab, which is considered as a
standardized data collecting and equipment control software. LabVIEW integrates the
hardware in the GPIB, VXI, RS-232 and RS-485 agreement and the entire functions
from data collecting card communications. It also contains standard library function
that is easy to apply for TCP/IP, ActiveX, etc. It makes user rapidly build self data
and analyzed system, and then system over- temperature alarm information is sent to
user via serial writing functions. TDMS data storage formats is mathematics model
specially designed for data storage. It's characterized as steady read data API and
self- configured data management tools that are used to manage data. The collected
temperature each time is stored as binary in the TDM format folder. The value from
the sensor can be find out by sequence. On the system interface, value can be traced
through replaying the data and time input . Alarm light will turn to red to remind user
that the current temperature has exceeded the defined figure. Thermometer shows the
maximized temperature value. Below is monitoring interface.

<figure><img src="image_4.png" /></figure>
**Fig. 3.** The above waveform shows temperature change curve within one day. There are 48 points in the X, one temperature is collected per half an hour. It directly shows temperature change conditions in one day. But six numbers below waveform shows current temperature by 6 sensors. Obviously, the value of Sensor 1 and Sensor 3 at the center position is lower. But the value of Sensor 5 and Sensor 6 at the corner is a little bit higher.

## 5 Conclusion

Through the analysis of the monitoring results, it turns out that, when the change of environmental temperature is large in one day, the hysteresis of temperature adjustment mainly manifested in space. In the middle position near the thermostat, sensor detects the environment temperature unchanged, equal to the set temperature. But in the corner of the greenhouse external environment, the detected temperature is affected by the temperature of external environment, there exist certain volatility. Therefore, it is necessary to install the adjusting devices at the position where the temperature is vulnerable effected by the external environment temperature, it can reduce the influence of temperature change for crops.

The control of environmental temperature in modern greenhouses is collected and analyzed by monitoring systems of facility gardening environment based on Labview software and wireless communications technology. NRF24L01 wireless receive-send model makes temperature collection come true. Moreover, managing computer makes data wireless communications become possible. Over-temperature alarm information is transmitted to user timely.

## 6 Acknowledgment

This paper is sponsored by National High Technology Research and Development Program 863 (NO:2006AA-10A301).

## References

1. Yu Haiye, Zhang Yunhe, Sun Ruidong. LabVIEW-based research of remote monitoring system for greenhouse[J]. Agricultural and Machinery Study. 75~77 (2004)

2. Qiu shi science and technology. The Navigation of Typical Module Design by MCU[M]. Posts & Telecom Press. 194~202 (2004)

3. Cheng Xihui, Zhang Yinhong. LabVIEW 8.2 Programming from Entry to Maste[M]. Tsinghua University Press. 312~315 (2007)

4. Fan Qi. Software Implementation of Intelligent Control System of Greenhouse environment based on Labview[D]. Zhejiang University. 1~2 (2004)

5. Shenzhen Yun Jia Technology Co., Ltd. NRF24L01 Manual[M]. 6~10 (2008).

6. Wu Bo, Liu Xindong, Wu Min. Research of GSM-based Universal Remote Alarm Controller. Computer Engineering and Application. 92-94 (2007)