You are on page 1of 4

2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

Construction of Intelligent Greenhouse Control System Based on CAN bus

Chen Pengzhan and Liu Baifen

College of Electrical and Electronic Engineering


East China Jiaotong University
Nanchang, China
e-mail: cyxcpz@163.com
Abstract-An intelligent greenhouse control system based on
CAN bus bas been designed according to the needs of
greenhouse control. Distributed network control structure has
been used and the main control unit uses STM32VBT6 ARM
processor as control core to fulfill the function
programming,
displaying;

command

distribution

recelvmg
node

and

of system

system

STM32CBT6

uses

status

humidity

of

the

greenhouse

and

to

control

the

implementation of the motor; thus, there are multiple control


modes of the system: either control the temperature according
to the pre-set control logic or to the climate characteristics of
the area, so that the inside temperature and humidity value
can be

maintained optimal appropriate to crop growth.

Experimental

results show

that:

the

designed

greenhouse

intelligent control system has the characteristics of stable


performance, economy, convenience and versatility, etc., and is
worthwhile to be promoted.

Keywords- intelligent greenhouse; temperature and humidity


control; distributed control system; CAN bus

I.

INTRODUCTION

In modem agriculture production, greenhouse is used to


protect crops from bad weather, providing a suitable
environment for crop farming throughout the year [l].
Therefore, it is the most effective and most economic means
to control the temperature and humidity of the greenhouse
and is of great significance for the safety of crops farming [2].
With the increasing number of greenhouse shed, its
temperature and humidity control became a hard nut. Most of
the traditional greenhouse control system used transmission
system composed of analog temperature and humidity
sensors, multi-channel analog switches, AID converter and
microcontroller. In his system, only when a large number of
measure cables are arranged in the Greenhouse, can the
sensor signals be sent to the scene collecting card, its
instaJlation and removal is complex and costly. At the same
time, since the transmitted signal is analog, it is easy to be
disturbed and lost; the measurement error is relatively large
and is not conducive to the controJler to make the right
response in time [3].
With the promotion of field bus technology in industrial
site, it is widely eyed by modem agricultural production.
Distribution FCS system is more suitable than traditional
DCS system as greenhouse environment control system [4].
A distributed intelligent greenhouse control system based on
CAN bus has been designed in this paper. By real-time

978-1-4244-723 7-6/10/$26.00 2010 IEEE

II.

ARM

processor as control core to monitor the inside temperature


and

monitoring the temperature and humidity data of each


measure point and control the implementation of the action
parts according to certain control strategies, best conditions
suitable for crop growth are available.
FUNCTIONAL ANALYSIS OF THE GREENHOUSE
CONTROL SYSTEM

Using computer technology and modem control theory to


control and regulate automatically kinds of environmental
factors, including temperature, light, humidity, etc. has
become the main form of greenhouse control. The automatic
control technique is the mainstream, which creates the most
desirable environment for crop growth according to the
growth habits of greenhouse crops and the needs of market,
some even completely get rid of the natural environment
constraints. Various greenhouse environmental data collected
by sensors, real-time monitoring system monitoring
environmental change and controlling the implementation of
agency action, a good man-machine interface make the
operation process vivid and convenient. In this control
system, growers are required to input target parameters of the
environment required by the greenhouse crop growth, then
the computer will compare the actual value measured by
sensor with the target value set in advance to determine the
controlling process of the environmental factors and control
the corresponding parts for heating, cooling and ventilation
and other activities.
The computer-controlled automatic greenhouse control
technology realized automatic production, was suitable for
large-scale production and improved labor productivity.
Setting the target value by changing the greenhouse
environment can regulate automatically the environmental
climate in the greenhouse.
Generally, automatic adjustment of the greenhouse
control system includes two types of function [5]:

Real-time data acquisition. It is an important basis


for the implementation of environmental control.
Environmental factors change in non-intuitive feel
and change at any time, so it is necessary to monitor
continuously and rapidly, obtaining a large number
of instantaneous values, which should be completed
by the data acquisition system.

Real-time decision-making. Analyze the state


amount of the collected controlled parameter and
determine the control process of the system in
accordance with the given control law. The key of
the greenhouse production process is how to achieve

VIO-63 1

2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

optimal control and management of the facilities.


Researchers should solve the following two
problems: CD study crop response to environmental
changes and establish a corresponding quantitative
relationship;
by quantitative mathematical
relationship, provide the most effective control
management strategy or plan for greenhouse
environment.
III.

Main Control Unit

ARCHITECTURE MODEL AND HARDWARE DESIGN OF


THE CONTROL SYSTEM
Figure

A.

I. Structure of distributed intelligent greenhouse control system

Architecture model of the control system

In any control system, the environmental parameters are


obtained by measuring device, then execute the control
algorithm, make appropriate control decision and start
implementation device to realize control of the system. The
CAN bus based control system distributed collection of
environment parameters variable and the functions of
controlling the implementation equipments to each CAN
network terminal [6], known as intelligent nodes. In addition,
the control system should also has functions such as: allow
users to look at the state of various environmental parameters'
monitor the working state, the current time display, change
.
the environmental parameters within a certain range and
operate the process of the entire control system and so on.
ItlIigen control system, based on functional analysis, is
diVided mto two parts structurally: the coordination
anagement and distributed monitoring layer, as shown in
Figure 1.
Funtionally,
the coordination management is
responSible fr monitoring operation of the entire system,
data prcesmg, management
decision making, and
c?mumcatmg data and command with other layers; the
dlstnbued conrol layer is capable of collecting and
controlling on-site data of environmental factors and CAN
bus communication and it can transmit kinds of parameters
with control layer and other CAN control nodes and send and
receive commands and data from the control layer to adjust
and change the control state.
Master node, the control core of greenhouse coordination
control layer, selected ST's COTEX-M3 core, ARM chip
STM32VBT6 as the main control chip, its built-in CAN
controller cn handle all CAN2.0B standard frame type. As
.
the mam chip STM32VBT6 efficient RISC 32-bit instruction
set, through the on-chip PLL phase-locked loop, the
.
maximum operating frequency up to 96MHz, consistent with
real-time control requirements of the greenhouse.
The distributed measurement and control layer conduct
real-ie detection of environmental temperature and
humllty and process and analyze the acquired data, conduct
realtIme control each temperature and humidity control
.
eqUipment m accordance with the requirements. At the same
time, it is responsible to monitor management of the whole
system.

Distributed measurement and control layer is composed


of a number of independent controllers which take
STM32F103CBT6 MCU as core. it receives the various
operation control commands and set parameters through
CA bus; conduct real-time collecting temperature,
.
humidity value of various analog input channels' control the
switch state signals of air conditioning equipmet; detect the
emperature and hu:nidity inside the greenhouse by sensors;
Judge the detected mformation; send the results promptly to
master control node through the CAN bus.
he master n?de of the system, by calculating the
recelve data, achieved a precise control value, passed on to
appropnate nodes to perform, monitor and control the start or
sto of the equipments in all regions, thus ensuring the
environmental temperature and humidity in the region
remain within the required level.
B.

CAN Bus Transceiver Circuit Design

The system used MAX905 as a CAN bus transceiver


circuit. a certain part of the safety and anti-jamming
measures have also been adopted at the interface of
MAX905 and the CAN bus. The CANH and CANL pin of
MAX9?5 connected with the CAN bus through their
respective common mode choke to protect MAX905 from
the impact of over-current. Between ground and CANH and
CANL, 30pF capacitor is connected in parallel playing the
role of filtering the bus high frequency interference and anti
electromagnetic radiation. Between the bus access and
ground: protection diode ha been connected reversely,
.
respectively, protectmg MAX905 from a risk of transient
high pressure. The resistance value between the 8-feet of
MA90 and the ground determines whether the system is
workmg m the mode of high speed or slope control. The size
of the resistor can be adjusted according to the bus speed.
Connecting resistor 120 at both ends of CAN bus access to
match the impedance and ignoring access will greatly
reduced the anti-interference and reliability of data
communication, even impossible to achieve data
communication [7].
C.

Temperature sensing circuit

DS18B20, an intelligent digital temperature sensor


produced by DALLAS, uses one-line interface. It can not
only communicate but also supply power through the data
line and it will only take one 10 port of microcontroller. And
DS18B20 will converse the measured temperature signal to

VlO-632

2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

digital output, which can be connected with the micro


controller directly and greatly simplifies the circuit design.
DSI8B20 itself has command set and memory [8].
Microcontroller, by issuing control commands, reads and
writes memory on the DS18B20 to complete temperature
measurement.
D.

Humidity Detection Circuit

SHT10 single-chip digital temperature and humidity


integrated sensor, produced by Switzerland Sensirion
company, use CMOS process micro-processing patent to
ensure that products with high reliability and excellent long
term stability [9]. The sensor consists of a capacitive
measuring wet polymer component and a gap-type
temperature component, and it seamlessly integrates with a
14-bit A / D converter and a 2-wire digital interface in a
single chip, making the product has the advantages of low
power consumption, fast response, strong anti-interference
ability. So in this article, SHT10 sensor is used collect
greenhouse humidity.
IV.

ApPLICATION PROTOCOL AND SYSTEM SOFTWARE


DEVELOPMENT

A.

Application Protocol development

In the CAN bus specification, it only provides data link


layer and physical layer, but does not require the application
layer. So when users design application software, they must
first design appropriate application protocol CAN-bus
according to the requirements to complete accurate and
reliable data transmission. At present, the more popular high
level CAN protocol includes CANOpen, 11939, DeciceNet
and so on [10]. These high-level agreements all give a
complete and detailed definition on the CAN bus application
layer. However, in some cases, where simple communication
agreement would meet the requirements , the use of complex
protocols sometimes will result in waste of resources , the
user may find its inconvenience in its application and may
even limit flexibility of the CAN bus. Therefore, in practical
applications, Designers should also, according to the
requirement, self-define a simple and effective protocol to
achieve the required function.
To ensure proper resolution of the data instruction in the
process of the greenhouse control system, this article studies
the design requirements in the greenhouse control system
and made the following definitions: as in protocol, ID format
of CAN bus extension frame is shown in Table I.
TABLE!

CAN Bus EXTENSION FRAME ID FORMAT

ID number

value

Content

28-26

0001

Message type

25-24

01

Action command

23-21

Reservation

20-16

00001

Port address

15

Action Type

14-6

Reservation

5-0

000001

Cell controller node number

ID number is the 3 bits in 28


26 which indicate
message type, its value are OIl (the type of control packet).
ID number is 25 24 bits which means action command, its
value is 01, indicate open the outside port, and 10 close the
external port. ID No. is 5 bits in 20 -16, for port address, 26
ports, the agreement use five bits to set the port. ID number
is 15-bit that indicates action type, defining whether the
output port contains time control. The last six bits for
corresponding node number of cell controller.

B.

the master node software design

A requirement on real-time monitoring system is


relatively high. In order to improve the efficiency of program
development and maintain the portability and robustness of
programs, the operating system uC / OS-II of the embedded
GUI package has been ported to the system.
Using modular software design methods, the system
divided application program into several relatively
independent modules, each module arranged appropriate
entry and exit parameters, making it is convenient for the
connection between the modules and portfolio flexibility and
each module coordinate under the operating system
scheduling. Master node software mainly includes:
temperature and humidity data reception, temperature and
humidity sensor linearization correction, keyboard input,
measurement data display, output control, CAN bus
communication etc.
Since most of the greenhouse temperature and humidity
control equipment are switch equipment, the system control
algorithm using Bang-Bang control, that is, by setting the up
and low limits on of the charged amount to control start or
stop of various devices and use air conditioning as the
temperature control equipment; spray machines and
ventilators as humidity control equipment.
C.

Distribution node Software design

Distribution node completes the sampling and binary


implementation of temperature and humidity sensor; the
software is made up of the initialization, data transmission
and data reception. When the master node requests the data,
transmit the temperature and humidity data obtained at the
detected region and the data of CAN node status to the
master node. To improve the efficiency of programs,
interrupts manner is used in data transmission and data
reception. The software flow diagram is shown in Figure 2:
The experimental greenhouse including a zone equipped
with temperature, humidity, light, C02 and other sensors,
and installed wind direction, wind speed and other
meteorological sensors. Control equipments include: the top
window, internal blinds, external blinds, side windows,
circulation fan, fan, etc. Implementing agencies include:
motor, switch, solenoid valve, etc. The system monitors on
line the temperature and humidity inside and outside the
greenhouse, outdoor wind speed and direction, and controls
equipment running according to the expert set value.
The collected real-time values of environmental factors
for each sensor are monitored online through this interface,
the working status of each control device is recorded and the

VlO-633

2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

data curve is displayed. The physical verification of


greenhouse control system is shown in Figure 3.

51.70

52.27

5180

52.48

0.68

51.90

52.61

0.71

0.57

By data Calculatmg, the detectIOn accuracy of


temperature and humidity has been achieved, we can see that
the temperature control error is less than 0.3 "C; humidity
control error is less than +2% RH. The system can realize the
real-time detection of greenhouse temperature and humidity
and automatic control, getting a good crop production
environment, making it a marked improvement in production
efficiency.
V.

Figure 2.

CONCLUSION

With the wide application of field bus technology,


intelligent greenhouse control will sure become a trend. In
this paper, distributed intelligent greenhouse control system
was constructed by using CAN-bus as the underlying
network, using the distribution nodes to collect data of
temperature and humidity inside the greenhouse and control
the movement of external equipments to realize the control
process of greenhouse temperature and humidity. The
experimental results show that the intelligent greenhouse
control system based on CAN bus is simple to wire and the
system controller is stable, data transmission is highly
reliable. The system has potential market significance.

Flow chart of the software of the slave node

REFERENCES

Figure 3.

Physical verification of Intelligent greenhouse control system

TABLE II.

[1]

Du Shangfeng, Ying-Xia Li, Ma Chengwei.China's greenhouse


environment control system research [3]. Process of agriculture,
2004,20 (I) 7 - 12.

[2]

Jing Qian. Industrial control computer in the automatic control of


greenhouse sensors [1]. Industrial Computer, 2000,13 (I): 16 - 18.

[3]

Yang Weizhong, Wang Yiming, Li Haijian. Ideas based on field bus


intelligent control system of distributed greenhouse [J). Agricultural
Engineering 2006,22 (9)

[4]

Yang Xian Hui. Fieldbus technology and its application [M].


Tsinghua University Press, 1999

[5]

Du Shangfeng, Sun Ming, Dong Qiao Xue. Intelligent Control Theory


and Applications [M]. Beijing: China Agricultural University Press,
2005.

EXPERlMENTAL DATA OF TEMPERATURE CONTROL

Set temperature

test temperature

eC)

eC)

temperature control
error eC)

[6]

Jonas Berge. Fieldbus Control System


Instrumentation and Control, Vot51, 1996

25.10

25.25

0.10

[7]

25.20

25.37

0 17

Wu Kuan-ming. CAN bus system design principles and applications


[M]. Tsinghua University Press, 1996

25.30

25.51

0.21

[8]

25.40

25.50

0.10

25.50

25.72

0.22

Wang Baoqin, Chang-Sheng Fan, Van-Ling Guo. Microcontroller


based Temperature and Humidity Control System [J]. Forestry
Machinery & Woodworking Equipment, 2008,36 (3): 39 - 41.

25.60

25.68

0.06

[9]

25.70

25.93

0.23

Fei Meng, Detecting and. Temperature and humidity measuring


instrument [J]. Electronic Technology, 2008 (I): 47 - 49.

25.80

25.98

0.18

TABLEm

Test humidity

Humidity control

C%RH)

C%RH)

error C%RH)

5120

5185

0.65

5130

52.34

0.04

51.40

52.62

1.22

5150

52.37

0.87

51.60

52.73

1.12

Advances

in

[10] Rao Yuntao, wrinkle Jijun, Zheng Yongyun. Fieldbus CAN Theory
and Applications [M]. Beijing: Beijing University of Aeronautics and
Astronautics Press, 2004.

EXPERlMENTAL DATA OF HUMIDITY CONTROL

Set humidity

[J].

VlO-634