International Conference on Logitic Engineering, Management and Computer Science (LEMCS 2015) Warehoue Security Sytem baed on Embedded Sytem Gen Li Department of Electronic Engineering, Tianjin Univerity Email: 996771037@qq.co m Jianmin Zhang Department of Electronic Engineering, Tianjin Univerity Email: bjmzhang628@eyou.com Minghua Niu Department of Electronic Engineering, Tianjin Univerity Email: 981859678@qq.com Yong Li Sichuan Univerity of Science & Engineering Sichuan 643000, China Email: 2603127446@qq.co m Abtract Thi paper deign a ecurity ytem for warehoue ecurity. Baed on linux and S3C2440, thi ytem peripheral device include enor, humidity enor, camera, web client, Android client, fan, and led. It ue the enor to monitor the and fire, ue camera to real-time monitor whether there are unafe factor. If the ytem detect that the room i too high or too low, it will automatically alarm the ecurity taff and automatically open the fan. Through the camera real-time monitoring, the ecurity taff might be upiciou peron or ha unexpected event in the warehoue. The video urveillance alo will capture real-time video data and tranfer data to Android client, then ecurity peronnel will control the ecurity information whenever and wherever if they need. If the warehoue break out of fire, thief, accident, and o on, thi ytem will take automatic protective meaure, capture video evidence, and warn the ecurity taff. Finally, if the warehoue ha an accident, the ytem will reduce the damage to the lowet. Keyword-Security ytem; Linux; Embedded; Remote control; Android I. INTRODUCTION After the ytem tart, firt, initialize the mutex lock and other global variable, and then open 4 thread: camera, erial port and Android. Camera thread drive camera module to initialize equipment, then capture the image and place it in the hared memory. Then it will judge the client if it ha a real-time monitoring command, if there i, it end ome word to the client through the network and tore the picture to the databae. Otherwie, it tore the picture to the databae and then put the picture in the hared memory; Serial thread initialize the M0 module, et the baud rate a 115200, 8 data bit, 0 parity bit and 0 top bit. It read the value of enor and the humidity enor. Afterward, determine whether the and humidity i normal. If there i ome Abnormal, it will end a alarm meage to the uer mobile phone remotely through internet; Android thread drive Android module to initialize erver and monitor meage. It will judge if there ha a new connection or a new command, if there i, it will etablih a TCP link to receive command and tranfer data. Otherwie, it will till monitor ytem all time. II. THE DESIGN OF SYSTEM NODULES FUNCTION A. Camera module Thi module i ued to control the camera to read the image frame and tore the read-data into the hared memory. The main proce function get the data from the hared memory to proce for further tep. In thi ytem, the camera will monitor creen in real-timely. In Linux, the video device i the device file, and it can be acceed like ordinary file uch a reading and writing, the camera in the folder of /dev/video1. Video4Linux2 (V4L2) [1-3] i an application programming interface for audio and video image. Thi module ue Video4Linux2 application function and data organization to acquire the USB camera image under the Linux ytem. Firtly, the ytem open the camera equipment according to the name or number of device. Then it initialize the video equipment and et picture format ize, frame format, the camera capture mode and ditribute cache. Later, it realize the application and mapping of the Image frame buffer. Finally, the camera module capture the image and tranform YUYV format to RGB24 format, then tranform RGB24 format to BMP format. At lat, it 2015. The author - Publihed by Atlanti Pre 1229
hut down the equipment [4-6].Camera flow chart i hown in Fig. 1. Camera BMP main() format image V4L2 Drive YUYV image RGB24 format image Figure 1. Camera flow chart The note of V4L2 : Thi module ue V4L2 technology and USB interface; it need to configure the kernel driver. Configuration i hown below: cd linux-2.6.35-faright/ make menuconfig Device Driver ---> <*> Multimedia upport ---> <*> Video For Linux [*] Enable Video For Linux API 1 (DEPRECATED) [*] Video capture adapter ---> [*] V4L USB device ---> <*> USB Video Cla (UVC) [*] UVC input event device upport make Zimage -j2 for Zimage. The V4L2 pecific procedure: 1. Open the equipment by the block way. 2. Obtain equipment capability, look at equipment function. 3. Set the tandard and the frame format, including PAL, NTSC. Frame format width and height. 4. Application cache for device. 5. Tranform the frame buffer to phyical addre, and mapping to uer pace, o that it can be operated directly collected frame, without having to copy. 6. Apply all frame buffer into the queue, o that tore the collected data. 7. Start the collection of video. 8. Remove frame buffer data which have been collected from the queue, acquire the original collection data. 9. Move the buffer to the end of queue again, o you can loop acquiition. 10. Stop the video collection. 11. Cloe the video equipment. B. The GPRS module When the S3C2440 receive the warning information, firtly, open the erial port equipment, et the baud rate erial port initialization, data bit, parity bit and top bit, and then end the control command and information to the GPRS module, and finally cloe the erial port. GPRS will end the alarm information to the mobile phone. C. M0 control module The M0 module acquire the and humidity information through a enor and humidity enor, and then change the data with data through the erial port. Furthermore, the M0 module can receive the control command from Android and PC, Store and end the and humidity data to the network. So the ytem can control the led and fan in the warehoue through the data in the network. The detailed tep are hown in Fig. 2. 1230
Start To obtain Sent the and humidity to the Android in the mutual excluion In the mutual excluion condition: flag=flag_fan condition Temperature Too high In the mutual excluion condition: flag=flag_ave Clo e fan Internet Send the high data of! Open fan T Too low Internet Send the high data of! Sent the and humidity to the PC in the mutual excluion condition In the mutual excluion condition: flag=flag_led In the mutual excluion condition Flag=glag_real Cloe led! Open led! Figure 2. Flow chart of M0 control 1231
D. The network module Thi module i ued for ending video and and humidity to the databae, Android client and web client. The Android client and web client alo can ent command to thi module to control the fan and LED [7]. The detailed tep are hown in Fig. 3. Start Etablihed the elect-model to monitoring the client Old client meage New client meage Read head command Landing head command Monitor Fan Led Added new connection to ocket lit Return the login to client Open real time monitor Send the open fan to M0 Send the open led to M0 Figure 3. Flow chart of network module 1232
In above figure, after network module operate, firt etablih the elect-model to monitor the client. If thi i a new client link, it will be added new connection to ocket lit and return the elect model; if it i an old uer link, check whether the client end a meage, if end and thi module received information i read command head. To determine whether the login command, if it i the landing and will return the information to the elect model, or to judge whether the real-time monitoring; if it i a real-time monitoring of open real-time monitoring ign and return the elect model, or to determine whether the fan control command; if it i fan control command, end control command to the M0 fan and return to elect model otherwie, to determine whether the control command i led, then end the control command to the M0 to return led elect model, otherwie it return elect model. E. Web erver module Thi module i ued for Web Webpage repone from client requet, including Web page login and exit function, regitration or delete uer or modify paword, Web real-time monitoring, check the Web monitoring recording, control the witch of LED light and fan from Web page [8] [9]. The web erver work flow: firt initialize the data area and the erver, when a new requet or order the command paring, thi intruction ha five cae: A. Requet landing. B. Login error. C. Send a control command to the erver. D. Call the databae to obtain data interface (read the image,, humidity etc.). E, Store the interface by call the databae (ave picture,, humidity etc.). If there i login error, then are login. If the login i ucceful, to determine whether the root uer, if it i, then add, delete uer to modify the erver, other uer paword etc. If you're not a root uer, jut ordinary uer, you can only modify the correponding table and character egment the uer paword and update the databae [10]. F. The Android client Thi module i ued to diplay the, humidity data, control the monitoring, control the video, fan and led equipment, end and receive with the erver. It include four function: MainAct, MoinAct, ClientAct and RegAct [10-13]. The main interface (MainAct): When you open the Android client, firtly, it appear landing interface, then initialize get each view object intance, connect to the erver to get the ocket object, initialize the MyApplication get handler, then open thread, circulation receive from the erver information. Detection of landing button ha preed, if it ha, ent to the erver login information, if not, to detect whether the received handler login information i correct, incorrect information will continue to wait, if it i correct, the jump to the MoniActivity. The monitoring interface (MoinAct): After tart equipment, initialize each view intance, get a handler object, get ready to accept the meage, and refreh the imageview picture if meage i the picture, if meage i the, humidity,, humidity diplay information. Cutomer interface (ClientAct): Firt, read the 10 head byte of Command, then detect whether the login command, if it i, ending meage to mainacticity, ele detecting whether the login command head, if it i to end meage to MoniActivity, or to detect whether the image i of the head of the order, if it i to end meage to MoniActivity, detection of, humidity or whether it i the head of the order, then end a meage to the moinactivity. Regitration interface (RegAct): Firt, initialize each view, get intantiated object, receive input account and paword, then the two tet input paword i conitent, if conitent, end the account number and paword to the erver, or to re input. If the return i the end of the correct erver login regitration proce, or continue to enter the account paword. III. CONCLUSIONS Thi paper mainly complete a warehoue ecurity ytem baed on Linux Sytem. It contain enor, humidity enor, urveillance module, M0 control module, the web erver, the mater erver, the web client, and Android client. Thi ytem can help enterprie to adminitrate warehoue, make ure the afe of it by a variety of meaure, and can real-time operation remotely. It can automatically alarm the danger in time and control the video urveillance to end real-time video data to a web erver or Android client ued by ecurity peronnel. They can monitor and control warehoue related facilitie in order to protect the afety of the warehoue to the maximum extent. IV. REFERENCE [1] Michael H Schimek,Bill Dirk,Han Verkuli.Video for Linuxtwo API pecification http://v4l2pec.byteex.org/v4l2pec/v4l2.pdf. 2008 [2] Dirk B.Video for Linux Two API Specification. [3] Samung Electronic.S3C2410A 200MHz&266MHz 32-bit RISC Microproceor USER S MANUAL Reviion 1.0.. 2004 [4] Dirk B.Video for Linux Two API Specification.. [5] Video4Linux Kernel API Reference. http://linux.byteex.org/v4l2/api.html. [6] WANG Fei,KONG Cong Realization of Linux camera driver baed on V4L2[J]. Electronic Science and technology. 2012(02) [7] Hinton G E,Salakhutdinov R R.Reducing the dimenionality of data with neural network[j].science,2006(5786):504-507 [8] ]XU Hong-hua,LIU Ke. Development and application of controller baed on embedded Sever Web Indutrial computer 2004/04 [9] Guan Mo;Gu Minghai Deign and implementation of an embedded web erver baed on ARM 20105. [10] Hammel M J Mongooe:an embeddable Web erver 2010(192) [11] ISO bae media file format[s/ol]. ISO/IEC14496-12. 2008 [12] Shiddiqi A M,Pratama H,Ciptaningtya H T.A Video StreamingApplication Uing Mobile Media Application Programming Interface. Telkomnika. 2010 [13] Gavala D,Economou D.Development Platform for Mobile Ap-plication:Statu and Trend. IEEE Software. 2011. 1233