Graperain Blog ARM Embedded News, Announcements, and Ideas

Design and Realization of Embedded Smart home Monitoring System

With the rise of home network research, how to design a kind of home gateway management, protocol conversion and home network monitoring as one of the home gateway, to achieve home appliances network, intelligent and remote control, has become the current research focus.

In this paper, based on the CGI principle, the embedded database as the backstage, using software programming method to achieve the user, Web server and gateway applications dynamic interaction between the proposed - a new SIP protocol and embedded database to achieve home remote monitoring and control solutions have been proposed.

2 Overall Plan

The system includes information appliances, smart home gateway and remote monitoring. The home appliance is connected to the home gateway as the intelligent terminal of the SIP, and sends the network identification application frame and the device description file to the latter in the form of a SIP message to complete the registration. The home gateway is based on the SIP network server and the Web server, on the one hand, authentication and management, on the other hand for the remote monitoring side to provide services; Users can take PC browser and SIP user agent based on the monitoring software in two ways to achieve remote monitoring of information appliances. The overall structure shown in Figure 1.

In the design process of home gateway of hardware platform, this paper adopts the modular method, taking the central processing unit as the center,

Design other related functional modules. In software design, ARM7TDMI core microprocessor transplanted the embedded operating system uCLinux, to provide the underlying software support for SIP protocol stack. SIP-based SIP protocol server to complete the network server, information appliances to achieve the registration, certification and management. And transplanted Boa Web server and SQLite database to uCLinux system, based on the principle of CGI to achieve dynamic Web technology.


Figure 1 Embedded smart home monitoring system overall structure 

Figure 2 Home gateway hardware platform structure design

3. The Application of Embedded Database in Monitoring System

In the embedded remote monitoring system, the need for a large number of real-time data acquisition and processing, a variety of data storage and management need to support a background database. As the embedded system hardware and software resources are limited, the traditional enterprise databases such as Oracle, Sybase and other obvious bloated, which is difficult to play a role, therefore, this paper selected a small open-source embedded SQLite database, and home gateway ARM-uCLinux platform for its transplant, cut and application.

3.1 SQLite in the realization of ARM-uCLinux

SQLite is written in C language, open source embedded database engine, which takes very low resource consumption, in embedded devices, only a few hundreds K of memory is enough. It supports Windows / Linux and other mainstream operating system, its processing speed faster than open source world-famous database management system Mysql, PostgreSQL. SQLite's support for the SQL92 standard includes indexing, limiting, triggering, and viewing, supporting atomic, consistent, independent, and persistent (ACID) transactions.

SQLite in ARM-uCLinux the main transplant steps are as follows:

(1) Download and unzip the package to the uCLinux-dist / user directory;

Tar zxvf sqlite-2.8.16.tar.gz -C uCLinux-dist / user /

(2) Refer to uClinux-dist / Documentation / Adding-User-Apps-HOWTO;

Add SQLite as a user application for uCLinux

(3) Modify SQLite for ARM-uCLinux;

Modify sqlite / src / os.c, sqlite / src / shell.c and other documents

And to sqlite / Makefile.linux-gcc file as the blueprint, write a suitable Makefile

(4) In order to run make dep; 

make lib_only; make user_only; make romfs; make image

That is compiled in uClinux-dist / images under the romfs file system contains sqlite.

(5) Download romfs to ARM-uCLinux can read and write directory, you can run sqlite.

3.2 The C program design of SQLite

Embedded database SQLite integrated with the operating system and specific applications, do not need to run an independent database engine, which directly calls the corresponding API function to achieve the data access operation. There are three core API functions. Sqlite_open () and sqlite_close (), respectively, to open and close the embedded database file that is set up and release the SQLite engine, and sqlite_exec () can execute the SQL statement and get the results through the preparation of their own callback function can be further processed on the implementation of the results.

The system real-time data acquisition and processing module through the field bus in accordance with user-set control parameters (such as A / D sampling frequency, etc.), the information appliance signal acquisition and digital filtering, and then adjust the API function to the data into the SQLite database . SQLite manages device information, and supports querying and modifying functions.

4. Application of SIP Protocol in Home Gateway

SIP (Session Initiation Protocol) is a signaling protocol [3] proposed by IETF (Internet Engineering Task Force) in 1999 to implement real-time communication based on IP network. It is simple in structure, easy to extend, and provides good QoS support. Although it is mainly designed for IP networks, it can also work in bearer networks such as ATM and frame relay. It is an important solution for next generation VoIP networks.

4.1 The function design of each component of SIP in home gateway

SIP protocol includes two types of components: User Agent (User Agent) and network server (Network Server). User agent to complete the call initiation and reception; network server mainly for the user agent to provide registration, authentication and routing services, it is divided into a proxy server, relocation server and registration server.

The function of each network server in the system is designed as follows:

 (1) Registration server to accept the user agent (information appliances) registration (REGISTER) request, in SQLite in the dynamic establishment of the logical address of appliances and their current correspondence between correspondence. So that regardless of where, you can communicate through a unique logical address, to achieve the support of home appliances mobility. Return to the status code for the success of 200 responses to complete the registration of information appliances.

(2) The relocation server provides the address resolution service, which is similar to DNS. It is used to construct a redirection response message when needed (such as information appliance location change, load sharing, etc.) and return the new destination address to the monitoring program.

(3) Proxy server similar to the HTTP Proxy SMTP and MTA (Message Transfer Agent), is responsible for receiving user agent (monitoring software) to the request, according to the network strategy will be sent to the corresponding information appliances, and received The response responds to the monitor.

4.2 SIP protocol stack implementation

SIP protocol stack oSIP is the first free software project, the use of standard c write, simple and compact, fast speed, support thread safety, you can develop the registration server, proxy server and user agents [4]. OSIP development library is mainly in the uCLinux SIP protocol syntax analysis and state machine analysis, in order to achieve SIP server development interface.

The SIP protocol stack designed in this paper is modified and re-developed based on oSIP development library. It mainly includes two parts: state machine module and syntax parser module. The former completes the state record of a transaction (registration process, call process, etc.), and triggers the corresponding event in a specific state. The latter mainly completes the analysis of SIP message structure and URL structure. The following is the home gateway to accept information on the registration of home appliances part of the source code:

 (1) Initialization oSIP stack: Int osip_global_init ();

(2) Contains the SIP finite state machine API library file: # include

(3) Contains the SIP parsing API library file: # include

(4) Part of the function statement

Void osip_setcb_rcvinvite (); / * Information appliance sends request to SIP server * /

Void osip_setcb_rcvregister (); / * SIP server to complete the registration of information appliances * /

Void osip_setcb_rcvack (); / * The SIP server sends a reply to the home * /

5. Design of Home Gateway Based on SQLite and SIP

As the core of smart home facilities, home gateway design is particularly important. It provides a unified platform for the information appliances, which can realize the interconnection and information exchange between information appliances or information appliances and remote control terminals.

5.1 Hardware platform design and operating system selection

32-bit ARM embedded microprocessor with high performance, low power consumption characteristics, has been widely used in consumer electronics, wireless communications and network communications and other fields, is extremely suitable for cost and power requirements of more demanding applications.

Therefore, this paper selected a Samsung ARM7TDMI core based on the 16/32-bit RISC embedded microprocessor S3C44B0X. And other functional modules: FLASH interface module, SDRAM interface module, network interface module and other peripheral auxiliary circuit modules such as clock circuit, reset circuit and so on. as shown in picture 2.

UCLinux adds support for microprocessors without MMU on the basis of Linux [6], so it inherits most of the advantages of Linux on the one hand: stability, various network protocol stacks support, and different types of file systems Support, etc .; On the other hand, it is widely used in embedded collar

UCLinux adds support for microprocessors without MMU on the basis of Linux [6], so it inherits most of the advantages of Linux on the one hand: stability, various network protocol stacks support, and different types of file systems Support, and so on; the other hand, it is widely used in the embedded field, the kernel streamlined (generally less than 512k), and support many commonly used embedded microcontroller series. It is out of multi-task control, network functionality and portability considerations, the design of embedded operating system used uClinux, and complete the ARM microprocessor on the transplant.

5.2 Web server and the application of embedded database

Boa is a single-task http server, open source, high performance, support for certification, support CGI. Currently, uCLinux boa has been included in the source code, so the realization of Boa in uCLinux is very simple, just in the boa.conf and mime.types file to modify the path stored in the CGI program and stored in the directory.

SQLite stored in the basic information of each appliance, parameter values and status information, which not only reflects the historical status of various parameters, but also an important source of information management and decision-making, when needed through the embedded database access To achieve the information retrieval and remote monitoring of information appliances. Data management is a very important part of the remote monitoring system.

In this system, the SIP network server dynamically establishes the correspondence between the logical address of the appliance and its current contact address in the SQLite to complete the registration of the information appliance. The user can access the Web Server in the home gateway through the browser and submit the parameters to the Web Server for receiving. The Web Server then passes this parameter to the CGI program analysis. The CGI transfers the state parameters of the home gateway in SQLite and translates the results into Web browser can recognize the format, as a Http response message back to the client, in order to achieve the information appliances set up and information exchange.

6 Summary

Information appliances and home network and the rapid development of home gateway technology, will bring our current home life new surprises.

The combination of ARM, uCLinux and SQLite embodies embodys the characteristics of embedded system which improves the performance of home gateway. The use of standard SIP protocol not only solves the problems of current management, naming and moving of home appliance equipment, control program designers do not have to care about the implementation details of the home gateway, only need to follow the SIP protocol specification and smart home network information appliances to interact, thus increasing the versatility of the home gateway to simplify and expand the smart home network applications. Hoping to provide some reference for the research of remote monitoring system.




Release: pty001 Category: Embedded hardware design Comment: 0 Viewed: 0
Leave a message
◎Welcome to participate in the discussion, please here to express your views and exchange your views。