Analysis of Environment Monitoring Platform Based on Wireless Sensor Network

This paper established a TinyOS operating system for wireless sensor network of temperature and humidity monitoring system. It introduces the basic structure of the monitoring system, sensor nodes, the TinyOS operating system, and the NesC language. Besides, it preliminary design the application of temperature and humidity monitoring. This paper choose cc2538cb as the sensor nodes in the design of system, and introduce the design method of environmental monitoring mobile phone software.


Introduction
Wireless sensor network (WSN) [1] is the new generation of sensor network, has a very broad application prospect, and its development will have a profound impact on the various areas of human life and production.By arranging a large number of sensor nodes in the environment, we can collect a lot of physical data such as temperature and humidity to digitize the simulation environment of the physical world, giving people an intuitive understanding of the subtle changes that are happening in the environment in which we live.As people increasingly concern for the environment, environmental science is becoming more and more extensive.The sensor network can be used to monitor crop irrigation, environmental conditions, granary storage, etc. in environmental studies.With the development of the wireless sensor network technology, the wireless sensor network applications to the needs of environmental monitoring system is becoming more and more urgent [2].
In the aspect of environmental monitoring, temperature and humidity are two important parameters [5], this paper mainly analyzes the temperature and humidity collection method, using TinyOS as the embedded operating system, and writing the underlying driver to realize the collection of environmental data.

The structure of wireless sensor network
As shown in Figure 1, a typical sensor network system structure, including sensor nodes (groups), sink nodes, infrastructure networks (Internet or satellite) and management nodes (users) [5].A large number of sensor nodes are randomly distributed within the monitoring area.The data collection through the sensor nodes are transmitted along the other sensor nodes hop-by-hop, and after the multi-hop route arrives at the sink node, the sink node passes the collected information to the user [3,5].When the sink node is far away from the management node, it can converge to the network server through GSM, GPRS, and satellite.So the user can through the browser, mobile phone and other methods, observe the changes of environmental monitoring whenever and wherever possible.3 Software platform and hardware platform of the system

Implementation of system software platform
TinyOS is a modular wireless sensor network operating system developed by UC Berkeley (University of California, Berkeley) based on the US Department of Defense's "Smart Dust" project [8].
It depend on the event driven mechanism, with less code, low energy consumption, high concurrency, fast response characteristics, and can better meet the specific application.TinyOS is actually the standard for sensor network node operating system, which provides a component-based software framework for the integration of application-oriented wireless sensor network operating system [3,4].The operating system does not distinguish between the user and kernel mode, and does not provide memory protection mechanism, but it can provide concurrent processing capability, under the condition of limited resources.

Component structure of TinyOS
Component technology in the embedded system has been widely used.The hardware and underlying software in the system are abstracted as a component, thus enabling external shielding.When the users are programming, only need to pay attention to the interfaces of the components, they are not necessary to understand the specific implementation process of the components, so as to improve the reusability and development efficiency of the software.The TinyOS operating system provides a set of components for user invocation, including the main components, application components, execution components, sensor components, communication components and underlying hardware components [4], as shown in Table 1.
Components from top to bottom can usually be divided into three categories: high-level software components, composite components and hardware abstract components.High-level software components achieve control, routing, data transmission and other application layer functions.

NesC language
TinyOS was originally written in C language and assembly language, but researchers further study finds C language can not effectively and easily support the development of applications and operating systems of sensor network.So the researchers carried out some extensions on the basis of C language, combined component-based thinking with event-driven execution models, and developed nesC languages that support component programming [6,7].
The main features of the nesC language are as follows: (1)Separation of structure and entity; (2)Components can use or provide interfaces; (3)The interface has bidirectional, for the same interface of the same component; (4)Components are statically linked through interfaces; (5)The nesC compiler can automatically mark the potential data competition caused by preemptive interrupts.

The design of system hardware platform
In the introduction of the sensor network system, the wireless sensor network mainly involves the hardware: sensor node, sink node, management platform.For the management platform, we can choose the computer, this article will not repeat them.The main difference between the sensor node and the sink node is whether the serial communication can be carried out, but now the mainstream sensor nodes have these two functions.At present, there are many kinds of sensor nodes and sink nodes, many research institutions have developed their own hardware platform, but the main difference between these hardware platforms is used in the processor, wireless communication, the discrepancy sensor configuration.Including CrossBow's TelosB series of nodes, Intel's Intel Mote (iMote) nodes [2].

Cc2538cb node
In the essay, the cc2538cb node is selected as the sensor node and the sink node.You choose what kind of hardware platform to run the prepared nesC code, then the most famous platform of TinyOS is TelosB node.TelosB is an open source, low-power wireless sensor node produced by Crossbow.TelosB node in line with IEEE802.15.4 protocol specification, the use of low-ultra power antenna templates.In order to meet the requirements of easy development and high fault tolerance in wireless sensor network.The onboard USB interface can modify and update the node program, also can collect information.
Cc2538cb node compared to the TelosB node is slightly less than in the low power consumption , but in the RAM memory, TelosB node use the cc2420 chip, the RAM memory only has 10K size, but cc2538cb node RAM memory has reached 32K.So the use of cc2538cb node do not have to worry about RAM storage space is not enough.Similarly, cc2420 RF characteristics compared with the cc2538 is still a bit stretched, in addition, cc2538cb node price is much cheaper, and very suitable for beginners to use, when they learn TinyOS.Cc2538cb node in the design process reserved ten IO port, from left to right are: GND,PD1,PD0,PA7, PA6, PA5,PA4,PA3,PA2,VDD,the distance is 2.00mm.Cc2538cb IO port can specify the function according to the software programming, such as UART, SPI, I2C, SSI, ADC, input, output, etc.Cc2538cb node doesn't weld sensor, but in the process we can use the reserved IO port to complete the sensor access or other chip bus communication.Cc2538cb node use PL2303 USB converter chip instead of using the 2538 USB function directly .Because the PL2303 driver for the virtual machine Linux/Ubuntu, Android etc. are driver-free, it can be more simple and fast use of Linux/Android.We through the cc2538cb node reserved IO port to connect the sensor, this paper uses thedht11 sensor to measure the temperature and humidity in the environment, the sensor pin is connected with the IO port according to the corresponding relation.Next, in the TinyOS compiler environment to join the dht11 driver, the dht11 directory will be copied to the tinyos-main-release_tinyos_2_1_2\tos\chips\cc2538, where the dht11 directory contains dht11.cand dht11.hfiles.Then modify the .Platform file under the tinyos-main-release_tinyos_2_1_2\tos\ platforms\cc2538cb directory, increase the path %T/chips/cc2538/dht11.

IST2017
thecc2538cb.rulesfile under tinyos-main-release_tinyos_2_1_2\support\make\cc2538cb and add EXTRA_MODULES + = $ (CHIP_DIR) /dht11/dht11.cafter EXTRA_MODULES + = ..... So, in the node programming we will add the program to read the sensor data, start the event, read the sensor data every 2 seconds, and the data will be stored in the packet.We use the AMSend interface to send packets, it can send data to the specified AM address, then the Packet and AMPacket interface into the message_t abstract data type.These interfaces are provided with the component AMSendC, although they can also be provided by ActiveMessageC, but AMSendC providesa virtual abstraction.Because the transceiver is the public resource, different components canbe used, so it needs to be virtualized to avoid mutual interference between different components.Next, add the program logic to ensure that no packets are sent, and finally through the send command send packets to all nodes within the scope of acceptance, according to SUCCESS command, interpretation of data has been successfully transmitted.

Data reception
Receive information through the receive interface to achieve, receive interface provide basic information to receive and forward information function, which is achieved by the ActiveMessageC component.In this way, it is possible to transfer information through the AM to the sink node.The sink node directly connected with the computer, then use computer to observe the data that is collected by sensor nodes, and achieve the environmental data monitoring and collection.
As shown in the following Figure 4.The Figure 5 shows the process of collecting data from sensor nodes to observe data through a computer or Android client.Since the database cannot be directly connected to the Android client, the server is used as a bridge between the two designs.We can use ECS (Elastic Compute Service).If we purchase it, we can deploy a virtual machine in the background, and will provide users with a public network IP, as the design system IP number.The client can communicate with the server through this IP connection.As the monitoring area contains multiple sensor nodes, this will produce a lot of data, so the system can be used in the design of MySQL database to store data.After ECS (Elastic Compute Service) build a good server environment and install the MySQL database, the code can be written with the Android client communication.

The design of android mobile phone software
The control interface of mobile phone software is the main way of interaction between the user and the device, the interface will affect the design of your environment monitoring system to promote.So a good interface design is essential, the design interface is considered an important factor in the operation is simple, free and convenient.Mobile phone software design mainly includes the following parts: user login interface, the main interface, function interface and the message of the push part.As shown below.If the users enter the IP address assigned by the server in the login interface, as shown in Figure 7, they will enter the main interface.In the main interface, we can according to the needs of environmental monitoring choose to observe the main parameters, such as: temperature, humidity, light intensity and so on, as shown in Figure 8.Then, the waveforms and data changes of the environmental monitoring parameters can be displayed through the function interface.If the monitoring environment changes dramatically, or when a fire occurs, you can use message push technology, it can timely convey the message to the user, and cause people's attention.

Conclusions
Wireless sensor network [9,10] has a wide range of application prospects, this paper specifically analyzes the temperature and humidity data from the acquisition to the monitoring process, and make full use of the flexibility and scalability of wireless sensor network [4].The introduction of TinyOS has a great impact on the development of wireless sensor network.TinyOS has a great advantage from simplifying the development and reduction of functions.It provides a basis for wireless sensor network environment data acquisition system.The wireless sensor network platform designed in this paper be easily extended to other applications, which provides a good solution for the design of environmental monitoring and alarm subsystem in smart home.

DOI: 10 2
Cc2538cb node structureThis article uses the cc2538cb node part of the design as shown in Figure2.

Figure 5 .
Figure 5. Data acquisition and observation process.

Figure 6 .
Figure 6.The main structure of Mobile phone software.

Figure 7 .
Figure 7.The login interface.Figure 8.The main interface.

Figure 8 .
Figure 7.The login interface.Figure 8.The main interface.

Table 1 .
Composite components simulate advanced hardware behavior, such as sensor components, communication components, etc.. Hardware abstract components map the physical hardware to TinyOS component model.TinyOS application structure.