Intelligent Wireless Indoor Monitoring System based on ARM

This paper proposed an intelligent wireless indoor monitoring system based on STM32F103. The system compromises a master and terminals, which communicates through a CC1101 433M wireless unit. Using ENC28J60 and SIM900A to access Ethernet, the system can intelligent push information to cloud server, therefore we can observe and control terminals remotely. This paper present an algorithm based on MCU ID for terminal code recognition. The algorithm can intelligently discriminate terminals through code matching code between master and terminals, though hardware and software of terminals is similar. The experiment demonstrates that the proposed system is robust stability, real-time and obtains accurate warning information. Keywords—STM32; CC1101; Intelligent Monitoring; ID; Corresponding Code Discrimination


INTRODUCTION
With the rapid development of China's network technology, information technology/economy, people's requirements of the life quality increase gradually.In such a high-paced living environment, traditional indoor video surveillance systems appear to be inadequate.Intelligent interior monitoring system uses the cloud server, which can real-time detect indoor state when an exception occurs, automatically alarm and timely send the warning to user.Therefore, it can greatly reduce the family security risks.
In this paper, an intelligent system based on STM32F103 is designed to predict household hazards, and send the indoor gas concentrations and smoke density information, situation of indoor power, emergency data to the monitoring center through both wired and wireless network.As shown in Figure 1, the system consists of a host and terminals, which communicates each other through 433M wireless units.

II. MONITORING HOST
As shown in Figure 2, the Monitoring host contains a 433M wireless communication unit, a WIFI and a RFID module, an Ethernet and a GPRS / GSM module.Host Communicate with the terminal through a 433M wireless module.Normally the host uses a query method to get terminal operating status.The monitoring terminal sends alarm information to the host immediately if an abnormal condition is detected.The host sends the information to the cloud server through wired Ethernet or GPRS / GSM.The server pushes messages to user's phone, to achieve the purpose of real-time monitoring.

A. Cortex-M3 STM32F103VET6
We used a STM32F103VET6 MCU as the system's core, which is produced by ST Microelectronics.STM32F103VET6 is based on ultra-low-power ARM Cortex-M3 processor core.The STM32F103VET6 series are a powerful lineup in 32 bit STM32 microcontroller family.They have good compatibility.ARM Cortex-M3 core set is specialized in high-efficiency lowenergy in real-time applications.It has high cost-effective which embedded developers favor so much.The enhanced chip www.ijacsa.thesai.orgwith 512KB RAM and 64KB SRAM has the maximum operating frequency of72MHz, up 1.25DMips / MHz [1]

B. 433M wireless communication module 1) Introduction and Application CC1101
Host and terminal use a CC1101 chip to realize communication.CC1101 is a high-performance sub-1GHz wireless transceiver designed for low-power RF applications.It's mainly used for industrial, scientific and medical (ISM) and short-range device (SRD).CC1101 provides packet handling, data buffering, burst transmissions, received signal strength indication (RSSI), clear channel assessment (CCA), Wireless on wake (WOR), extensive hardware support.CC1101 and CC1100 are compatible in code, package and pinout.It is open to sub-1GHz frequency RF design which is commonly used in world [2].Interfaces between MCU and CC1101 are shown in Figure 3. 2) Wireless module CC1101 have five work modes, part of the idle mode, sleep mode, receive mode, sent mode and crystal oscillator close mode.The work mode of the chip can be change by the internal set register of the external pin.At first electrify, the chip will enter the sleep mode, pause work, but the value of internal chip register can't be lost.When wireless module is in a dormant state, you can pin CSn is pulled low, so that the module enters an idle state.You can read and write the chip registers and mode settings when the wireless module enters an idle state.When we set inside STX bit register, crystal is startup, and CC1101 wireless module enters a transmission mode.If the bit is set SRX, the wireless module of CC1101 enters into the receiving state [3].

CC1101 MCU
When they need to send data, STM32F103ZET6 writes data to wireless module at a lower rate through SPI.RF circuits start after writing completed while RF circuits send written data out and empty TX-FIFO register.When wireless module received data, it sent the received data is to STM32F103ZET6 through the SPI.Because the wireless module can enter sleep mode to reduce power consumption, CC1101 wireless module can automatically generate the CRC and preamble code, which reduces the complexity of system design.

3) Ethernet Module
We used ENC28J60 for Ethernet communication.ENC28J60 is the first 28-pin stand-alone Ethernet controller over the world.It is produced by Microchip and provides a low pin count, low-cost, streamlined remote communications solutions for embedded systems.ENC28J60 is an independent Ethernet controller with an industry-standard serial peripheral interface.It meets all IEEE 802.3 specification, using a series of packet filtering schemes to limit incoming packets.It also provides an internal DMA module for fast data throughput and hardware support for IP checksum calculation.Communication with the host controller is provided by two interrupt pin (INT and WOL) and SPI pins (SO, SI, SCK, CS).The data transfer rates of ENC28J60 is up to 10Mb / s.Two dedicated pins (LEDA, LEDB) is used for connecting a LED which indicators the network activity.Figure 4  The main program is mainly responsible for components initialization.In software systems, Because of the control parts is fewer, we do not use the operating system.The matching code switch is used to discriminate the same set of identification for communication between devices.

B. Communication between the host and terminal 1) The Communication Protocol
In this design, the communication between host and terminal uses a 433M wireless module, which has strength signal, high anti-jamming etc.The communication included request, response, and transmission, closed four states.The switch of communicate state is shown in Figure 6.

2) Encryption Algorithm
In order to ensure secure communications, the design uses a lightweight ECC encryption algorithm.Elliptic Curves Cryptography (ECC) is a public key encryption system, which is proposed in 1985 by Koblitz and Miller.The mathematical basis of ECC is rational points on an elliptic curve additive group constituting the Abel elliptic discrete logarithm computational difficulty.
Compared with classic RSA, DSA, and other public key cryptosystem, elliptic cryptosystem has high security, processing speed, small storage space, and low bandwidth requirements.Some studies indicate that elliptical key 160 and 1024 has the same RSA key security.On the private key encryption and decryption, ECC algorithm has a faster speed than RSA, DSA.Elliptic Curves Cryptography flow is shown in Figure 7.

3) The match code identification solutions based on MCU ID
Since the terminal can freely expand, there will have an identical terminal device.The host cannot identify the terminal which sends information it received.To solve the problem, we propose a solution to identifying terminal by MCU ID Code.a) Electronic Signature Electronic signature stored in the system memory area of the flash memory module, you can use JTAG/SWD or CPU to read.Chip identification information contains writing at the factory.User firmware or external device can read an electronic signature, to automatically match the different configurations SRM32F10xxx microcontroller.

b) MCU 96 bit unique identity ID
A 96 bit of unique identity is provided to any one of the STM32 microcontroller.Users under any circumstances cannot change this identity.The 96 bit unique identity of the product, according to the usage of different users, can be read in bytes www.ijacsa.thesai.org(8 bit) as a unit, or can be read in half-word (16 bit) or wholeword (32 bit).Product unique identity is very suitable to be used as 1) A sequence number (such as USB serial numbers or other characters in the terminal application) 2) A password in the preparation of flash memory; 3) In conjunction with this uniquely identifies software encryption and decryption algorithms to improve code safety in the flash memory; 4) Safety mechanism to activate the bootstrap process.The structure of the ID storage is shown in Figure 8.  KEY1 is the match code button.When the button is pressed for more than 2s, it will start the program of match code.Master sends and saves ID Code, while the success of matching code is returned.As the matching code indicator light, LED1 will flash 5 times in frequency of twice per second after success of matching code.

V. EXPERIMENTAL RESULTS AND ANALYSIS
We selected a 4 rooms and 2 hall area of 128 square meters for experimental.A host was placed in a drawing room, and terminals were placed in cook room (gas monitor), bathroom (emergency button), study room (smog monitoring), master bedroom (bed vacancy monitor).Test results are shown in Table 1 and Table 2.As shown in Table 1 and Table 2, it can be seen that he server response time is about 2.5s when Ethernet is connected, whereas the server response time is about 12s when the Ethernet is disconnected.Because this phenomenon is that SIM900A uses GPRS to communicate while GPRS transmission rate is only about 56 to 114Kbps .However, 10Mbps is a certain gap for ENC28J60.System design taking into consideration factors such as cost and stable areas, there is no choice of the current 3G/4G communications technology.

VI. CONCLUSION
The experiments show that the control system design is reasonable, reliable operation and has good scalability comparing to traditional video surveillance system.The alarm information is accurate, targeted and real-time.The system pushes cloud exception information to cloud server which is used remotely observe and control terminals.ACKNOWLEDGMENT First and foremost, I would like to show my deepest gratitude to my supervisor, Prof. Zhang Liping, a respectable, responsible and resourceful scholar, who has provided me with valuable guidance in every stage of the writing of this paper.Without her enlightening instruction, impressive kindness and patience, I could not have completed my paper.Her keen and vigorous academic observation enlightens me not only in this paper but also in my future study.I would also like to thanks my teacher Prof. Chen Yuchen he have helped me to develop the fundamental and essential academic competence.

Fig. 4 .Fig. 5 .
Fig. 4. ENC28J60 and MCU circuit IV.SOFTWARE SYSTEM A. The host software and system structure In this system, we used Keil uVision5 MDK as development tool.It was officially released by ARM on October 2013.It includes data collection procedures Wiegand ID card, SPI driver, and TCP / IP communication protocol LwIP protocol, SIM900A AT command communication program, serial communication program and the main loop procedures.Master program flow is shown in Figure 5.