Your SlideShare is downloading. ×
Embedded linux sql database database application in the intelligent monitoring system
Embedded linux sql database database application in the intelligent monitoring system
Embedded linux sql database database application in the intelligent monitoring system
Embedded linux sql database database application in the intelligent monitoring system
Embedded linux sql database database application in the intelligent monitoring system
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Embedded linux sql database database application in the intelligent monitoring system

1,388

Published on

for more projects visit @ www.nanocdac.com

for more projects visit @ www.nanocdac.com

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,388
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. The Research of Embedded Linux and SQLite Database Application in the IntelligentMonitoring SystemLiu Yang, Heming Pang, Linying Jiang ,Kun YueSoftware CollegeNortheastern UniversityShenyang 110004, Chinayangliuneu@qq.comAbstract— The Lab Intelligent Monitoring System based onS3C2440 ARM microprocessor and embedded Linux has beendesigned to accomplish the remote monitoring of theparameters and video images of environment in theLaboratory. The embedded database SQLite manages the datacollected by sensor networks. A system program based on Qt /Embedded and Linux drivers realizes the local management ofenvironmental data. Build an embedded web server to launchthe data of sensor networks and video images to achieveremote monitoring. This paper focuses on the difficult points ofthe application and realization of embedded database SQLitein the Intelligent Laboratory Monitoring System for the localmanagement and remote release of the data collected by sensornetworks and video camera.Keywords- embedded database; Qt/Embedded; embedded webserver; intelligent monitoring systemI. INTRODUCTIONThe intelligent remote monitoring system is currently ahot research field of embedded systems. A large amount ofdata collected by sensor networks and video equipments hasto be storied and processed to realize intelligent remotemonitoring. Diversified storage and management of the dataneed the support of back-end databases. However, inresource-constrained hardware and software environment forembedded systems, the traditional enterprise database isdifficult to play its role. The close integration of embeddedsystems and the database technology has become animportant direction of the research and development forembedded systems.Nowadays the management of the domestic laboratories inthe research institute and universities has issues of poor realtime, high cost and low precision .It is difficult to determinethe quality of the environment of the laboratory. So theLaboratory Intelligent Monitoring System should bedeveloped to implement early warning, remote control, real-time monitoring and other functions. This paper focuses onthe process and difficult points in the application ofembedded database SQLite to realize the local managementand remote release of the data collected by sensor networksand video equipments.II. SYSTEM TOPOLOGYThe general framework of the Laboratory IntelligentMonitoring System is divided into two parts which are thelocal ARM Intelligent Monitoring Center and its peripheralequipments and all kinds of remote monitoring terminals.A. ARM Intelligent Monitoring Center and its peripheralequipmentsARM Intelligent Monitoring Center uses SamsungsS3C2440 processor as its main controller, the performanceand frequency of which are suitable for real-time videoimage capture and processing applications [1]. The systemhardware architecture is shown in Figure 1. Embedded Linuxoperating system and boa embedded web server run on themain controller to manage various types of equipmentsincluding sensor networks, GSM / GPRS dual-band module,USB cameras and so on.S3C2440ARM microprocessorGSM / GPRSmoduleElectrical equipmentswitchesSensor expansion boardMobile phoneterminalRemote PCterminalRS232TCP/IPUSBRS232I/OSensornetworksSensornetworksSensornetworksGSMSensornetworksUSB cameraFigure 1. Hardware architecture of the systemB. Various types of remote monitoring terminalsRemote monitoring terminals, including mobile phones,fixed phones, mobile PC, PDA and so on , are connectedwith the ARM Intelligent Monitoring Center through GSM,PSTN, and TCP / IP networks. Users can log on the ARMIntelligent Monitoring Center through any remote terminal tooperate monitoring software, view the data of monitoringcenter and know about the environmental conditions andvideo image in the laboratory.For the condition that there are large numbers oflaboratories to be monitored, we can consider increasingmonitoring PC in the middle-level. Then the monitorinformation of ARM intelligent monitoring centers can behandled in a centralized manner in the monitoring PC toavoid the constraint software and hardware resource in theembedded host to limit achieving demand for large-scalemonitoring functions. But the costs of the system will beincreased at the same time.2010 International Conference on Intelligent Computation Technology and Automation978-0-7695-4077-1/10 $26.00 © 2010 IEEEDOI 10.1109/ICICTA.2010.448910
  • 2. III. DESIGN OF EMBEDDED DATABASEA. Embedded Database SQLiteThe traditional database products such as Oracle, DB2and Sybase provide the basic functions such as add andquery. They also provide triggers, stored procedures, backupand recovery of data and other advanced features. However,as for embedded applications such features are notcommonly used.Embedded databases are usually integrated withoperating systems and specific applications, with no need tooperate the database through database engine independently.The program calls the corresponding API to realize the dataaccess operations directly. The biggest difference betweenembedded database and traditional database is its small sizeand the simple operation, which is convenient and suitablefor embedded systems. The well-known open-sourcedatabase SQLite which abandons many complex features oftraditional enterprise database and only implements thenecessary functions in terms of a basic database is one of themost widely used embedded database [2-3].The systemoverhead is small and it has retrieval efficiency, supportingACID properties and SQL92 standard.The architecture of SQLite database is shown in Figure2. Any operation of the database is in accordance with thisorder one by one. The top is the Tokenize and Parser. SQLitehas highly optimized code generator, so it can produce codesquickly and efficiently. In the bottom, B-tree which isoptimized to run on an adjustable page buffer can minimizeseek time for the disk.CodeBackendSQL CompilerBackendSQL Command ProcessorInterfaceVirtual MachB-TreePagerOS InterfaceTokenizeParserCode GeneratorUtilitiesTest CodeFigure 2. The architecture of SQLite databaseThe Intelligent Lab Monitoring System needs toimplement the local storage and dynamic update of the datacollected by sensor networks for the achievement of localmanagement and remote release of environmental data. Theformer can achieve the functions such as query and settingfor monitoring data through a GUI which forms a friendlytouch screen human-machine interface with the help of theembedded GUI technology; The latter can be implementedthrough an embedded web server. The remote monitoringclient browser posts a HTTP requests and then CGIprograms operate SQLite database.B. Design of the Data Table in SQLiteSQLite is driven directly by programs and can be seen asdata files that have basic database features and providesoperations interface such as sqlite3_open (), sqlite3_exec (),sqlite3_close () for the database. There are two types oftables in the database of the intelligent monitoring system:the user table and the sensor data table. The user table whichstores username and password can interact with loginprograms and registration programs. Sensor table mainlystores the data collected by various types of sensors. Theattributes for sensor table and the meaning of thecorresponding values are listed in Table 1.Time and serialnumber attributes are not included.TABLE I. DESIGN OF SENSOR TABLE IN SQLITEAttributes Value typeTemperatureSoundCO2InfraredGasHumidityTemperature value1 Silent/0 SoundConcentration0 No signal/1 Signal0 No signal/1 SignalHumidityFloatSmallintFloatSmallintSmallintFloatC. Local Data Management SQLite and Embedded GUIThe local data management for sensor networks includesthree parts which are data storage, data analysis and datadisplay.Storage of Sensor DataThe ARM Intelligent Monitoring Center acquires sensordata via the sensor expansion board. Sensor expansion boardwith Mega8 as its master chip is used for data acquisitionand communicating with intelligence monitoringcenter. SCM software is in charge of the local polling toobtain the status of each sensor and monitoring data. It cansend out an interrupt request signal. ARM intelligentmonitoring center send control commands to SCM accordingto the definition of serial communication protocol, the latterreturns the state or data of specified sensors according to thecommands.The sensor data is acquired and updated in a fixed timeinterval managed by SQLite database. But when thefrequency of data acquisition is high, the data in theembedded database will be drastically increased and there isa need to clear the historical data, or the access performanceof the database will gradually decline. The program flowchart for the storage of data in SQLite is shown in Figure 3.911
  • 3. Send commands toexpansion boardBeginThread suspend interval TIME1Open the database filecount++Insert into table whereindex=countFailed to open?Ycount=count/MAXROMInitialize count = 0NInitialize the serial portNYClose the database fileClose thesystem?EndDeposit an array of sensordataGet the current system timeFigure 3. The program flow chart for the storage of data in SQLiteAnalysis of Sensor DataThe flow chart for data analysis module is shown inFigure 4.BeginTemperature attribute?Higher than thethreshold value?YHigh temperature alarmTake photos/save image files to rootdirectory of embedded web serverYNEliminating the process forother sensorsThread suspendinterval TIME2Select meta-set corresponds tocurrent system timeClose monitoringsystem?NYNEndSend a warning message /open theair-conditioning for refrigerationFigure 4. The flow chart for data analysis moduleData analysis module is responsible for analysis of thecurrent sensor data stored in the database. If there is anexception for the sensor data in comparison with thethreshold, then the system will call the GPRS module andelectrical device driver functions to make correspondingprocessing such that when the temperature is too high, wemay think a big fire must be caused .So the system send analarm message to the user, dial the phones, cut off the powerof large electrical equipment at the same time.The implementation of data storage and analysis moduleshould adopt the multi-threaded programming, which savessystem resources. When the system initializes, three threadsnamed gprs_read, ilmsSQLiteMan and sqlite_test werecreated. They are responsible for the initialization of GPRSmodule, storage of data in SQLite and monitoring of sensordata.To implement sqlite_test thread, the database file andaccess mode must be offered firstly. Call SQlite_open() toconnect and open the database. The function sqlite3_errmsg ()returns the error message if the database file is failed to beopened. Then call sqlite_exec () to select the sets of datacorresponding to the current system time, re-defined callback() function to handle the return results. Finally, the thread issuspended for the predetermined time interval and testcurrent data state again. Use sqlite_close () to disconnect thedatabase connection.Display of Sensor DataThe data display module implement dynamic display ofthe sensor data stored in the embedded database in the ARMIntelligent Monitoring Center extender touch-screen to forma laboratory management system embedded GUI, which isplaced in a laboratory to do touch-check machines. With itshelp we can query various environmental parameters for thelaboratory, display graphical data and give reminderaccording to different range of environmental parameters.The design of GUI for embedded systems is differentfrom that of traditional data computing software, which oftenhandles mouse or keyboard events to complete a specificcalculation, while the former mostly handle events caused bytouch screen and other kinds of external devices. Because theembedded systems is resource-constrained, the design modeof the GUI of the traditional PC ,the memory consumption ofwhich is relatively large and take up more CPU time, is notsuitable for embedded systems. The lab intelligentmonitoring system studied in this paper uses Qt / Embeddedunder embedded Linux as its GUI development platform,which can fully satisfy the restriction of embedded systemresources.Figure 5. System GUI Interface ComponentsWith the help of QT designer[4],the programmer canquickly develop relevant GUI components and adjust the912
  • 4. size and position, including functions such as displaying thecurrent temperature, humidity, concentrations of carbondioxide and harmful gases in the laboratory environment andshowing whether the infrared sensors open or not. And thendefine the signals and slots functions, save it as Ui file. Thefinal GUI of lab environment intelligent monitoring systemis shown in Figure 5.As for the display of data collected by a variety ofsensors, we need to implement the connection between QTand SQLite database [5]. The class QSqlDatabase canachieve a connection for SQLite through the QSqlDatabase::addDatabase () method which is called by the driver"QSQLITE" to establish a connection, and then return aninstance of QSqlDatabase. Use open method to connectSQLite3 database. If it returns false, meaning that it is failedto connect the database, the failure message can be accessedthrough lastError method of QSqlError class. If the returnvalue is true, then we can operate the database.D. Remote Data Release-SQLite and Embedded WebServerTo achieve the remote release of sensor data and videoimages, we can build an embedded web server. Theimplementation of video server will be discussed in anotherpaper in detail. This paper focuses on the implementation ofthe accessing of monitoring data of sensor networks stored inthe ARM Intelligent Monitoring Center through anembedded web server and the control of SQLite databasethrough CGI programs [6].The embedded database SQLite stores data collected bysensor networks. Boa web server is responsible for listeningto customer requests from Internet as a running process inthe background. When users send requests through IEbrowsers to the local embedded web server to start thecorresponding CGI program to accomplish the parsing andprocessing of the parameters, the web server translate therequest parameters into environment variables or standardinput. CGI programs perform the corresponding query andupdate operations of SQLite database and the results areconverted to the format which is recognized by the webbrowsers. Then they are returned to the clients as HTTPresponse messages, thereby achieving the remote query ofmonitoring data collected by sensor networks.In the ARM Intelligent Monitoring Center we build asmall embedded web site, the main content of which ismonitored environmental data and information of videoimages.IV. EXPERIMENTAL RESULTSThe image of the touch-screen interface running onS3C2440 development board for local management of sensordata implemented by the combination of embedded databaseSQLite and embedded GUI is shown in Figure 6 .It canrealize on-site inquiry function of laboratory environmentparameters; The main page of the embedded web server topublish the monitoring data of sensors and video imageinformation which is implemented by the combination ofembedded database SQLite and an embedded web server isshown in Figure 7 .It can realize the remote access of sensormonitoring data and video image information in thelaboratory, supporting the query of the historical recordsand download of the environmental monitoring data to theclient according to requests.Figure 6. Embedded GUI running on the S3C2440 development boardFigure 7. The main page of embedded web site for the intelligentmonitoring systemV. CONCLUSIONSThis paper focuses on solving the issues of poor real time,high cost, low precision and incapability of determiningwhether the lab environment is in line with the body’s healthindicators in the laboratory management of domesticinstitutions of higher learning. It develops a laboratoryintelligent monitoring system based on S3C2440microprocessor and embedded Linux operating system.Transplant the embedded database SQLite to manage thedata collected by sensor networks. A system program basedon Qt / Embedded and Linux driver realizes the localmanagement of environmental data. Build an embedded webserver to launch the data of sensor networks and videoimages to achieve remote monitoring. Embedded databasesare program-driven and in small size, so they are verysuitable for embedded devices. The embedded systemsapplications change because of the variety of actualrequirements, so there is no uniform standard. The embeddeddatabase should fully reflect the characteristics ofcustomizable and the open source embedded databaseSQLite has broad application prospects.ACKNOWLEDGMENTThis paper is funded by National Ministry of EducationCollege Students Innovative Experiment projects (090164)913
  • 5. REFERENCES[1] Samsung Electronics Co Ltd. Users Manual S3C2440A V0.12[M].2004,3.[2] Jing Li,Yong Xu. Remote Monitoring Systems Based on EmbeddedDatabase[C]. Third International Conference on Genetic andEvolutionary Computing.2009:381-384.[3] Lv Junyan,Xu Shiguo,Li Yijie. Application Research of EmbeddedDatabase SQLite[C]. International Forum on Information Technologyand Applications. 2009: 539– 543.[4] Trolltech. Online Reference Documentation [EB/OL].http: //doc.trolltech.com /.[5] Sun Jian-mei, Cao Xin. The design and implementation of anembedded system based on Qt4 [J]. Micro-computer information,2009, 25 (4-2):101-108[6] Ying Feng, Feng Yu-fen. The design and implementation of homegateway based on SQLite database [J]. Micro-computer information,2008, 24 (5-2): 24-26.914

×