General Data Acquisition Platform for Wireless Sensor Network Based on CC2538

Wireless sensor networks are the hotspots of current research and have very wide application prospects. Its front end is a sensor that can sense and check the external world. This paper takes temperature and humidity as the research object, and builds a wireless sensor network data acquisition platform by combining the Internet of things and the WeChat public platform. The platform uses DHT11 temperature and humidity sensors and CC2538 sensor nodes to obtain the relevant data, through the server and database for data access. The combination with WeChat public platform not only allows us to view the temperature and humidity in the WeChat public, but also allows us to understand the environmental changes of the relevant detection area more conveniently and quickly. The effectiveness of the platform is also demonstrated by the collection of temperature and humidity data.


Introduction
With the continuous improvement of living standards, people pay more attention to their own living environment. Temperature and humidity are two of the more sensitive parameters of human environment. We can use the wireless sensor network to get environmental parameters to serve people. The front end of a wireless sensor network is a network communication system consisting of sensors and their nodes that can perceive and acquire external world data. It can not only a variety of real-time monitoring, sensing and collecting in the regional distribution of monitoring data, but also to the Internet through wired or wireless mode to connect and transmit the data to the observer.So as to further analysis and use of the collected information.
This paper develops a data acquisition platform based on cc2538 wireless sensor network. The platform using the Internet of things technology to monitor the temperature and humidity. At the same time it can be free from time and geographical constraints, users can quickly understand the monitoring site temperature and humidity changes and respond in a timely manner.

System Overall Design
The whole system consists of the sensing layer, the network layer and the user application layer. The sensing layer is mainly CC2538cb sensor nodes and DHT11 temperature and humidity sensors and other sensing devices, used to obtain the monitoring area of the relevant monitoring information, and through the access device and other devices in the Internet solid resource sharing. The network layer mainly sends the information obtained by the sensing layer to the Internet. Through the establishment of the networking platform in the network information resources integration can become a interoperability of intelligent network, the establishment of an efficient, reliable and credible infrastructure platform for large-scale monitoring and management. Through the central computer platform, the sensor network to obtain a variety of monitoring information for real-time management and control, and for the upper application to provide a good user interface. The main function of the user application layer is to build a practical application for monitoring, where the use of WeChat public platform to achieve real-time monitoring, early warning and other functions. The system structure is shown in Fig. 1. The working process of the system is as follows: firstly, the data of temperature and humidity in the environment are collected by DHT11 temperature and humidity sensor, and the temperature and humidity data obtained from the node's SM antenna module is sent to the nearest sink node. And then the aggregation node after the reunification of the data will be sent and stored in the database for the WeChat public platform for data calls. Finally, when the user in the WeChat public platform to send a request, the server will send the current data in the database to the WeChat public number, so that users can get the latest temperature and humidity data.

Hardware component
There are a lot of wireless sensor network related to the hardware, the hardware part of the system adopts CC2538 as ordinary sensor nodes and sink node to form a wireless sensor network, through the node's SMA antenna data sent to the server side. The main difference between common sensor nodes and sink nodes is whether serial communication can be carried out. CC2538 node RAM reached 32k, so the use of the process do not have to worry about the problem of insufficient RAM. Besides CC2538 node prices to be relatively cheap, more suitable for beginners to use. CC2538 node physical map shown in Fig. 2.

Fig. 2
The IO port is reserved in the design of the node, as shown in Figure 3, which is indicated as 1, from left to right: Reserved IO port can be programmed according to the need to develop functions, such as UART, SPI, I2C, SSI, ADC, input, output, etc., high flexibility. Therefore, we can use the reserved IO port to complete the required sensor access. Cc2538 main chip circuit shown in Fig. 3.

Fig. 3
The node design does not directly use 2538 USB function instead of using the PL2030 USB conversion chip, mainly because of 2030 for the Linux/Ubuntu virtual machine, Android is a free drive, we can use it more simple and fast. The circuit shown in Fig. 4.

Fig. 4
The system through the DHT11 temperature and humidity sensor to collect environmental data. DHT11 digital temperature and humidity sensor is a composite sensor, including the calibration of digital signal output temperature and humidity. Using the digital module acquisition technology and temperature and humidity sensing technology to ensure product reliability and long-term stability. Its core is a resistive moisture

4.1TinyOS Operating System
TinyOS is the mainstream operating system in wireless sensor networks. It is an open source operating system developed by University of California at Berkeley, designed for embedded wireless sensor networks. TinyOS is based on the event-driven mechanism, with less code, low energy consumption, high concurrency, fast response and so on, can better meet the specific application. And NesC programming language is used to support component programming.Taking into account the general characteristics of wireless sensor nodes: simplified hardware architecture, low storage capacity, CPU performance and battery power. Making the TinyOS operating system very suitable for wireless sensor networks.
TinyOS is a component-based programming architecture which is widely used in embedded operating system, and its components are an abstraction of hardware and software functionality. The whole system consists of components, through the components to improve software compatibility. The system itself provides a set of components for user invocation, which can be divided into underlying hardware abstraction components, intermediate composite hardware components and upper software components (including main components and application components) from bottom to top, as shown in Fig. 5. The underlying hardware abstraction component maps the physical hardware to the TinyOS component module and is responsible for reporting events to the upper layer. The intermediate hardware components simulate the advanced hardware behavior, which is responsible for parsing the data and passing the data parameters. The upper software components mainly implement component control, routing and data transmission, protocol analysis, etc., the upper component to the underlying components issued a command.

Send the data
The data transmitting and receiving between the common node and the sink node are mainly through SM antenna. In the node programming process used six components, respectively, MainC components, timing components TimerMillliC, control the sending of AMSendC components, control the receiving AMReceiverC components and LedsC components.
Sensor through the cc2538 reserved IO port access, select the temperature and humidity sensor DHT11 to measure the temperature and humidity in the environment, connect the DHT11's 3 (1 floating) pins to the IO port according to the corresponding relationship.
Because TinyOS can directly use the C file, so the driver here by the C language.In the compilation process, we need to add DHT11 driver to the TinyOS compiler environment. First copy the driver to the tinyos-main-release_tinyos_2_1_2 \ tos \ chips \ cc2538 directory, the driver contains DHT11.c and DHT11.h files. And then modify the tinyt-main-release_tinyos_2_1_2 \ tos \ platforms \ cc2538cb .platform (Ctrl + h can show hidden files) file, increase the path% T / chips / cc2538 / DHT11. Finally, modify the cc2538cb.rules file under tinyos-main-release_tinyos_2_1_2 \ support \ make \ cc2538cb and add EXTRA_MODULES + = $ (CHIP_DIR) / DHT11 / DHT11.c after EXTRA_MODULES + = .... After compiling, programming we can read DHT11 data.

Receive the data
Through the receive interface to achieve data reception, receive interface to provide basic information to receive and forward information function, the entire process achieved by the ActiveMessageC components. In this way, we can complete the transmission of information to the sink node, the sink node is directly connected with a computer, using the serial port to read the information of the software you can see to the sensor node data acquisition.

Server and Database
The temperature and humidity data collected by the sensor are stored in the database through the server, so the stability, practicability and convenience of the server and the database are very important. The system uses the MySQL database and the Baidu cloud server, the server and the database through the GET request way to transmit the sensor to send the data. In the Baidu cloud server to build a server environment, install the MySQL database, through the preparation of the code can communicate with the mobile client. The data collected from the sensor nodes are observed on the computer as shown in Fig. 6.   Fig. 6

WeChat Public Platform
The use of WeChat's public platform to the sensor data collected real-time monitoring.Because compared with the computer, WeChat public account is more suitable for simple and easy to observe the various data collected by the sensor, in addition to the cost of the development of the WeChat public number, easy to use.
Users in the network environment landing personal WeChat, concerned about the corresponding WeChat public number can enter the system.WeChat public numbers need to be bound to the server, the request can be sent to respond. After binding, WeChat public number to send a request to the server, the server according to the instructions to read the corresponding data in the database provided to the WeChat public number, you can view the corresponding environmental data at the WeChat side. Send and receive schematic diagram shown in Fig. 7.

Concluding
The environmental data acquisition platform in this paper makes full use of the flexibility and scalability of wireless sensor to designs the platform. The effectiveness of the platform is also demonstrated by the collection of temperature and humidity data. The introduction of TinyOS operating system greatly simplifies the hardware platform construction and development difficulties. The combination of the Internet of things and the WeChat public platform allows us to get rid of computers without time and geographical constraints, and easier to understand the changes in the environment. At the same time, it has simple operation, high efficiency and can share monitoring data externally. However, there are still some deficiencies in the design. There is also a need to extend the different types of sensors for full monitoring. For the problem of delay in data acquisition and transmission, the next step will be to improve the issue by adding a new transceiver mechanism.