Design of Home Monitoring System Based on Embedded Linux

1 system process architecture

The operating system platform of this system is Linux, the kernel version is 2.6, the target board includes video capture, GPRS module and controller S3C2440. The controller is mainly responsible for providing image data to the customer display and back-end service. The way the video server is started is initiated by the background or trigger. When the user triggers an event, the acquisition program is automatically started or remotely initiated by the user, and then the image data is captured.

2 system design

2.1 Device drivers under Linux

Linux is a free operating system, its source code is public, we can carry out the necessary research and modification according to the needs of the experiment. In the Linux operating system, devices exist in the form of files. The operation of the device is the operation of the file, so that the user can call the general file operation function to access and operate the device. A device driver is an interface between the Linux kernel and an external device. They are executed according to a series of standard function calls by the user. By calling a separate driver, the device of the actual hardware is called to perform a specific operation. The programming interface enables the driver to run independently of the rest of the kernel, just as it is "embedded" into the kernel. This modular design makes the Linux driver easy and efficient to write. The operation is simple and risky, because the device driver is running in the kernel. If there is a problem with the driver writing, it is very likely that the entire Linux system will run into problems. Drivers run differently from normal applications. Drivers can only call their own functions and standard functions in the kernel. Generally, applications can only call application functions such as external databases. Kernel module source files can not include general library files, only kernel functions specified in the kernel can be used, otherwise problems will occur. This is also the difference between the way the driver is written and the way the application is written. The other difference, of course, is that the kernel is different from the way normal applications handle errors:

The error in the application is that it will not cause a system failure, and the debugger can be used to trace the source code to find the problem, but the kernel error may affect the entire system, even if it does not affect the system, it will kill the current The problem with the process, and you can't use debugging to find the source of the problem.

2.2 Infrared Interrupt Trigger Design

The monitoring system realizes the infrared pyroelectric sensor drive and is driven by a character device. Since the S3C2440 has 117 I/O lines. Its I/O line is divided into 8 groups of ports, namely GPA, GPB, GPC, GPD, GPE, GPF, GPG, GPH. When someone enters or leaves the sensed area, the level of the pyroelectric infrared sensor will occur. Change, causing an interruption. The pyroelectric infrared sensor senses that when someone enters, it will automatically start the sleeping video capture device and collect data for the target. At the same time, the driver of the pyroelectric infrared sensor needs to call the interrupt mode to notify the kernel, and let the kernel notify the video collector that it has entered the working state, thereby facilitating device management.

The S3C2440 is configured and controlled by functions and macros on the GPIO pins; the function S3C2440 _ GPIO _ CFGPIN is used to configure the multiplexed GPIO pins; the function SET_ IRQ _ TYPE sets the external interrupt triggers. This monitoring system uses the macro IRQT _ BOTHEDGE to configure the interrupt. The interrupt number is defined in the kernel header file, and each external interrupt is assigned a different interrupt number for control. When the kernel receives an interrupt response, it uses the asynchronous notification method. In order to resolve asynchronous communication of files, the user program must do two things: first, the process must be assigned the "owner"; second, in order to run the asynchronous notification, the user program must set the FASYNC flag in the device. According to the kernel driver, the driver must define its own fasync method. When the program starts to F_SETFL, FASYNC is started and the kernel calls the driver fasync. The kernel space uses an asynchronous signal to send a signal to the user. The corresponding signal function is:

Void kill_fasync(struct fasync_struct **fa,intsig,init band)

The function of the signal function is to trigger the interrupt response when the output level of the infrared sensor changes from high to low or low to high, and the external device obtains a level change generated by the processing function, so that the read method is defined in the driver.

2.3 video capture driver

Initialize some default values ​​of the camera in the initialization process, start the camera program according to the camera command sent by the infrared sensor, start taking the photo, save the image data in JPEG format, and send it to the mobile terminal Wheel (1)

{

If(paizhao)

{

_pal=0;

sendPaiZhao() ;

readJPEG() ;

keepData() ;

sendData() ;

}

}

2.4 JPEG compression encoding of image data

In general, uncompressed JPEG image data takes up a large amount of storage space, is very expensive, and is not conducive to network data transmission. Therefore, it is necessary to compress image data. For image compression methods, there are already implementations in the Libjpeg library under Linux. Libjpeg is a standard library under Linux that can be called directly to implement image compression. The main function of this library is to compress the image into a JPEG file format at a certain compression ratio. Since Linux is open source, this library is also open. Not only can work under the general Linux operating system, but also work under embedded Linux. This reduces a lot of underlying work and helps avoid repetitive development efforts.

Before using this library, you first need to install and compile this library. For embedded Linux, the libjpeg library is included in the embedded Linux source code package. This library is added when configuring the relevant library file options, and the kernel can be used to compile the libjpeg library.

The image compression wrapper calls the compress function of the image class as follows:

Int image compress(image *newone, int quality) The function of this function is to compress the image into JPEG format according to the specified quality ratio. The two parameters in the function are pointers to the new image class data (ie, compressed image data), and the other parameter is the specified compression ratio, generally ranging from 0 to 100. The larger the number, the quality of the compressed image. The higher the value, the clearer it is, but the larger the data file size after compression. Therefore, the compression ratio is not as large as possible, and needs to be determined according to the actual needs of the experiment to meet the experimental functional requirements and the storage cost and transmission cost are the minimum standards.

2.5 Sending and receiving short messages

The embedded monitoring system connects to the GPRS by using the serial port, and uses the GPRS module to send and receive short messages. There are two modes for sending and receiving SMS messages, text mode and PDU mode. The text mode can only send flexible ASCII characters. The content of the short message is simple. The biggest shortcoming is that other characters cannot be sent or received. The PDU mode performs new encoding according to a certain format. Generally, the PDU sequence of the hexadecimal number is mainly used, and all Chinese or images are encoded and then sent (see Figure 2-1).

Termination Box Outdoor Wall Mountable available FC/SC/ST/LC Adapter

Standard Wall Mount Enclosure is mainly used for connecting the indoor/outdoor optical cables, patch cords and pigtails. It can be wall mounted or pole mounted and provides various accessories to avoid any unexpected damage to the fiber. 


This types of fiber termination box as distribution box, it is usually used in between wiring closets and equipment for fiber optic cable termination, use and management.

Note: This box does not come with any adapters and pigtails. If you need them, we can install them for you with few charges.


Features

Suitable for ribbon and bunchy fiber cables Fiber splice trays can be installed and changed easily Small dimension and exquisite and easy for operation Standard cell structure size, wall mounted patch panel Capacity: 12-144 ports Suitable for SC, FC, ST Simplex & LC Duplex


Specifications

Technology: Electrostatic spraying Material: SPCC or AL or customized Color: Milk White Compliant with ISO: 9001, RoHS, UL, Bellcore certification Atmosphere pressure: 70KPa~106KPaType: Single door open

Fibre Optic Distribution BoxFiber optic Distribution cabinets


Outdoor Fiber Optical Distribution Box(Metal)

Fiber Optic Box,FTTH Distribution Box,Fiber Terminal Box,Outdoor Fiber Optic Distribution Box

Sijee Optical Communication Technology Co.,Ltd , https://www.sijee-optical.com