application of zigbee-wsn technology for indoor ... · advancement which is considered as important...

9
AbstractThe four factors that affect comfort of human living are environmental temperature, humidity, light intensity and CO2 concentration in the air. Therefore, in order to intelligently control and improve living environment in real-time monitoring method, a kind of indoor environmental parameter monitoring system is proposed in this paper, which based on ZigBee Wireless Sensor Network. Firstly, we choose the CC2530F256 microprocessor as the main control chip. Secondly, we select the DS18B20 as temperature sensor, the HM1500LF as humidity sensor, the Cds photosensitive resistance LXD3526 as photoelectric sensor and the MG811 as CO2 gas sensor. And then, all the environmental parameters collected from smart home are uploaded to upper PC monitor which belongs to monitoring center for display. After determining device selection, we complete system hardware design by use of Designer Altium 6.9, according to design philosophy of function modularization. This system hardware design mainly consists of three parts, including end device node, router node and coordinator node. Then, this system software design is completed in integrated development environment of Embedded Workbench for IAR 8051 V8.10 by using structured programming ideas. And the main function of this program is to complete collection, display, transmission, alarm and communication tasks of indoor environmental parameters. Afterwards, a test platform is set up, which can carry on testing of all functional modules and overall performance for indoor environmental parameter monitoring system. The test results show that this system can complete predetermined functions with high reliability and practical value, which also providing a reference example of design and development for similar products. Index TermsZigBee; Wireless Sensor Network; indoor environmental parameter monitoring system I. INTRODUCTION nternet of Things (IoT) is yet another technological advancement which is considered as important and revolutionary as invention of personal computers and Internet. Smart home is one of the most popular and trendy IoT applications. Home automation integrated with various sub-systems (such as intelligent building, communication networks, environment monitoring, entertainment video, smart household appliances and lighting) is just what smart Manuscript received May 22, 2019; revised June 27, 2019. This work was supported in part by the Science Foundation of Heze University (No. XY18KJ11). Lingjie KONG is with the Institute of Physics and Electronic Engineering, Heze University, Heze Shandong 274015, China(e-mail: [email protected]) home does. It helps people get more comfort, security, better health and intelligent living or working environment in the house [1] [2]. Environmental monitoring includes the collection and transmission of data from various appliances and is a key part that ensures normal operation of the smart home system. However, a question whether we can effectively achieve real-time monitoring of indoor environmental parameters has arisen as a prominent issue and needs to be resolved. With the rapid development of sensor technology, wireless communication technology and micro electrical-mechanical system technology, it is possible to establish a wireless sensor network which composed of intelligent micro sensor interconnection. Besides, the ZigBee technology, as a new wireless communication technology, has such characteristics of low power consumption, low cost and strong self-organization, so that it is completely suitable for data transmission in wireless sensor networks [3] [4]. At the same time, for one thing, under comprehensive utilization of computer technology, communication technology and measurement and control technology, the main purpose of the indoor environmental parameter monitoring system is to realize collection, recording and display for all kinds of physical parameters, and to change these analog signals into digital quantity. For another, the main purpose of the indoor environmental parameter monitoring system is to give processed data and results back to the user or the control center [5] [6]. As a result, this paper introduces a kind of indoor environmental parameter monitoring system that based on ZigBee Wireless Sensor Network. So as to realize wireless data acquisition, real-time monitoring and transport control of indoor environmental parameters for smart home by using ZigBee network technology, which ultimately having a great practical significance for improving people's living environment and offering technical support for practical and distributed wireless environmental parameter monitoring system that built in other specific occasions or complicated conditions. II. ZIGBEE TECHNOLOGY OVERVIEW A. Brief introduction of CC2530F256 The ZigBee technology has a low cost, low power consumption, small size, large network capacity, and strong security features, and it is very conducive to the construction of a wireless sensor network. This distributed wireless Application of ZigBee-WSN Technology for Indoor Environmental Parameter Monitoring System Lingjie KONG I IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23 (Advance online publication: 20 November 2019) ______________________________________________________________________________________

Upload: others

Post on 16-Mar-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

Abstract— The four factors that affect comfort of human living

are environmental temperature, humidity, light intensity and

CO2 concentration in the air. Therefore, in order to intelligently

control and improve living environment in real-time monitoring

method, a kind of indoor environmental parameter monitoring

system is proposed in this paper, which based on ZigBee

Wireless Sensor Network. Firstly, we choose the CC2530F256

microprocessor as the main control chip. Secondly, we select the

DS18B20 as temperature sensor, the HM1500LF as humidity

sensor, the Cds photosensitive resistance LXD3526 as

photoelectric sensor and the MG811 as CO2 gas sensor. And

then, all the environmental parameters collected from smart

home are uploaded to upper PC monitor which belongs to

monitoring center for display.

After determining device selection, we complete system

hardware design by use of Designer Altium 6.9, according to

design philosophy of function modularization. This system

hardware design mainly consists of three parts, including end

device node, router node and coordinator node. Then, this

system software design is completed in integrated development

environment of Embedded Workbench for IAR 8051 V8.10 by

using structured programming ideas. And the main function of

this program is to complete collection, display, transmission,

alarm and communication tasks of indoor environmental

parameters. Afterwards, a test platform is set up, which can

carry on testing of all functional modules and overall

performance for indoor environmental parameter monitoring

system. The test results show that this system can complete

predetermined functions with high reliability and practical

value, which also providing a reference example of design and

development for similar products.

Index Terms—ZigBee; Wireless Sensor Network; indoor

environmental parameter monitoring system

I. INTRODUCTION

nternet of Things (IoT) is yet another technological

advancement which is considered as important and

revolutionary as invention of personal computers and Internet.

Smart home is one of the most popular and trendy IoT

applications. Home automation integrated with various

sub-systems (such as intelligent building, communication

networks, environment monitoring, entertainment video,

smart household appliances and lighting) is just what smart

Manuscript received May 22, 2019; revised June 27, 2019. This work

was supported in part by the Science Foundation of Heze University (No.

XY18KJ11).

Lingjie KONG is with the Institute of Physics and Electronic Engineering,

Heze University, Heze Shandong 274015, China(e-mail:

[email protected])

home does. It helps people get more comfort, security, better

health and intelligent living or working environment in the

house [1] [2]. Environmental monitoring includes the

collection and transmission of data from various appliances

and is a key part that ensures normal operation of the smart

home system. However, a question whether we can effectively

achieve real-time monitoring of indoor environmental

parameters has arisen as a prominent issue and needs to be

resolved.

With the rapid development of sensor technology, wireless

communication technology and micro electrical-mechanical

system technology, it is possible to establish a wireless sensor

network which composed of intelligent micro sensor

interconnection. Besides, the ZigBee technology, as a new

wireless communication technology, has such characteristics

of low power consumption, low cost and strong

self-organization, so that it is completely suitable for data

transmission in wireless sensor networks [3] [4]. At the same

time, for one thing, under comprehensive utilization of

computer technology, communication technology and

measurement and control technology, the main purpose of the

indoor environmental parameter monitoring system is to

realize collection, recording and display for all kinds of

physical parameters, and to change these analog signals into

digital quantity. For another, the main purpose of the indoor

environmental parameter monitoring system is to give

processed data and results back to the user or the control

center [5] [6].

As a result, this paper introduces a kind of indoor

environmental parameter monitoring system that based on

ZigBee Wireless Sensor Network. So as to realize wireless

data acquisition, real-time monitoring and transport control of

indoor environmental parameters for smart home by using

ZigBee network technology, which ultimately having a great

practical significance for improving people's living

environment and offering technical support for practical and

distributed wireless environmental parameter monitoring

system that built in other specific occasions or complicated

conditions.

II. ZIGBEE TECHNOLOGY OVERVIEW

A. Brief introduction of CC2530F256

The ZigBee technology has a low cost, low power

consumption, small size, large network capacity, and strong

security features, and it is very conducive to the construction

of a wireless sensor network. This distributed wireless

Application of ZigBee-WSN Technology for

Indoor Environmental Parameter Monitoring

System

Lingjie KONG

I

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 2: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

temperature monitoring system uses the CC2530F256

microprocessor as its core chip, which is meeting the current

ZigBee technology standards for TI company in recent years.

Meanwhile, it belongs to a CMOS SOC chip, embedded with

high performance and low power consumption of enhanced

8051 microcontroller core, and integrated the 14 bit

analog-to-digital conversion module and RF wireless

transceiver (using 2.4 GHz) that conformed to the IEEE

802.15.4 standards. Therefore, the CC2530F256

microprocessor has excellent wireless receiver sensitivity and

strong anti-disturbance ability [7].

B. Brief introduction of ZigBee protocol

Although the ZigBee protocol is based on lEEE 802.15.4

technical specifications, but the IEEE 802.15.4 technical

specifications only deal with lower MAC layer and physical

layer protocol, and the ZigBee alliance standardizes network

layer protocol and API. Furthermore, the ZigBee alliance has

also developed a security layer to ensure that this portable

device does not accidentally leak its identity, which making

long-distance transmission will not be obtained by other

nodes in network [8] [9] [10]. And then, the ZigBee protocol

has divided the network nodes into three kinds of equipment

types, such as coordinator node, router node and end device

node, so that its typical functions are shown in TABLEⅠ.

TABLEⅠ Equipment types and typical functions.

Equipment

types Typical functions

Coordinator

node

Only one in network; Used to build

network, distribute network address,

and set up save-binding table.

Router node

Optional; Allow multiple nodes to join in

network; Used to extend the physical

scope of network and complete

monitoring and control function.

End device

node

Complete monitoring or control function.

The ZigBee protocol is realized by ZigBee protocol stack.

And the ZigBee protocol stack as a complete protocol

specification, its organization of wireless sensor network, join

and exit of node, routing algorithm, network topology and

each layer of services are defined in detail. Thus, it is

convenient to quickly establish wireless sensor network,

which eliminating the need for a large number of network

workload [11].

This IEPMS adopts the ZigBee protocol stack

(ZStack-CC2530-2.3.0-1.4.0) that developed by TI company,

and also is one of the most widely used ZigBee protocol stack

at present. As a software platform for system design, it is

convenient to establish a wireless sensor network that belongs

to distributed wireless temperature monitoring system, so as

to provide users with a powerful and complete solution for

ZigBee technology.

III. OVERALL DESIGN OF SYSTEM

According to the characteristics of actual monitoring area

for smart home, this indoor environmental parameter

monitoring system uses multi-point collection and distributed

system, so that the indoor environmental parameter data can

be monitored from different locations, which helping us to get

more monitoring information. And this system mainly

includes four parts, such as end device node, router node,

coordinator node and upper PC monitor. Only in this way, we

can complete data acquisition and transmission, ZigBee

network establishment, network management and

maintenance functions for indoor environmental parameters.

The overall design structure block diagram of this system is

shown in Fig. 1.

From Fig.1, we can see that the end device node are

distributed in monitoring area for real-time monitoring of

indoor environmental parameters, and the location of end

device node also can be adjusted according to actual needs in

effective communication range of the router node. And the

router node with routing function, can be used to relay and

expand ZigBee network scale. Above all, the coordinator

node is the transmission and control core for this system, and

it can make communication with other router node or end

device node through wireless way, which achieving indoor

environmental parameters information that obtained by router

node or end device node. Then, the coordinator node

transmits these data to upper PC monitor for data display and

management.

IV. HARDWARE DESIGN OF SYSTEM

A. Hardware design of end device node

End device node is the most frontier of data acquisition for

indoor environmental parameters.

It is based on CC2530F256 microprocessor of ZigBee chip

as the core, composed with the temperature sensor module,

humidity sensor module, photoelectric sensor module and

CO2 gas sensor module. And the hardware design structure

block diagram of end device node is shown in Fig. 2.

Zigbee end device

Upper computer PC

Zigbee router

Zigbee coordinator

Fig. 1. Overall Design Structure Block Diagram of This System.

CC2530F256

microprocessor

Temperature sensor

DS18B20

CC2530F256 socket

board and slot circuit

Humidity sensor

HM1500LF

Photoelectric sensor

LXD3526

CO2 gas sensor

MG811

Power circuit

JTAG interface circuit

Sound and light

alarm circuit

CC2530F256 minimum

system control circuit

Fig. 2. Hardware Design Structure Block Diagram of End Device Node.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 3: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

CC2530F256 Main Control Module. Among this indoor

environmental parameter monitoring system, such as four

parts of the power circuit, JTAG interface circuit,

CC2530F256 socket board and slot circuit and CC2530F256

minimum system control circuit can be referred to as

CC2530F256 main control module. And the hardware design

circuit of CC2530F256 main control module is shown in Fig.

3.

Temperature Sensor Module. The indoor environmental

parameter monitoring system uses single-bus intelligent and

digital temperature sensor DS18B20 to accomplish collection

of temperature information. It is a sensor that launched by

United States DALLAS corporation. Its power supply voltage

range is 3V to 5.5V, and its temperature measurement range is

-55℃ to +125℃ [12]. As a new type of intelligent and digital

temperature sensor, the DS18B20 could directly output

digital quantity, with the help of internal integrated

temperature sensor module, A/D conversion module and

single data output control module. That’s making it easy to

connect single-chip or other microprocessors with simple

interface circuit and easy expansion. Accordingly, the

DS18B20 could be widely used in long distance, multi-node

and distributed temperature detection field [13] [14]. The

hardware design circuit of temperature sensor module is

shown in Fig. 4.

Fig. 4 also shows that the DS18B20 can be connected to

general I/O port P1.7 of cc2530f256 microprocessor only by a

single bus connection mode. Because the temperature sensor

DS18B20 has unique product serial number, therefore, it can

also be easy to accomplish the task of distributed multi-point

temperature monitoring based on single point temperature

monitoring task.

Humidity Sensor Module. The indoor environmental

parameter monitoring system uses HM1500LF as its humidity

sensor. It belongs to a kind of linear voltage output and

integrated humidity sensor, which is a production of French

Humirel company. By using 5V power supply with constant

pressure, the HM1500LF can output a proportional

relationship between voltage level signal and relative

humidity. Moreover, the HM1500LF has many outstanding

characteristics, such as built in amplifying circuit, fast

response speed, good repeatability and strong

anti-interference ability and so on [15]. The hardware design

circuit of humidity sensor module is shown in Fig. 5.

Photoelectric Sensor Module. The indoor environmental

parameter monitoring system employs CdS photoresistor

LXD3526 as its photoelectric sensor. Its bright resistance

(when the sun is in direct sunlight) is only 8KΩ to 20KΩ, and

its dark resistance (when there is no visible light) can be up to

0.5 MΩ. When photoresistor LXD3526 is connected with 51

KΩ resistor R7 in series way, then the 3.3V would be

decomposed into two parts voltage. So, the voltage value

obtained by both ends of photoresistor LXD3526 can be used

to represent light intensity [16]. The hardware design circuit

of photoelectric sensor module is shown in Fig. 6.

CO2 Gas Sensor Module. The indoor environmental

parameter monitoring system adopts MG811 as its CO2 gas

sensor. When CO2 concentration in the air is higher, the

output voltage of MG811 is lower. And when CO2

concentration in the air is lower, the output voltage of MG811

is higher. Due to CO2 concentration in the air is generally

300ppm to 1500ppm, corresponding with MG811 output

voltage for 325mV to 300mV. Therefore, the MG811 output

U3 HM1500LF

GN

D

VD

D

Uo

W1 W2 W3 P0.4

5VD

Fig. 6. Hardware Design Circuit of Photoelectric Sensor Module.

2

1

JP1

U1(DS18B20)

DS18B20 CN

P1.7

3.3VD

R6

4.7K21 3

VD

D

I/O

GN

D

Fig. 4. Hardware Design Circuit of Temperature Sensor Module.

GND2

1

3

5

4

6

8

7

9

10P1_1DVDD2

P1_2P1_3

GND

P1_4

P1_5

GND

GND

P1

_0

12

11

13

15

14

16

18

17

19 20

P0_

0R

ST

P0_

1P

0_

2

P0

_5

P0_

3P

0_4

P0_

6

P0_

7

AV

DD

6

39

38

36

37

35

33

34

32 31

DV

DD

1D

OO

UP

L

P1_

6P

1_

7

P2

_0

P2

_3

/32K

OS

C2

P2

_4

/32K

OS

C1

AVDD3

29

30

28

26

27

25

23

24

22

2132MOSC1

AVDD5

32MOSC2

RF_N

RF_P

AVDD1

AVDD4

P1_5

P1_4

P1_3

P1_2P1_1

P1

_0

P0

_7

P0

_6

P0

_5

P0

_4

P0

_3

P0

_2

P0_

1P

0_

0

AVDD2

RBIAS

40

P2

_1

P2_

2

P1

_6

P1

_7

P2

_0

P2

_1

P2

_2

CC2530F256

V3.3

C16

0.1uF

1uF

C5

V3.3C3

1uF

C4 C2

15pF 15pF1 2

3

Y1 Y32768

V3.3

C1

0.1uF

R1

56K

C6

0.1uF

C7

0.1uF

V3.3

C9

18pF

C11

18pF

C10

2.2pF C14

0.3pFC13

18pF

L2

2.2uH

C12

1pF

C8

1pF L1

2.2uH

SMA1

V3.3

C15

0.1uF

Y2

32M

C17

27pF

C18

0.1uF 1 C19

27pF

234

2

1

3

1

2

3

P1

5V

5V

GND

F15V

FUSEC21 D1

1N4007

5V

0.1uF

GND

U2

1117-3.3VVDD

C22

0.1uF

47uF

C6C4

47uF

Vin Vout3.3VD

2

1

3

JTAG1

3.3VD 3.3VD

1uF

C4

SW3

P2.2

5

4

6

8

7

9

10

X

P2.1

X

X

X

X

14

32

R5

20K

JTAG

21

22

20

RESET

P1_3

18

19

17

15

16

14

13

Zigbee

2

1

3

5

4

6

8

7

9

10

Zigbee-Board

11 12

P1_4

P1_5

GND

V3.3

P1_6R2

P2_1

P2_2

P1_7

P1_0

P0_7

P0_6

P0_5

P0_4

P0_3

P0_1P0_0

RST

P0_2

P1_1

P1_2

300R LED1

P2_0

C20

P0.7

P1.1P1.0

P0.6P0.5

P0.2/ RXD

P0.4

P0.3/TXD

P0.1

P0.0

P1.5

P1.3P1.4

GND

VDD3.3

P2.0

P1.6P1.7

P2.1

P2.2

P1.2

V3.3

1uF

R4

10K

R3

10K

2

1

3

RESETP0.0

0.1uF

C10

5

4

6

8

7

9

10

JP7

2

1

3

5

4

6

8

7

9

10

JP6

11 11

P0.1

P0.2

P0.3

P0.4

P0.5

P0.7

P1.0

P1.1

P0.6

P1.3P1.4

P1.5

GND

3.3VD

P1.6

P2.0

P2.1

P2.2

P1.7

P1.2

Fig. 3. Hardware Design Circuit of CC2530F256 Main Control Module.

U3 HM1500LF

GN

D

VD

D

Uo

W1 W2 W3 P0.4

5VD

Fig. 5. Hardware Design Circuit of Humidity Sensor Module.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 4: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

voltage will be amplified through CA3140 for 3 times, which

entering into CC2530F256 microprocessor for sampling. The

hardware design circuit of CO2 gas sensor module is shown in

Fig. 7.

Fig. 7 also shows that the supply voltage of MG811 is 6V,

which can be supplied by 220V to 6V power adapter.

Sound and Light Alarm Module. The indoor

environmental parameter monitoring system selects a

piezoelectric passive buzzer as its sound and light alarm

module. When the temperature, humidity, light intensity and

CO2 concentration are less than preset upper limit value or

greater than preset lower limit value, we can control

CC2530F256 microprocessor pin P2_0 to output high level

by programming, so that the buzzer does not work. On the

contrary, when the temperature, humidity, light intensity and

CO2 concentration are greater than preset upper limit value or

less than preset lower limit value, we can control

CC2530F256 microprocessor pin P2_0 to output low level by

programming, and then drive buzzer to achieve automatic

sound alarm function for indoor environmental parameter

information. Besides, in order to accurately identify sound

alarm that corresponding to different types of indoor

environment parameters, this indoor environmental parameter

monitoring system also uses LED as a flashlight alarm module.

And it is a solid state semiconductor device which can directly

convert electrical energy into light energy. The hardware

design circuit of sound and light alarm module is shown in Fig.

8.

B. Hardware design of router node

The router node allows the end device node to join the

network, routing the data and assisting the end device node

with wireless communication. That means the router node

controls the ZigBee network. The actual indoor

environmental parameter monitoring process may be affected

by many factors, and may end up shortening the distance of

the data message sent by the end device node. Consequently,

an appropriate increase in the number of router nodes can

create a "jump" transmission for data collected by end device

nodes. At this point, the router node would establish a

message forwarding the channel between the coordinator

node and the end device node, expanding the monitoring

scope for the ZigBee network [17] [18]. However, because all

the monitoring data from the end device node are uploaded by

the router node, the data processing workload is relatively

large and the energy consumption is correspondingly higher.

The hardware design structure block diagram of the router

node is shown in Fig. 9.

Fig. 9 also shows that the router node and end device node

bear resemblance in hardware structure design, though the

latter additionally has four kinds of sensor modules and a

sound and light alarm module. In short, the router node

hardware design is basically consistent with that of the end

device node, and the specific circuit design is shown in Fig. 3.

C. Hardware design of coordinator node

The coordinator node has two main purposes: to use the

wireless communication module to control the data

acquisition occurring at the end device node, and to use the

serial data bus to transfer these collected records to the upper

PC monitor of the monitoring system. Fig. 10 depicts the

hardware design structure block of the coordinator node.

From Fig. 10, we can see that the coordinator node and end

device node have the same essential hardware structure

design, though the latter additionally has four kinds of sensor

modules and a sound and light alarm module, while the

former has a RS232 serial conversion circuit for serial data

communication. In short, the coordinator node hardware

design is basically consistent with that of the end device node,

and the specific circuit design is shown in Fig. 3.

However, the hardware design circuit of RS232 serial

conversion module is shown in Fig. 11.

CC2530F256

microprocessor

CC2530F256 socket

board and slot circuit

Power circuit

JTAG interface circuit

CC2530F256 minimum

system control circuit

RS232 serial

conversion circuit

Monitoring center

Upper PC monitor

Fig. 10. Hardware Design Structure Block Diagram of Coordinator

Node.

CC2530F256

microprocessor

CC2530F256 socket

board and slot circuit

Power circuit

JTAG interface circuit CC2530F256 minimum

system control circuit

Fig. 9. Hardware Design Structure Block Diagram of Router Node.

R16

P2.0

3.3VD

1K

LED1

R18P1.2

1K

LED3

R19P1.3

1K

LED4

R17P1.1

1K

LED2R15

470

R1322K

Q1

1

2

1

2

LS1

P1.0

3.3VD

Fig. 8. Hardware Design Circuit of Sound and Light Alarm Module.

GND GNDGND

GND GND

GND

R8

10kΩ

R10

10kΩ

R9 10kΩ

R11 20kΩ

12

3 45

62

31 4

5

687

12

3

4

8

6V

6V

C24

104

C25

104

C26

104

LM393CA3140

MG811

6VF26V

FUSE

C27 D2

1N4007

6V

0.1uFP0.4

Fig. 7. Hardware Design Circuit of CO2 Gas Sensor Module.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 5: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

V. SOFTWARE DESIGN OF SYSTEM

The development environment of this system software

design is IAR Embedded Workbench for V8.10 8051, and the

communication protocol uses ZigBee 2007 protocol stack.

After using IAR software to open the project file

MyfirstApp.eww in protocol stack, the network architecture

of entire protocol stack is shown in Fig. 12.

A. Software design of end device node

Before the end device node can be activated, it requires

specific information through the built-in erasable,

programmable, read-only memory (EPROM). It is also

necessary to call the Write_Configuration ( ) function for

configuring device properties to DEV_END_DEVICE and

configuring the device’s startup mode to initiate automatically

when the power turns on [19] [20]. In addition, the

My_Task_Process_Event ( ) function can be configured in the

end device node’s application layer. The software design flow

of the end device node is shown in Fig. 13.

Fig. 13 also demonstrates that when the end device node’s

power turns on, this node will initialize, starting up all units in

the hardware. After initialization, this node will search the

network signals to trigger the AF_DataRequest ( ) function

that joins the node to a network. Once the router and

coordinator nodes send a valid response, the end device node

will call several functions—DS18B20_GetTem ( ),

HM1500LF_GetHumi ( ), LXD3526_GetLight ( ), and

MG811_GetCO2 ( ) to read temperature data, humidity data,

light intensity data, and CO2 concentration data, respectively.

The end device node’s software design is predicated on the

query method. First, we divide this system into modules

according to system functions. Second, we compile relevant

subroutines according to the functions of these modules. Last,

we implement subroutines for system self-checking, indoor

environment parameter monitoring, and serial communication

with the main program.

System Self-checking Subroutine. The function of this

system self-checking subroutine is to complete function test

for the four types of sensors, so as to test whether the four

types of sensors are working properly or not, and to collect the

data in system working environment with selecting an

appropriate data weight.

After power on, this system firstly call system self-test

function of system_check ( ) to carry out self inspection. Prior

to self inspection, the program will go through a delay of

about 500μs to prevent this system from reading error caused

by instability when starting. And afterwards of self inspection,

the program will start A/D converter of the four types of

sensors in turn and read the corresponding sensor data.

As can be seen in Fig. 4, Fig. 5, Fig. 6 and Fig. 7, if the

temperature sensor or humidity sensor or photoelectric sensor

appears malfunction, even it is pulled out. The input voltage

of the A/D converter for CC2530F256 microprocessor will be

set as 3.3 V, and its corresponding conversion result is 8192.

Then this data will be used as a criterion for judging whether

these sensors are working correctly or not. While if the CO2

gas sensor fails or it is pulled out, the input voltage of the A/D

Detect temperature data,

humidity data, light

intensity data and CO2

concentration data

Transmit temperature data,

humidity data, light

intensity data and CO2

concentration data

Start

initialization

Transmit network signal

Join in network?N

Y

Fig. 13. Software Design Flow of End Device Node.

Fig. 12. Network Architecture of TI Z-Stack 2007.

5

J1

MAX232

C42V-

3.3VD

C2-

T2IC2+

R2OR1I

GNDT1O

V-C1-

T2OC2+

T2IR1O

VCCT1I

6

410

913

1415

X

16111287132

XXX

0.1uF

C44

0.1uF

C37

0.1uF

C43

0.1uF

3.3VD

1

62

3

7

4

8

5

9

10

11

X

X

X

X

X

X

DB9

Fig. 11. Hardware Design Circuit of RS232 Serial Conversion Module.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 6: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

converter for CC2530F256 microprocessor will be set as 0 V,

and its corresponding conversion result also is 0. In the same

way, this data will be used as a criterion for judging whether

CO2 gas sensor is working correctly or not. However, in the

process of self inspection, if abnormal ways of these sensors

are found, the error messages will be displayed in a timely

manner. At the same time, it is necessary to hang-up the

system to avoid causing damages during continue running on

the system.

After four types of sensor can be confirmed to work

properly by system self-checking subroutine, then the

"SYSTEM IS NORMAL" information will be displayed in

LCD12864 screen. And, the system self-checking subroutine

could carry out weight allocation for sensor data according to

the weight distribution table. Finally, the system enters into a

normal operation state. The flow chart of system software

design for self-checking subroutine is shown in Fig. 14.

Indoor Environmental Parameter Monitoring Subroutine.

The main function of indoor environmental parameter

monitoring subroutine is to achieve sensor data reception,

data analysis processing and judgment and carrying out sound

and light alarm. If this system is operating normally, then this

system will start to enter the loop to detect monitor state of the

data returned by each sensor. After returning information by

each traverse of these sensors, we carry out data analysis and

determine whether these sensors occur abnormal situation or

not, according to the weight algorithm design. When

abnormal condition happened, the corresponding message

prompt and sound and light alarm prompt will be started. And

the flow chart of system software design for indoor

environmental parameter monitoring subroutine is shown in

Fig. 15.

B. Software design of router node

Before the router node can be activated, it requires specific

information through the built-in EPROM. It is also necessary

to the call Write_Configuration ( ) function for configuring

device properties to DEV_ROUTER and configuring the

device startup mode to initiate automatically when the power

turns on. In addition, the My_Task_Process_Event ( )

function can be configured in the router node’s application

layer. The software design flow of the router node is shown in

Fig. 16.

Power on reset

for system

Sensor initialization and

system-self checking

Is the sensor

abnormal?

Abnormal

sensor tips

Read sensor data

Whether abnormal?

Other abnormal

informations

Is temperature

abnormal?

Abnormal

temperature alarm

N

N

N

Y

Y

Y

System hang-up

Comprehensive

analysis of Sensor data

Is humidity abnormal?Abnormal

humidity alarm

N

Y

Is light intensity

abnormal?Abnormal light

intensity alarm

N

Y

Is CO2 concentration

abnormal?

Abnormal CO2

concentration alarm

N

Y

Fig. 15. The Flow Chart of System Software Design for Indoor

Environmental Parameter Monitoring Subroutine.

Power on reset

for system

Delay 500μs

Detecte temperature

sensor DS18B20

Whether normal? Display error

messages

System hang-upDetecte humidity

sensor HM1500LF

Whether normal?Display error

messages

System hang-upDetecte photoelectric

sensor LXD3526

Whether normal?Display error

messages

System hang-upDetecte CO2 gas

sensor MG811

Whether normal?Display error

messages

System hang-upDistribute data weight of

each environment parameters

comparing with weight table

System enters into the

working state

N

N

N

N

Y

Y

Y

Y

Fig. 14. The Flow Chart of System Software Design for System

Self-checking Subroutine.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 7: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

Fig. 16 also demonstrates that when the router node’s power

turns on, this node will initialize, starting up all units in the

hardware. After initialization, this node will activate the

AF_DiscoveryRequest ( ) process to search for a connection

with a coordinator node. Once successful, the AF_JoinRequ-

est ( ) process sends network signals to the coordinator node

for application. Once the response has been validated and

configured for the 16-bit address, this node will enter a

real-time monitoring state and periodically request signals

from all ports. The ZigBee network will treat any

newly-detected end device nodes as new nodes, using the

Cluster_Tree algorithm to update the route. The router node

can then begin to transmit temperature data, humidity data,

light intensity data, and CO2 concentration data from all end

device nodes.

C. Software design of coordinator node

Before the coordinator node can be activated, it requires

specific information through the built-in EPROM. It is also

necessary to call the Write_Configuration ( ) function for

configuring device properties to DEV_ZB_COORD and

configuring the device startup mode to initiate automatically

start when the power turns on. In addition, the

My_Task_Process_Event ( ) function can be configured in the

coordinator node’s application layer. The software design

flow of the coordinator node is shown in Fig. 17.

Fig. 17 also demonstrates that when the coordination

node’s power turns on, this node will initialize, starting up all

units in the hardware. After initialization, this node will call

the ENTRY_EVENT ( ) function and activate the ZigBee

wireless communication protocol to create a new network

with the default channel preset by the Zigbee network. This

node will then enter a real-time monitoring state and

periodically request signals from all ports. If this network

detects a request from new end device or router nodes, it will

treat each as a new node and configure it with a 16-bit address.

Once the network construction is successful, the coordinator

node can call the StartConfirm ( ) function to detect the

network state and determine the success of the network

structure. The temperature data, humidity data, light intensity

data, and CO2 concentration data from the new node can now

be transmitted to the monitoring center’s upper PC monitor

through the serial data bus.

At this point, we have completed all the design work

required for this indoor environmental parameter monitoring

system.

VI. SYSTEM TEST

In order to test the performance of this indoor

environmental parameter monitoring system, we establish an

actual circuit according to system hardware and software

design. The actual ZigBee network is composed of 4 terminal

nodes, 2 router nodes and 1 coordinator node. And then, we

complete the four kinds of parameter acquisition for indoor

temperature, humidity, light intensity and CO2 concentration

under simulated smart home. Among them, the indoor

temperature standard value of simulated smart home is 12

degrees Celsius, the indoor humidity standard value is

25 %RH, the indoor light intensity standard value is 1300 LX

and the indoor CO2 concentration standard value is 450 ppm.

Through the upper VB software interface to realize serial

data communication between coordinator node and upper PC

monitor, and then the system test results are shown in Fig. 18.

Start

initialization

Find the upper node to

build network

Network establishment?

Transmit routing request command

and build the route

Routing table update route

N

Y

Receive child node data

Transmit data by

routing table

Transmit success?YN

Fig. 17. Software Design Flow of Coordinator Node.

Start

initialization

Find the upper node to

build network

Network establishment?

Transmit routing request command

and build the route

Routing table update route

N

Y

Receive child node data

Transmit data by

routing table

Transmit success?YN

Fig. 16. Software Design Flow of Router Node.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 8: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

In which, the temperature data (Temp) unit is ℃, humidity

data (humi) unit is %RH, light intensity data (light) unit is LX

and CO2 concentration data (CO2) unit is ppm.

From Fig. 18, we can see that this indoor environmental

parameter monitoring system has a high measuring accuracy,

which obtained with satisfactory results. In addition, when the

monitoring temperature data is lower than -15℃or higher

than 40℃, humidity data is lower than 20 %RH or higher than

80 %RH, light intensity data is lower than1000 LX or higher

than 1800 LX and CO2 concentration data is higher than 1000

ppm, this system would continue buzzer alarm for 2 seconds

and the Beep button color will change into red, which

conveniently helping user to take appropriate measures in a

timely manner in according to practical application.

VII. CONCLUSION

As a kind of intelligent equipment in collection and

transmission of environmental data, this indoor

environmental parameter monitoring system plays a very

important role in smart home. Therefore, combining two

advantages of digital communication and network function

for modern smart home system, this paper introduces a

complete set of wireless networking solution for indoor

environmental parameter monitoring system based on ZigBee

Wireless Sensor Network.

Meanwhile, combining ZigBee wireless communication

technology and modern sensor technology, this scheme can

ensure accuracy of data transmission. So, this system has

changing existing data transmission way, and solving a few

difficult problems of wire transmission in some specific

application occasions, which making the data transmission

more convenient.

At the same time, the four types of sensor modules used in

this design scheme not only simplify the hardware design, but

also improve the measurement accuracy, so that the whole

system can be easy to operate and maintain. After field

debugging various basic functions of indoor environment

parameter monitoring system for smart home, the testing

results show that this system has giving full play to the

flexibility of ZigBee wireless sensor network in the indoor

environmental parameter monitoring process. Moreover, the

testing results also show that this system could achieve the

predetermined functional requirements with high reliability

and practical value. So as to complete wireless data

acquisition and transmission of indoor environment

parameters for smart home in real time by using ZigBee

network technology, which ultimately establishing a solid

practice foundation for automatic monitoring of the indoor

environmental parameters.

ACKNOWLEDGMENT

The author would like to thank Heze University for

providing Wireless Communications Laboratory.

REFERENCES

[1] Y. Pang, G. M. Li, “Study on smart home system based on ZigBee,”

Computer Engineering & Design, vol. 35, no. 5, pp. 1547-1550, 2014.

[2] H. L. Xin, P. S. Zhong, S. Q. Zhu, “Research of smart home furnishing

control system by internet of things based on ZigBee,” Application of

Electronic Technique, vol. 39, no. 12, pp. 79-81, 2013.

[3] N. Aslam, W. Phillips, and W. Robertson, “A Unified Clustering and

Communication Protocol for Wireless Sensor Networks,” IAENG

International Journal of Computer Science, vol. 35, no. 3, pp. 249-258,

2008.

[4] W. H. Kuo, Y. S. Chen, K. T. Cheng, and T. W. Lu, “Signal Strength

Based Indoor and Outdoor Localization Scheme in Zigbee Sensor

Networks,” IAENG International Journal of Computer Science, vol.

43, no. 1, pp. 55-64, 2016.

[5] Y. Wu, C. L. Bao, “Design of smart home system based on GSM and

ZigBee technology,” Journal of Hebei University of Technology, vol.

43, no. 1, pp. 15-18, 2014.

[6] J. Zhang, “Design of Temperature Test System with High Precision

Based on Zigbee Technology,” Metrology & Measurement

Technology, vol. 36, no. 6, pp. 22-25, 2016.

[7] Y. N. Zhang, Y. Zhou, “Digital temperature measuring devices based

on DS18B20,” Mechanical Engineering & Automation, vol. 41, no. 4,

pp. 149-151, 2012.

[8] H. He, F. L. Zhang, Z. H. Zhang, “On the Smart Home Control System

Based on ARM and ZigBee,” Journal of Xuzhou Institute of

Technology, vol. 29, no. 4, pp. 26-31, 2014.

Fig. 18. (a) System Test Results of First Indoor Environmental Type.

.

Fig. 18. (b) System Test Results of Second Indoor Environmental Type.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________

Page 9: Application of ZigBee-WSN Technology for Indoor ... · advancement which is considered as important and ... The ZigBee protocol is realized by ZigBee protocol stack. And the ZigBee

[9] J. Han, C. S. Choi, I. Lee, “More efficient home energy management

system based on Zig Bee communication and infrared remote

controls,” IEEE Transactions on Consumer Electronics, vol. 57, pp.

85-89, 2011.

[10] S. H. Fang, C. H. Wang, T. Y. Huang, Chen, “An enhanced Zig Bee

indoor positioning system with an ensemble approach,” IEEE

Communications Letters, vol. 16, no. 4, pp. 564-567, 2012.

[11] H. Z. Zhang, J. T. Cao, P. F. Shao, “Research on WSNs-based

Intelligent Water Saving Irrigation Control System for Greenhouse,”

Control Engineering of China, vol. 26, no. 1, pp. 16-21, 2019.

[12] P. Xie, P. L. Zhou, “Greenhouse temperature and light control system

based on MSP430 MCU,” Popular Science & Technology, vol. 11, no.

8, pp. 149-150, 2009.

[13] S. P. Zhang, X. B. Li, F. Q. Zhang, J. Z. Li, “Application of ZigBee in

multi-sensor information integrating,” Computer engineering and

design, vol. 33, no. 1, pp. 41-46, 2012.

[14] S. M. Yi, H. L. Zhao, R. Yuan, “SCM-based temperature and humidity

control system for vegetable greenhouse,” Modern Electronics

Technique, vol. 34, no. 7, pp. 129-131, 2011.

[15] W. X. Liu, X. Hu, D. Tang, H. Zheng, C. P. Ji, “Design of wireless

temperature sensor network based on ZigBee technology,” Transducer

and Microsystem Technologies, vol. 28, no. 4, pp. 69-71, 2009.

[16] X. Tang, G. H. Chen, Q. H. Dai, “Design of Aquaculture Monitoring

System Based on Wireless Sensor Network, ”Computer Measurement

& control, vol. 26, no. 10, pp. 9-13, 2018.

[17] W. G. Zhang, M. G. Wu, Y. H. Li, “Smart home system design based

on ZigBee, ”Electronic Design Engineering, vol. 25, no. 24, pp. 11-14,

2017.

[18] F. Yang, K. H. Song, “The smart home system based on Zigbee mesh

network,” Automation and instrumentation, vol. 38, no. 5, pp. 105-108,

2018.

[19] Z. P. Liu, L. J. Liu, W. Y. Li, “Greenhouse Environment Supervisory

System Based on ZigBee,” Journal of Agricultural Mechanization

Research, vol. 36, no. 10, pp. 218-222, 2014.

[20] S. Yang, S. M. Liu, “Process monitoring system of beer fermentation

based on ZigBee-WSN,” Computer engineering and design, vol. 34, no.

12, pp. 4410-4414, 2013.

IAENG International Journal of Computer Science, 46:4, IJCS_46_4_23

(Advance online publication: 20 November 2019)

______________________________________________________________________________________